mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +03:00
build(nix): make package version more accurate
Would still be better to have commit rev included if applicable/available but still better than before. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
This commit is contained in:
parent
96a346254d
commit
8cd17b40df
16
flake.nix
16
flake.nix
@ -57,21 +57,29 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
inherit (builtins) readFile split;
|
||||||
|
inherit (lib.lists) findFirst;
|
||||||
|
inherit (lib.strings) hasPrefix removePrefix substring;
|
||||||
|
|
||||||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||||
rustfmtToml = builtins.fromTOML (builtins.readFile ./rustfmt.toml);
|
rustfmtToml = builtins.fromTOML (builtins.readFile ./rustfmt.toml);
|
||||||
|
|
||||||
craneLib = crane.mkLib pkgs;
|
craneLib = crane.mkLib pkgs;
|
||||||
|
|
||||||
commit = lib.strings.substring 0 7 (builtins.readFile ./.bcachefs_revision);
|
libbcachefsCommit = substring 0 7 (builtins.readFile ./.bcachefs_revision);
|
||||||
|
makefileVersion = removePrefix "VERSION=" (
|
||||||
|
findFirst (line: hasPrefix "VERSION=" line) "VERSION=0.0.0" (split "\n" (readFile ./Makefile))
|
||||||
|
);
|
||||||
|
version = "${makefileVersion}+git-${libbcachefsCommit}";
|
||||||
|
|
||||||
commonArgs = {
|
commonArgs = {
|
||||||
version = "git-${commit}";
|
inherit version;
|
||||||
src = self;
|
src = self;
|
||||||
|
|
||||||
makeFlags = [
|
makeFlags = [
|
||||||
"DESTDIR=${placeholder "out"}"
|
"DESTDIR=${placeholder "out"}"
|
||||||
"PREFIX="
|
"PREFIX="
|
||||||
"VERSION=${commit}"
|
"VERSION=${version}"
|
||||||
];
|
];
|
||||||
|
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
@ -116,7 +124,7 @@
|
|||||||
installCheckPhase = ''
|
installCheckPhase = ''
|
||||||
runHook preInstallCheck
|
runHook preInstallCheck
|
||||||
|
|
||||||
test "$($out/bin/bcachefs version)" = "${commit}"
|
test "$($out/bin/bcachefs version)" = "${version}"
|
||||||
|
|
||||||
runHook postInstallCheck
|
runHook postInstallCheck
|
||||||
'';
|
'';
|
||||||
|
Loading…
Reference in New Issue
Block a user