fix(flake): switch overlay to callPackage
All checks were successful
/ build (push) Successful in 1s
/ check (push) Successful in 7s
/ report-size (push) Successful in 1s

This ensures it can be built for any architecture (supported by Rust).
This commit is contained in:
Jalil David Salamé Messina 2025-01-10 23:39:46 +01:00
parent 883f6e6ae7
commit 8bf62f3ce2
Signed by: jalil
GPG key ID: F016B9E770737A0B
2 changed files with 55 additions and 37 deletions

37
default.nix Normal file
View file

@ -0,0 +1,37 @@
{
pkgs ?
(builtins.getFlake (builtins.toString ./.)).inputs.nixpkgs.legacyPackages.${builtins.currentSystem},
lib ? pkgs.lib,
crane ? (builtins.getFlake (builtins.toString ./.)).inputs.crane,
pkgSrc ? ./.,
mold ? pkgs.mold,
}:
let
craneLib = crane.mkLib pkgs;
src = craneLib.cleanCargoSource pkgSrc;
commonArgs = {
inherit src;
strictDeps = true;
doCheck = false; # tests will be run in the `checks` derivation
NEXTEST_HIDE_PROGRESS_BAR = 1;
NEXTEST_FAILURE_OUTPUT = "immediate-final";
nativeBuildInputs = [ mold ];
meta = {
license = lib.licenses.mit;
homepage = "https://github.com/jalil-salame/webnsupdate";
mainProgram = "webnsupdate";
};
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
in
craneLib.buildPackage (
lib.mergeAttrsList [
commonArgs
{ inherit cargoArtifacts; }
]
)

View file

@ -1,13 +1,11 @@
{ withSystem, inputs, ... }: { inputs, ... }:
{ {
flake.overlays.default = flake.overlays.default = final: prev: {
final: prev: webnsupdate = prev.callPackage ../default.nix {
withSystem prev.stdenv.hostPlatform.system ( inherit (inputs) crane;
{ self', ... }: pkgSrc = inputs.self;
{ };
inherit (self'.packages) webnsupdate; };
}
);
perSystem = perSystem =
{ pkgs, lib, ... }: { pkgs, lib, ... }:
@ -33,29 +31,22 @@
}; };
cargoArtifacts = craneLib.buildDepsOnly commonArgs; cargoArtifacts = craneLib.buildDepsOnly commonArgs;
webnsupdate = craneLib.buildPackage ( withArtifacts = lib.mergeAttrsList [
lib.mergeAttrsList [ commonArgs
commonArgs { inherit cargoArtifacts; }
{ inherit cargoArtifacts; } ];
] webnsupdate = pkgs.callPackage ../default.nix {
); inherit (inputs) crane;
pkgSrc = inputs.self;
};
in in
{ {
checks = { checks = {
nextest = craneLib.cargoNextest withArtifacts;
clippy = craneLib.cargoClippy ( clippy = craneLib.cargoClippy (
lib.mergeAttrsList [ lib.mergeAttrsList [
commonArgs withArtifacts
{ { cargoClippyExtraArgs = "--all-targets -- --deny warnings"; }
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
}
]
);
nextest = craneLib.cargoNextest (
lib.mergeAttrsList [
commonArgs
{ inherit cargoArtifacts; }
] ]
); );
}; };
@ -64,16 +55,6 @@
inherit webnsupdate; inherit webnsupdate;
inherit (pkgs) git-cliff; inherit (pkgs) git-cliff;
default = webnsupdate; default = webnsupdate;
cargo-update = pkgs.writeShellApplication {
name = "cargo-update-lockfile";
runtimeInputs = with pkgs; [
cargo
gnused
];
text = ''
CARGO_TERM_COLOR=never cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
'';
};
}; };
}; };
} }