Skip to content

Commit

Permalink
cargoExtraArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
guillemcordoba committed Feb 22, 2024
1 parent 79ccd07 commit 2a3cd89
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
11 changes: 1 addition & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,25 @@
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
# flake-utils.follows = "flake-utils";
};
};
};

outputs = inputs @ { ... }:
{
lib = {
rustZome = { src, crate, holochain }:
rustZome = { src, crate, holochain, cargoExtraArgs ? null }:
let
# system = builtins.trace holochain holochain.system;
system = holochain.devShells.holonix.system;
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ (import inputs.rust-overlay) ];
};

# # inherit (pkgs) lib;
rustToolchain = pkgs.rust-bin.stable."1.75.0".minimal.override {
# Set the build targets supported by the toolchain,
# wasm32-unknown-unknown is required for trunk.
targets = [ "wasm32-unknown-unknown" ];
# extensions = [
# "rust-src"
# "rust-analyzer"
# "clippy"
# "rustfmt"
# ];
};
craneLib = inputs.crane.lib.${system}.overrideToolchain rustToolchain;

Expand Down
14 changes: 11 additions & 3 deletions nix/zome.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@
stdenv,
binaryen,
craneLib,
src
src,
cargoExtraArgs ? null
}:

let
wasmDeps = craneLib.buildDepsOnly {
inherit src cargoExtraArgs;
CARGO_BUILD_TARGET = "wasm32-unknown-unknown";
CARGO_PROFILE = "release";
doCheck = false;
};
wasm = craneLib.buildPackage {
inherit src;
cargoExtraArgs = "-p ${crate}";
inherit src cargoExtraArgs;
CARGO_BUILD_TARGET = "wasm32-unknown-unknown";
CARGO_PROFILE = "release";
cargoArtifacts = wasmDeps;
pname = crate;
doCheck = false;
};
Expand Down

0 comments on commit 2a3cd89

Please sign in to comment.