Skip to content

Commit

Permalink
build: Further simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed Apr 26, 2024
1 parent 91c6a36 commit 9bd3077
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,23 @@
craneLib = crane.lib.${system};

src = craneLib.cleanCargoSource (craneLib.path ./.);
# The following could be done automatically by Crane, but it will look for a
# top-level package name as well (not present in PineAPPL). Thus, doing it
# manually will save a Crane warning.
version =
(builtins.fromTOML (builtins.readFile (src
+ "/Cargo.toml")))
.workspace
.package
.version;
commonArgs = {
inherit src;
inherit src version;
strictDeps = false;
buildInputs = with pkgs; [lhapdf];
nativeBuildInputs = with pkgs; [pkg-config];
doCheck = false;
};

individualCrateArgs =
commonArgs
// {
inherit
((builtins.fromTOML (builtins.readFile (src
+ "/Cargo.toml")))
.workspace
.package)
version
;
doCheck = false;
};

fileSetForCrate = crate:
lib.fileset.toSource {
root = ./.;
Expand All @@ -65,12 +62,17 @@
];
};

cli = craneLib.buildPackage (individualCrateArgs
defaultName = "pineappl";
cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {pname = defaultName;});
cli = craneLib.buildPackage (
commonArgs
// {
pname = "pineappl";
pname = defaultName;
cargoExtraArgs = "-p pineappl_cli";
inherit cargoArtifacts;
src = fileSetForCrate ./pineappl_cli;
});
}
);
# TODO: build with maturin
py = null;
in
Expand Down

0 comments on commit 9bd3077

Please sign in to comment.