Skip to content

Commit

Permalink
fix(nix): separate tee_prover and zksync deps (#3059)
Browse files Browse the repository at this point in the history
## What ❔

While `zksync` deps might not compile with nix, `tee_prover` deps must.

To enable nix incompatible changes in the workspace, separate the build
process completely.

## Why ❔

To enable nix incompatible changes in the workspace, which are unrelated
to `tee_prover`.

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk_supervisor fmt` and `zk_supervisor
lint`.

Signed-off-by: Harald Hoyer <[email protected]>
  • Loading branch information
haraldh authored Oct 11, 2024
1 parent c1ab99d commit 2b94509
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
17 changes: 12 additions & 5 deletions etc/nix/tee_prover.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
{ cargoArtifacts
, craneLib
{ craneLib
, commonArgs
}:
craneLib.buildPackage (commonArgs // {
let
pname = "zksync_tee_prover";
cargoExtraArgs = "--locked -p zksync_tee_prover";
in
craneLib.buildPackage (commonArgs // {
inherit pname;
version = (builtins.fromTOML (builtins.readFile ../../core/bin/zksync_tee_prover/Cargo.toml)).package.version;
cargoExtraArgs = "-p zksync_tee_prover --bin zksync_tee_prover";
inherit cargoArtifacts;
inherit cargoExtraArgs;

cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
inherit pname;
inherit cargoExtraArgs;
});

postInstall = ''
strip $out/bin/zksync_tee_prover
Expand Down
8 changes: 5 additions & 3 deletions etc/nix/zksync.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{ cargoArtifacts
, craneLib
{ craneLib
, commonArgs
}:
craneLib.buildPackage (commonArgs // {
pname = "zksync";
version = (builtins.fromTOML (builtins.readFile ../../core/bin/zksync_tee_prover/Cargo.toml)).package.version;
cargoExtraArgs = "--all";
inherit cargoArtifacts;

cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
pname = "zksync-era-workspace";
});

outputs = [
"out"
Expand Down
9 changes: 2 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
packages = {
# to ease potential cross-compilation, the overlay is used
inherit (appliedOverlay.zksync-era) zksync tee_prover container-tee-prover-azure container-tee-prover-dcap;
default = appliedOverlay.zksync-era.zksync;
default = appliedOverlay.zksync-era.tee_prover;
};

devShells.default = appliedOverlay.zksync-era.devShell;
Expand Down Expand Up @@ -107,10 +107,6 @@
strictDeps = true;
inherit hardeningEnable;
};

cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
pname = "zksync-era-workspace";
});
in
{
zksync-era = rec {
Expand All @@ -120,12 +116,11 @@
};

zksync = pkgs.callPackage ./etc/nix/zksync.nix {
inherit cargoArtifacts;
inherit craneLib;
inherit commonArgs;
};

tee_prover = pkgs.callPackage ./etc/nix/tee_prover.nix {
inherit cargoArtifacts;
inherit craneLib;
inherit commonArgs;
};
Expand Down

0 comments on commit 2b94509

Please sign in to comment.