Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the nix flake #136

Merged
merged 4 commits into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 25 additions & 17 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@
};
hax.url = "github:hacspec/hax";
};
outputs =
inputs:
inputs.flake-utils.lib.eachDefaultSystem (
system:
let
hax = inputs.hax.packages.${system}.default;
pkgs = import inputs.nixpkgs { inherit system; };
craneLib = inputs.crane.mkLib pkgs;
src = ./.;
cargoArtifacts = craneLib.buildDepsOnly { inherit src; };
bertie = craneLib.buildPackage {
outputs = inputs: inputs.flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import inputs.nixpkgs { inherit system; };
# Make an overrideable package.
bertie = { python3, craneLib, hax, runCommand, cargoLock }:
let
src = runCommand "bertie-src" { } ''
cp -r ${./.} $out
chmod u+w $out
rm -f $out/Cargo.lock
cp ${cargoLock} $out/Cargo.lock
'';
cargoArtifacts = craneLib.buildDepsOnly { inherit src; };
in
craneLib.buildPackage {
inherit src cargoArtifacts;
buildInputs = [
hax
pkgs.python3
python3
];
buildPhase = ''
python hax-driver.py extract-fstar
Expand All @@ -31,9 +35,13 @@
installPhase = "cp -r . $out";
doCheck = false;
};
in
{
packages.default = bertie;
}
);
hax = inputs.hax.packages.${system}.default;
craneLib = inputs.crane.mkLib pkgs;
in
{
# Takes the lockfile as input.
packages.default = cargoLock: pkgs.callPackage bertie { inherit hax craneLib cargoLock; };
devShells.default = craneLib.devShell { };
}
);
}
Loading