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.
This commit is contained in:
Eelco Dolstra 2020-02-10 15:25:44 +01:00
parent b98ea45608
commit c05cc615f2
2 changed files with 6 additions and 2 deletions

View File

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

View File

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