Merge pull request #17218 from bennofs/fix-nixos-version
fix nixos-version --hash when building from git
This commit is contained in:
commit
3f3d18c017
|
@ -17,6 +17,6 @@ getVersion() {
|
||||||
if nixpkgs=$(nix-instantiate --find-file nixpkgs "$@"); then
|
if nixpkgs=$(nix-instantiate --find-file nixpkgs "$@"); then
|
||||||
getVersion $nixpkgs
|
getVersion $nixpkgs
|
||||||
if [ -n "$rev" ]; then
|
if [ -n "$rev" ]; then
|
||||||
echo ".git.$rev"
|
echo "$rev"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
|
@ -311,9 +311,10 @@ fi
|
||||||
# nixos-version shows something useful).
|
# nixos-version shows something useful).
|
||||||
if [ -n "$canRun" ]; then
|
if [ -n "$canRun" ]; then
|
||||||
if nixpkgs=$(nix-instantiate --find-file nixpkgs "${extraBuildFlags[@]}"); then
|
if nixpkgs=$(nix-instantiate --find-file nixpkgs "${extraBuildFlags[@]}"); then
|
||||||
suffix=$($SHELL $nixpkgs/nixos/modules/installer/tools/get-version-suffix "${extraBuildFlags[@]}" || true)
|
revision=$($SHELL $nixpkgs/nixos/modules/installer/tools/get-git-revision "${extraBuildFlags[@]}" || true)
|
||||||
if [ -n "$suffix" ]; then
|
if [ -n "$revision" ]; then
|
||||||
echo -n "$suffix" > "$nixpkgs/.version-suffix" || true
|
echo -n ".git.$revision" > "$nixpkgs/.version-suffix" || true
|
||||||
|
echo -n "$revision" > "$nixpkgs/.git-revision" || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue