nix package updates and stabilization

This commit is contained in:
Jeremy Wall 2022-08-07 16:24:47 -04:00
parent 6d8f253172
commit e1ba92938f
4 changed files with 25 additions and 37 deletions

19
flake.lock generated
View File

@ -67,11 +67,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1639947939, "lastModified": 1659610603,
"narHash": "sha256-pGsM8haJadVP80GFq4xhnSpNitYNQpaXk4cnA796Cso=", "narHash": "sha256-LYgASYSPYo7O71WfeUOaEUzYfzuXm8c8eavJcel+pfI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "naersk", "repo": "naersk",
"rev": "2fc8ce9d3c025d59fee349c1f80be9785049d653", "rev": "c6a45e4277fa58abd524681466d3450f896dc094",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -82,11 +82,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1645937171, "lastModified": 1659868656,
"narHash": "sha256-n9f9GZBNMe8UMhcgmmaXNObkH01jjgp7INMrUgBgcy4=", "narHash": "sha256-LINDS957FYzOb412t/Zha44LQqGniMpUIUz4Pi+fvSs=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "22dc22f8cedc58fcb11afe1acb08e9999e78be9c", "rev": "80fc83ad314fe701766ee66ac8286307d65b39e3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -127,15 +127,16 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1646533330, "lastModified": 1659599305,
"narHash": "sha256-JwtPZekfbIwUFO5xza9sDHOxKsT5E2PFBkJxtvNOI7M=", "narHash": "sha256-htzFq5RffyoKSZxiLfpUq5CyhkQwycsXB5ptale5e78=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "1a459694c46b984f4f55bfe4a59d874c828fb1e8", "rev": "28cedcb8dfea9f1b96b0635cf99fe6bdca163f4e",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "oxalica", "owner": "oxalica",
"ref": "stable",
"repo": "rust-overlay", "repo": "rust-overlay",
"type": "github" "type": "github"
} }

View File

@ -6,7 +6,7 @@
gitignore = { url = "github:hercules-ci/gitignore.nix"; flake = false; }; gitignore = { url = "github:hercules-ci/gitignore.nix"; flake = false; };
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
rust-overlay = { rust-overlay = {
url = "github:oxalica/rust-overlay"; url = "github:oxalica/rust-overlay?ref=stable";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
naersk.url = "github:nix-community/naersk"; naersk.url = "github:nix-community/naersk";
@ -21,19 +21,24 @@
in in
flake-utils.lib.eachDefaultSystem (system: flake-utils.lib.eachDefaultSystem (system:
let let
overlays = [ rust-overlay.overlay ]; overlays = [ rust-overlay.overlays.default ];
pkgs = import nixpkgs { inherit system overlays; }; pkgs = import nixpkgs { inherit system overlays; };
# TODO(jwall): Could this get by with minimal instead? rust-wasm = pkgs.rust-bin.stable."1.60.0".default.override {
rust-wasm = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ]; extensions = [ "rust-src" ];
# Add wasm32 as an extra target besides the native target.
targets = [ "wasm32-unknown-unknown" ]; targets = [ "wasm32-unknown-unknown" ];
}; };
naersk-lib = naersk.lib."${system}"; # make sure to use our rust-wasm build target as the rust toolchain
# in naersk.
naersk-lib = pkgs.callPackage naersk {
rustc = rust-wasm;
cargo = rust-wasm;
};
kitchenWasm = kitchenWasmGen { kitchenWasm = kitchenWasmGen {
inherit pkgs rust-wasm version; inherit pkgs rust-wasm version;
}; };
kitchen = (kitchenGen { kitchen = (kitchenGen {
inherit pkgs version naersk-lib kitchenWasm; inherit pkgs version naersk-lib kitchenWasm rust-wasm;
# Because it's a workspace we need the other crates available as source # Because it's a workspace we need the other crates available as source
root = (pkgs.callPackage gitignore { }).gitignoreSource ./.; root = (pkgs.callPackage gitignore { }).gitignoreSource ./.;
}); });
@ -52,7 +57,7 @@
program = "${kitchen}/bin/kitchen"; program = "${kitchen}/bin/kitchen";
}; };
devShell = pkgs.mkShell { devShell = pkgs.mkShell {
buildInputs = [ rust-wasm ] ++ (with pkgs; [wasm-bindgen-cli wasm-pack diesel-cli]); buildInputs = [ rust-wasm ] ++ (with pkgs; [wasm-bindgen-cli wasm-pack]);
}; };
} }
); );

View File

@ -1,21 +0,0 @@
{pkgs ? (import <nixpkgs>) {},
lockFile ? ./../../Cargo.lock,
version ? "0.2.1"}:
let
cargoDeps = (pkgs.rustPlatform.importCargoLock { inherit lockFile; });
#recipes = ./../../recipes;
in
with pkgs;
stdenv.mkDerivation {
name = "cargo-vendor-deps";
version = "0.0.0";
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out
cp -r ${cargoDeps}/* $out/
cp -r ${cargoDeps}/.cargo $out/
ls -al $out/
'';
#cp -r ${recipes} $out/recipes-${version}
}

View File

@ -4,13 +4,16 @@
kitchenWasm, kitchenWasm,
version, version,
naersk-lib, naersk-lib,
rust-wasm,
}: }:
with pkgs; with pkgs;
(naersk-lib.buildPackage rec { (naersk-lib.buildPackage rec {
pname = "kitchen"; pname = "kitchen";
inherit version; inherit version;
buildInputs = [ rust-wasm ];
# However the crate we are building has it's root in specific crate. # However the crate we are building has it's root in specific crate.
src = root; src = root;
nativeBuildInputs = if stdenv.isDarwin then [ xcbuild ] else [ ];
cargoBuildOptions = opts: opts ++ ["-p" "${pname}" ]; cargoBuildOptions = opts: opts ++ ["-p" "${pname}" ];
postPatch = '' postPatch = ''
mkdir -p web/dist mkdir -p web/dist