diff options
author | aszlig <aszlig@nix.build> | 2018-09-25 23:31:43 +0200 |
---|---|---|
committer | aszlig <aszlig@nix.build> | 2018-09-25 23:39:44 +0200 |
commit | c5bb43188d66c579e337e107f04b7c6e7d57dc41 (patch) | |
tree | 54e4985f642b390796582c54c4d55960d366b455 /nixos/modules/services | |
parent | 6cd90cb0e18943242a663562941ac6c37ae8e957 (diff) | |
download | nixlib-c5bb43188d66c579e337e107f04b7c6e7d57dc41.tar nixlib-c5bb43188d66c579e337e107f04b7c6e7d57dc41.tar.gz nixlib-c5bb43188d66c579e337e107f04b7c6e7d57dc41.tar.bz2 nixlib-c5bb43188d66c579e337e107f04b7c6e7d57dc41.tar.lz nixlib-c5bb43188d66c579e337e107f04b7c6e7d57dc41.tar.xz nixlib-c5bb43188d66c579e337e107f04b7c6e7d57dc41.tar.zst nixlib-c5bb43188d66c579e337e107f04b7c6e7d57dc41.zip |
nixos: Fix eval error for documentation.nixos
Introduced by 0f3b89bbedc1a33cc1fc3c142e235da2c64614c3. If services.nixosManual.showManual is enabled and documentation.nixos.enable is not, there is no config.system.build.manual available, so evaluation fails. For example this is the case for the installer tests. There is however an assertion which should catch exactly this, but it isn't thrown because the usage of config.system.build.manual is evaluated earlier than the assertions. So I split the assertion off into a separate mkIf to make sure it is shown appropriately and also fixed the installation-device profile to enable documentation.nixos. Signed-off-by: aszlig <aszlig@nix.build> Cc: @oxij
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/misc/nixos-manual.nix | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix index 7202269d3421..df3e71c80dea 100644 --- a/nixos/modules/services/misc/nixos-manual.nix +++ b/nixos/modules/services/misc/nixos-manual.nix @@ -44,29 +44,30 @@ in }; - config = mkIf cfg.showManual { - - assertions = [{ - assertion = cfgd.enable && cfgd.nixos.enable; - message = "Can't enable `service.nixosManual.showManual` without `documentation.nixos.enable`"; - }]; - - boot.extraTTYs = [ "tty${toString cfg.ttyNumber}" ]; - - systemd.services."nixos-manual" = { - description = "NixOS Manual"; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - ExecStart = "${cfg.browser} ${config.system.build.manual.manualHTMLIndex}"; - StandardInput = "tty"; - StandardOutput = "tty"; - TTYPath = "/dev/tty${toString cfg.ttyNumber}"; - TTYReset = true; - TTYVTDisallocate = true; - Restart = "always"; + config = mkMerge [ + (mkIf cfg.showManual { + assertions = singleton { + assertion = cfgd.enable && cfgd.nixos.enable; + message = "Can't enable `services.nixosManual.showManual` without `documentation.nixos.enable`"; }; - }; - - }; + }) + (mkIf (cfg.showManual && cfgd.enable && cfgd.nixos.enable) { + boot.extraTTYs = [ "tty${toString cfg.ttyNumber}" ]; + + systemd.services."nixos-manual" = { + description = "NixOS Manual"; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + ExecStart = "${cfg.browser} ${config.system.build.manual.manualHTMLIndex}"; + StandardInput = "tty"; + StandardOutput = "tty"; + TTYPath = "/dev/tty${toString cfg.ttyNumber}"; + TTYReset = true; + TTYVTDisallocate = true; + Restart = "always"; + }; + }; + }) + ]; } |