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 ?
|
||||
(builtins.getFlake (builtins.toString ./.)).inputs.nixpkgs.legacyPackages.${builtins.currentSystem},
|
||||
pkgs ? inputs.nixpkgs.legacyPackages.${builtins.currentSystem},
|
||||
lib ? pkgs.lib,
|
||||
crane ? (builtins.getFlake (builtins.toString ./.)).inputs.crane,
|
||||
pkgSrc ? ./.,
|
||||
crane ? inputs.crane,
|
||||
craneLib ? crane.mkLib pkgs,
|
||||
cargoArtifacts ? null,
|
||||
src ? craneLib.cleanCargoSource ./.,
|
||||
mold ? pkgs.mold,
|
||||
}:
|
||||
let
|
||||
craneLib = crane.mkLib pkgs;
|
||||
src = craneLib.cleanCargoSource pkgSrc;
|
||||
|
||||
commonArgs = {
|
||||
inherit src;
|
||||
strictDeps = true;
|
||||
|
@ -26,12 +27,13 @@ let
|
|||
mainProgram = "webnsupdate";
|
||||
};
|
||||
};
|
||||
|
||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||
in
|
||||
craneLib.buildPackage (
|
||||
lib.mergeAttrsList [
|
||||
commonArgs
|
||||
{ inherit cargoArtifacts; }
|
||||
{
|
||||
cargoArtifacts =
|
||||
if cargoArtifacts == nul then craneLib.buildDepsOnly commonArgs else cargoArtifacts;
|
||||
}
|
||||
]
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue