Skip to content

Commit d9ec124

Browse files
committed
build: Further simplifications
1 parent a4af5ec commit d9ec124

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

flake.nix

+19-17
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,23 @@
2626
craneLib = crane.lib.${system};
2727

2828
src = craneLib.cleanCargoSource (craneLib.path ./.);
29+
# The following could be done automatically by Crane, but it will look for a
30+
# top-level package name as well (not present in PineAPPL). Thus, doing it
31+
# manually will save a Crane warning.
32+
version =
33+
(builtins.fromTOML (builtins.readFile (src
34+
+ "/Cargo.toml")))
35+
.workspace
36+
.package
37+
.version;
2938
commonArgs = {
30-
inherit src;
39+
inherit src version;
3140
strictDeps = false;
3241
buildInputs = with pkgs; [lhapdf];
3342
nativeBuildInputs = with pkgs; [pkg-config];
43+
doCheck = false;
3444
};
3545

36-
individualCrateArgs =
37-
commonArgs
38-
// {
39-
inherit
40-
((builtins.fromTOML (builtins.readFile (src
41-
+ "/Cargo.toml")))
42-
.workspace
43-
.package)
44-
version
45-
;
46-
doCheck = false;
47-
};
48-
4946
fileSetForCrate = crate:
5047
lib.fileset.toSource {
5148
root = ./.;
@@ -65,12 +62,17 @@
6562
];
6663
};
6764

68-
cli = craneLib.buildPackage (individualCrateArgs
65+
defaultName = "pineappl";
66+
cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {pname = defaultName;});
67+
cli = craneLib.buildPackage (
68+
commonArgs
6969
// {
70-
pname = "pineappl";
70+
pname = defaultName;
7171
cargoExtraArgs = "-p pineappl_cli";
72+
inherit cargoArtifacts;
7273
src = fileSetForCrate ./pineappl_cli;
73-
});
74+
}
75+
);
7476
# TODO: build with maturin
7577
py = null;
7678
in

0 commit comments

Comments
 (0)