diff options
author | Graham Christensen <graham@grahamc.com> | 2018-10-05 10:48:42 -0400 |
---|---|---|
committer | Graham Christensen <graham@grahamc.com> | 2018-10-05 11:06:28 -0400 |
commit | 4312cfdbda1855088905a3d9959a4fac362fd051 (patch) | |
tree | fa5fcd7c6d2c18d583057b9ccf0f6f964565af2d /nixos | |
parent | 730dac1d7bccd4f4d540c780fc94133807757493 (diff) |
version.nix: extract revision-fetching function
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/misc/version.nix | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index c593adcdae6e..6d78b7c593f8 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -5,7 +5,6 @@ with lib; let cfg = config.system.nixos; - revisionFile = "${toString pkgs.path}/.git-revision"; gitRepo = "${toString pkgs.path}/.git"; gitCommitId = lib.substring 0 7 (commitIdFromGitRepo gitRepo); in @@ -37,9 +36,7 @@ in nixos.revision = mkOption { internal = true; type = types.str; - default = if pathIsDirectory gitRepo then commitIdFromGitRepo gitRepo - else if pathExists revisionFile then fileContents revisionFile - else "master"; + default = lib.trivial.revisionWithDefault "master"; description = "The Git revision from which this NixOS configuration was built."; }; |