diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index 2a0b95ebeb6..5ab24686152 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -18,6 +18,12 @@ with pkgs.lib; description = "NixOS version suffix."; }; + system.nixosRevision = mkOption { + internal = true; + type = types.uniq types.string; + description = "NixOS Git revision hash."; + }; + system.nixosCodeName = mkOption { internal = true; type = types.uniq types.string; @@ -42,6 +48,10 @@ with pkgs.lib; let suffixFile = "${toString pkgs.path}/.version-suffix"; in mkDefault (if pathExists suffixFile then readFile suffixFile else "pre-git"); + system.nixosRevision = + let fn = "${toString pkgs.path}/.git-revision"; in + mkDefault (if pathExists fn then readFile fn else "master"); + # Note: code names must only increase in alphabetical order. system.nixosCodeName = "Aardvark"; diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix index c522868c1d9..a593d05ee62 100644 --- a/nixos/modules/services/misc/nixos-manual.nix +++ b/nixos/modules/services/misc/nixos-manual.nix @@ -11,12 +11,15 @@ let cfg = config.services.nixosManual; + versionModule = + { system.nixosVersionSuffix = config.system.nixosVersionSuffix; + system.nixosRevision = config.system.nixosRevision; + }; + manual = import ../../../doc/manual { inherit pkgs; - revision = - let fn = "${toString pkgs.path}/.git-revision"; - in if pathExists fn then readFile fn else "master"; - options = (fixMergeModules baseModules + revision = config.system.nixosRevision; + options = (fixMergeModules ([ versionModule ] ++ baseModules) (removeAttrs extraArgs ["config" "options"]) // { modules = [ ]; }).options; diff --git a/nixos/release.nix b/nixos/release.nix index 8e87fbf8e5f..07cc20eb1e5 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -16,7 +16,9 @@ let versionModule = - { system.nixosVersionSuffix = versionSuffix; }; + { system.nixosVersionSuffix = versionSuffix; + system.nixosRevision = nixpkgs.rev or nixpkgs.shortRev; + }; makeIso =