refactor(package): share more stuff
This should hopefully speed up the nix evals
This commit is contained in:
parent
391ec67c08
commit
5cef18f07e
2 changed files with 13 additions and 12 deletions
22
default.nix
22
default.nix
|
@ -1,15 +1,16 @@
|
||||||
|
let
|
||||||
|
inherit (builtins.getFlake (builtins.toString ./.)) inputs;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
pkgs ?
|
pkgs ? inputs.nixpkgs.legacyPackages.${builtins.currentSystem},
|
||||||
(builtins.getFlake (builtins.toString ./.)).inputs.nixpkgs.legacyPackages.${builtins.currentSystem},
|
|
||||||
lib ? pkgs.lib,
|
lib ? pkgs.lib,
|
||||||
crane ? (builtins.getFlake (builtins.toString ./.)).inputs.crane,
|
crane ? inputs.crane,
|
||||||
pkgSrc ? ./.,
|
craneLib ? crane.mkLib pkgs,
|
||||||
|
cargoArtifacts ? null,
|
||||||
|
src ? craneLib.cleanCargoSource ./.,
|
||||||
mold ? pkgs.mold,
|
mold ? pkgs.mold,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
craneLib = crane.mkLib pkgs;
|
|
||||||
src = craneLib.cleanCargoSource pkgSrc;
|
|
||||||
|
|
||||||
commonArgs = {
|
commonArgs = {
|
||||||
inherit src;
|
inherit src;
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
|
@ -26,12 +27,13 @@ let
|
||||||
mainProgram = "webnsupdate";
|
mainProgram = "webnsupdate";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
|
||||||
in
|
in
|
||||||
craneLib.buildPackage (
|
craneLib.buildPackage (
|
||||||
lib.mergeAttrsList [
|
lib.mergeAttrsList [
|
||||||
commonArgs
|
commonArgs
|
||||||
{ inherit cargoArtifacts; }
|
{
|
||||||
|
cargoArtifacts =
|
||||||
|
if cargoArtifacts == nul then craneLib.buildDepsOnly commonArgs else cargoArtifacts;
|
||||||
|
}
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
|
@ -44,8 +44,7 @@ in
|
||||||
{ inherit cargoArtifacts; }
|
{ inherit cargoArtifacts; }
|
||||||
];
|
];
|
||||||
webnsupdate = pkgs.callPackage ../default.nix {
|
webnsupdate = pkgs.callPackage ../default.nix {
|
||||||
inherit crane;
|
inherit craneLib cargoArtifacts src;
|
||||||
pkgSrc = src;
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue