summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2019-02-23 11:35:52 +0100
committerGitHub <noreply@github.com>2019-02-23 11:35:52 +0100
commitc48c4c701a74235df69d489d5e45801779f01cd5 (patch)
treea96c39062d66b21475b020118c4f0a26a43951a9 /modules/system
parent1a3a9d91b461f7e8bda13d0e50ead976cc8a0d1a (diff)
parent349a4837cf721484868723406c3ddd015835a4a6 (diff)
Merge pull request #121 from thefloweringash/channel-version-info
system-version: get version information from channels
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/version.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/system/version.nix b/modules/system/version.nix
index 5dda0db..edaf19b 100644
--- a/modules/system/version.nix
+++ b/modules/system/version.nix
@@ -12,6 +12,14 @@ let
releaseFile = "${toString pkgs.path}/.version";
revisionFile = "${toString pkgs.path}/.git-revision";
suffixFile = "${toString pkgs.path}/.version-suffix";
+
+ revision = if builtins.pathExists gitRepo then gitCommitId
+ else if builtins.pathExists revisionFile then fileContents revisionFile
+ else null;
+
+ versionSuffix = if builtins.pathExists gitRepo then ".git." + gitCommitId
+ else if builtins.pathExists suffixFile then fileContents suffixFile
+ else null;
in
{
@@ -71,8 +79,8 @@ in
# These defaults are set here rather than up there so that
# changing them would not rebuild the manual
system.nixpkgsVersion = mkDefault (cfg.nixpkgsRelease + cfg.nixpkgsVersionSuffix);
- system.nixpkgsRevision = mkIf (builtins.pathExists gitRepo) (mkDefault gitCommitId);
- system.nixpkgsVersionSuffix = mkIf (builtins.pathExists gitRepo) (mkDefault (".git." + gitCommitId));
+ system.nixpkgsRevision = mkIf (revision != null) (mkDefault revision);
+ system.nixpkgsVersionSuffix = mkIf (versionSuffix != null) (mkDefault versionSuffix);
assertions = [ { assertion = cfg.stateVersion <= defaultStateVersion; message = "system.stateVersion = ${toString cfg.stateVersion}; is not a valid value"; } ];