From 09b8ed042af131ee48df9d9c348f342bb2601565 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 5 Oct 2018 10:48:42 -0400 Subject: version.nix: extract revision-fetching function (cherry picked from commit 4312cfdbda1855088905a3d9959a4fac362fd051) --- nixos/modules/misc/version.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'nixos') diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index 2901dac442f37..0bb8880471873 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."; }; -- cgit 1.4.1