feat: switch to crane
Should provide better caching of the intermediate build artifacts.
This commit is contained in:
parent
8dd8b9e3aa
commit
d44d2aa1a7
5 changed files with 83 additions and 64 deletions
43
default.nix
43
default.nix
|
@ -1,43 +0,0 @@
|
|||
{ lib, rustPlatform }:
|
||||
let
|
||||
readToml = path: builtins.fromTOML (builtins.readFile path);
|
||||
cargoToml = readToml ./Cargo.toml;
|
||||
pname = cargoToml.package.name;
|
||||
inherit (cargoToml.package) version description;
|
||||
src = lib.cleanSourceWith {
|
||||
src = ./.;
|
||||
name = "${pname}-source";
|
||||
# Adapted from <https://github.com/ipetkov/crane/blob/master/lib/filterCargoSources.nix>
|
||||
# no need to pull in crane for just this
|
||||
filter =
|
||||
orig_path: type:
|
||||
let
|
||||
path = toString orig_path;
|
||||
base = baseNameOf path;
|
||||
matchesSuffix = lib.any (suffix: lib.hasSuffix suffix base) [
|
||||
# Rust sources
|
||||
".rs"
|
||||
# TOML files are often used to configure cargo based tools (e.g. .cargo/config.toml)
|
||||
".toml"
|
||||
# Snapshot tests
|
||||
".snap"
|
||||
];
|
||||
isCargoLock = base == "Cargo.lock";
|
||||
in
|
||||
type == "directory" || matchesSuffix || isCargoLock;
|
||||
};
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
inherit pname version src;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
useNextest = true;
|
||||
NEXTEST_HIDE_PROGRESS_BAR = 1;
|
||||
NEXTEST_FAILURE_OUTPUT = "immediate-final";
|
||||
|
||||
meta = {
|
||||
inherit description;
|
||||
license = lib.licenses.mit;
|
||||
homepage = "https://github.com/jalil-salame/webnsupdate";
|
||||
mainProgram = "webnsupdate";
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue