Skip to content

Commit

Permalink
Revert back to x86_64 to build deterministic zomes
Browse files Browse the repository at this point in the history
  • Loading branch information
guillemcordoba committed May 27, 2024
1 parent 885ce4c commit 5d4a4f8
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 88 deletions.
5 changes: 2 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,12 @@
# system =;
system = holochain.devShells.holonix.system;
pkgs = import inputs.nixpkgs {
localSystem = system;
crossSystem = "x86_64-linux";
system = "x86_64-linux";
overlays = [ (import inputs.rust-overlay) ];
};

rustToolchain =
pkgs.pkgsBuildHost.rust-bin.stable."1.77.2".minimal.override {
pkgs.rust-bin.stable."1.77.2".minimal.override {
# Set the build targets supported by the toolchain,
# wasm32-unknown-unknown is required for trunk.
targets = [ "wasm32-unknown-unknown" ];
Expand Down
102 changes: 51 additions & 51 deletions nix/fixtures/module-repo/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 12 additions & 34 deletions nix/zome.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,45 +36,23 @@ let
});
debug = runCommandLocal "${crate}-debug" {
meta = { holochainPackageType = "zome"; };
} " cp ${wasm}/lib/${crate}.wasm $out \n";
} "cp ${wasm}/lib/${crate}.wasm $out \n";

deterministicWasm = let
deterministicCommonArgs = (commonArgs // {
cargoToml = crateCargoToml;
cargoLock = workspacePath + /Cargo.lock;
cargoExtraArgs = "-p ${crate} --locked";
pname = crate;
version = cargoToml.package.version;
});

wasm = if system == "x86_64-linuix" then
(deterministicCraneLib.buildPackage (deterministicCommonArgs // {
cargoArtifacts = deterministicCraneLib.buildDepsOnly
(deterministicCommonArgs // {
wasmDeps = deterministicCraneLib.buildDepsOnly (commonArgs // {
inherit cargoExtraArgs;
pname = "happ-workspace";
version = "workspace";
});
}))
else
let
crossDeterministicCommonArgs = (deterministicCommonArgs // {
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER = "qemu-x86_64";
depsBuildBuild = [ pkgs.qemu ];
nativeBuildInputs = [ pkgs.pkg-config ]
++ lib.optionals pkgs.stdenv.buildPlatform.isDarwin [
pkgs.libiconv
pkgs.darwin.apple_sdk_11_0.frameworks.CoreFoundation
];
});
cargoArtifacts = deterministicCraneLib.buildDepsOnly
(crossDeterministicCommonArgs // {
inherit cargoExtraArgs;
pname = "happ-workspace";
version = "workspace";
});
in (deterministicCraneLib.buildPackage
(deterministicCommonArgs // { inherit cargoArtifacts; }));

wasm = deterministicCraneLib.buildPackage (commonArgs // {
cargoArtifacts = wasmDeps;
cargoToml = crateCargoToml;
cargoLock = workspacePath + /Cargo.lock;
cargoExtraArgs = "-p ${crate} --locked";
pname = crate;
version = cargoToml.package.version;
});
in runCommandLocal "${crate}-deterministic" {
meta = { holochainPackageType = "zome"; };
} " cp ${wasm}/lib/${crate}.wasm $out \n";
Expand All @@ -84,4 +62,4 @@ in runCommandNoCC crate {
holochainPackageType = "zome";
};
buildInputs = [ binaryen ];
} " wasm-opt --strip-debug -Oz -o $out ${deterministicWasm}\n"
} "wasm-opt --strip-debug -Oz -o $out ${deterministicWasm}\n"

0 comments on commit 5d4a4f8

Please sign in to comment.