Manual: Only include the release number (e.g. 16.03)

This prevents gratuitous rebuilds of the manual every time the Git
revision changes.

Should help a bit with #17261.
This commit is contained in:
Eelco Dolstra 2016-07-28 18:27:03 +02:00
parent 2a05368ff3
commit 83eb49220b
2 changed files with 8 additions and 14 deletions

View File

@ -43,34 +43,34 @@ in
nixosVersion = mkOption { nixosVersion = mkOption {
internal = true; internal = true;
type = types.str; type = types.str;
description = "NixOS version."; description = "The full NixOS version (e.g. <literal>16.03.1160.f2d4ee1</literal>).";
}; };
nixosRelease = mkOption { nixosRelease = mkOption {
readOnly = true; readOnly = true;
type = types.str; type = types.str;
default = readFile releaseFile; default = readFile releaseFile;
description = "NixOS release."; description = "The NixOS release (e.g. <literal>16.03</literal>).";
}; };
nixosVersionSuffix = mkOption { nixosVersionSuffix = mkOption {
internal = true; internal = true;
type = types.str; type = types.str;
default = if pathExists suffixFile then readFile suffixFile else "pre-git"; default = if pathExists suffixFile then readFile suffixFile else "pre-git";
description = "NixOS version suffix."; description = "The NixOS version suffix (e.g. <literal>1160.f2d4ee1</literal>).";
}; };
nixosRevision = mkOption { nixosRevision = mkOption {
internal = true; internal = true;
type = types.str; type = types.str;
default = if pathExists revisionFile then readFile revisionFile else "master"; default = if pathExists revisionFile then readFile revisionFile else "master";
description = "NixOS Git revision hash."; description = "The Git revision from which this NixOS configuration was built.";
}; };
nixosCodeName = mkOption { nixosCodeName = mkOption {
readOnly = true; readOnly = true;
type = types.str; type = types.str;
description = "NixOS release code name."; description = "The NixOS release code name (e.g. <literal>Emu</literal>).";
}; };
defaultChannel = mkOption { defaultChannel = mkOption {

View File

@ -11,12 +11,6 @@ let
cfg = config.services.nixosManual; cfg = config.services.nixosManual;
versionModule =
{ system.nixosVersionSuffix = config.system.nixosVersionSuffix;
system.nixosRevision = config.system.nixosRevision;
nixpkgs.system = config.nixpkgs.system;
};
/* For the purpose of generating docs, evaluate options with each derivation /* For the purpose of generating docs, evaluate options with each derivation
in `pkgs` (recursively) replaced by a fake with path "\${pkgs.attribute.path}". in `pkgs` (recursively) replaced by a fake with path "\${pkgs.attribute.path}".
It isn't perfect, but it seems to cover a vast majority of use cases. It isn't perfect, but it seems to cover a vast majority of use cases.
@ -24,12 +18,12 @@ let
the path above will be shown and not e.g. `${config.services.foo.package}`. */ the path above will be shown and not e.g. `${config.services.foo.package}`. */
manual = import ../../../doc/manual { manual = import ../../../doc/manual {
inherit pkgs; inherit pkgs;
version = config.system.nixosVersion; version = config.system.nixosRelease;
revision = config.system.nixosRevision; revision = "release-${config.system.nixosRelease}";
options = options =
let let
scrubbedEval = evalModules { scrubbedEval = evalModules {
modules = [ versionModule ] ++ baseModules; modules = [ { nixpkgs.system = config.nixpkgs.system; } ] ++ baseModules;
args = (config._module.args) // { modules = [ ]; }; args = (config._module.args) // { modules = [ ]; };
specialArgs = { pkgs = scrubDerivations "pkgs" pkgs; }; specialArgs = { pkgs = scrubDerivations "pkgs" pkgs; };
}; };