build: add git revision to version
This commit is contained in:
parent
73fd022b1e
commit
b720dfa165
4 changed files with 24 additions and 3 deletions
14
default.nix
14
default.nix
|
@ -11,6 +11,16 @@
|
|||
wayland,
|
||||
wayland-protocols,
|
||||
|
||||
gitRev ? (let
|
||||
headExists = builtins.pathExists ./.git/HEAD;
|
||||
headContent = builtins.readFile ./.git/HEAD;
|
||||
in if headExists
|
||||
then (let
|
||||
matches = builtins.match "ref: refs/heads/(.*)\n" headContent;
|
||||
in if matches != null
|
||||
then builtins.readFile ./.git/refs/heads/${builtins.elemAt matches 0}
|
||||
else headContent)
|
||||
else "unknown"),
|
||||
debug ? false,
|
||||
enableWayland ? true,
|
||||
}: stdenv.mkDerivation {
|
||||
|
@ -44,7 +54,9 @@
|
|||
cmakeConfigurePhase
|
||||
'';
|
||||
|
||||
cmakeFlags = lib.optional (!enableWayland) "-DWAYLAND=OFF";
|
||||
cmakeFlags = [
|
||||
"-DGIT_REVISION=${gitRev}"
|
||||
] ++ lib.optional (!enableWayland) "-DWAYLAND=OFF";
|
||||
|
||||
buildPhase = "ninjaBuildPhase";
|
||||
enableParallelBuilding = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue