diff --git a/nix/deterministic-zome.nix b/nix/deterministic-zome.nix new file mode 100644 index 0000000..7821953 --- /dev/null +++ b/nix/deterministic-zome.nix @@ -0,0 +1,55 @@ +{ + runCommandNoCC, + dockerTools, + docker, + workspacePath, + dbus, + crateCargoToml, + buildEnv, + git, + systemd, + meta +}: + +let + nixFromDockerHub = dockerTools.pullImage { + imageName = "nixpkgs/nix-flakes"; + imageDigest = "sha256:ae2d8172d75347b040b29b726faf680f35c9beffe3f90d6a93b74fa3d5227774"; + sha256 = "mQYzwbTpkslXAOAq4LX05kNcoPqVHfhzM8yZ9bQ7VgA="; + finalImageTag = "nixos-23.11"; + finalImageName = "nix"; + }; + image = dockerTools.buildImage { + name = "build-deterministic-zome"; + tag = "latest"; + fromImage = nixFromDockerHub; + + copyToRoot = buildEnv { + name = "cargo-workspace"; + pathsToLink = [ workspacePath "/bin" ]; + paths = [ workspacePath git ]; + }; + + # runAsRoot = '' + # #!/bin/bash + # echo ${workspacePath} + # mkdir -p /build/source + # cp -R ${workspacePath}/* /build/source + # cd /build/source + # git init . + # git add . + # ls -la + # nix --help + # nix build .#my_zome.meta.debug + + # ''; + config.Cmd = [ "/bin/nix --help"]; + }; +in + runCommandNoCC "container" { + buildInputs = [dbus]; + } '' + ${systemd}/bin/systemctl --user start docker + ${docker}/bin/docker load --input ${image} + ${docker}/bin/docker run -t -i build-deterministic-zome + '' diff --git a/nix/fixture/flake.lock b/nix/fixture/flake.lock index 9e14cd5..c5f4bec 100644 --- a/nix/fixture/flake.lock +++ b/nix/fixture/flake.lock @@ -717,7 +717,7 @@ }, "locked": { "lastModified": 0, - "narHash": "sha256-So8YfNKEwenZ2ARqTbDo9i6KuInBMZ1cef8cZU/vcyg=", + "narHash": "sha256-BW2CkwgB4tSFlNxbWG0mTjVKkmm3xWHozohgyA+/Nz8=", "path": "../..", "type": "path" }, @@ -1063,11 +1063,11 @@ ] }, "locked": { - "lastModified": 1709731345, - "narHash": "sha256-YNMiQJRbnBdTQ/Q26M5zp+j2DGtpmaI/VWPVJxc4G7k=", + "lastModified": 1709810020, + "narHash": "sha256-fSi18Ew1FxI6pnLW7njvJUe7eb6AYhv/2I4CXO4dJ5c=", "owner": "holochain", "repo": "holochain", - "rev": "3c3d2d73819e97cb9f5487d853f75a9954850f1e", + "rev": "8f7e419a7ef487a4167f1009a59497eecc6142f3", "type": "github" }, "original": { @@ -1079,16 +1079,16 @@ "holochain_8": { "flake": false, "locked": { - "lastModified": 1709081329, - "narHash": "sha256-QP7WKySgEFbgNaSc7BNBBOWCVKuycXSp4HAfD4GTug8=", + "lastModified": 1709687030, + "narHash": "sha256-aaixbhm+R0urE900zRpIhHWQUOtQCP2gAAxz+jcx80s=", "owner": "holochain", "repo": "holochain", - "rev": "547c63a442e61be805887b644c78cf6f970d631b", + "rev": "cb671524080332983281baa2db7c1851344e79d2", "type": "github" }, "original": { "owner": "holochain", - "ref": "holochain-0.3.0-beta-dev.38", + "ref": "holochain-0.3.0-beta-dev.39", "repo": "holochain", "type": "github" } @@ -1487,11 +1487,11 @@ }, "nixpkgs_9": { "locked": { - "lastModified": 1709479366, - "narHash": "sha256-n6F0n8UV6lnTZbYPl1A9q1BS0p4hduAv1mGAP17CVd0=", + "lastModified": 1709703039, + "narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b8697e57f10292a6165a20f03d2f42920dfaf973", + "rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d", "type": "github" }, "original": { @@ -1798,11 +1798,11 @@ ] }, "locked": { - "lastModified": 1709691047, - "narHash": "sha256-2Vwx1FLufoMEcOS8KAwP8H83IP3Hw6ZPrIDHkSXrFCY=", + "lastModified": 1709777204, + "narHash": "sha256-ORUtu+GmrQwNc51mCIjxa/8DdOS901npphBL7k5aXX0=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "d55139f3061cdf2c8f5f7bc8d49e884826e6a4ea", + "rev": "7fdb7a7a846dc1f407cd6b24af04a0b8d018c3de", "type": "github" }, "original": { @@ -2077,11 +2077,11 @@ }, "locked": { "dir": "versions/weekly", - "lastModified": 1709731345, - "narHash": "sha256-YNMiQJRbnBdTQ/Q26M5zp+j2DGtpmaI/VWPVJxc4G7k=", + "lastModified": 1709810020, + "narHash": "sha256-fSi18Ew1FxI6pnLW7njvJUe7eb6AYhv/2I4CXO4dJ5c=", "owner": "holochain", "repo": "holochain", - "rev": "3c3d2d73819e97cb9f5487d853f75a9954850f1e", + "rev": "8f7e419a7ef487a4167f1009a59497eecc6142f3", "type": "github" }, "original": { diff --git a/nix/zome.nix b/nix/zome.nix index 20d1a12..1ecfdf7 100644 --- a/nix/zome.nix +++ b/nix/zome.nix @@ -50,5 +50,5 @@ in holochainPackageType = "zome"; }; } '' - ${binaryen}/bin/wasm-opt --strip-debug -Oz -o $out ${debug} + cp ${debug} $out ''