nixos.revision: Use null instead of "master"

"master" is not a valid SHA-1 commit hash, and it's not even
necessarily the branch used. 'nixos-version --revision' now returns an
error if the commit hash is not known.
wip/yesman
Eelco Dolstra 4 years ago
parent b98ea45608
commit c05cc615f2
  1. 4
      nixos/modules/installer/tools/nixos-version.sh
  2. 4
      nixos/modules/misc/version.nix

@ -6,6 +6,10 @@ case "$1" in
exit 1
;;
--hash|--revision)
if ! [[ @revision@ =~ /[0-9a-f]+/ ]]; then
echo "$0: Nixpkgs commit hash is unknown"
exit 1
fi
echo "@revision@"
;;
--json)

@ -42,8 +42,8 @@ in
nixos.revision = mkOption {
internal = true;
type = types.str;
default = trivial.revisionWithDefault "master";
type = types.nullOr types.str;
default = trivial.revisionWithDefault null;
description = "The Git revision from which this NixOS configuration was built.";
};

Loading…
Cancel
Save