git.iko.soy/typeable/nixpkgs
on master help sign in
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

commitc5bb43188d66c579e337e107f04b7c6e7d57dc41 authoraszlig <aszlig@nix.build> dateTue 25 Sep 2018, 23:31 (8 years ago) parent6cd90cb
2 files changed+25−23
nixos/modules/profiles/installation-device.nix+1 nixos/modules/services/misc/nixos-manual.nix+24−23
nixos/modules/profiles/installation-device.nix+1
@@ -25,6 +25,7 @@ with lib;
2525 documentation.enable = mkForce true;
2626
2727 # Show the manual.
28+ documentation.nixos.enable = mkForce true;
2829 services.nixosManual.showManual = true;
2930
3031 # Let the user play Rogue on TTY 8 during the installation.
nixos/modules/services/misc/nixos-manual.nix+24−23
@@ -44,29 +44,30 @@ in
4444 };
4545
4646
47− config = mkIf cfg.showManual {
48−
49− assertions = [{
50− assertion = cfgd.enable && cfgd.nixos.enable;
51− message = "Can't enable `service.nixosManual.showManual` without `documentation.nixos.enable`";
52− }];
53−
54− boot.extraTTYs = [ "tty${toString cfg.ttyNumber}" ];
55−
56− systemd.services."nixos-manual" = {
57− description = "NixOS Manual";
58− wantedBy = [ "multi-user.target" ];
59− serviceConfig = {
60− ExecStart = "${cfg.browser} ${config.system.build.manual.manualHTMLIndex}";
61− StandardInput = "tty";
62− StandardOutput = "tty";
63− TTYPath = "/dev/tty${toString cfg.ttyNumber}";
64− TTYReset = true;
65− TTYVTDisallocate = true;
66− Restart = "always";
47+ config = mkMerge [
48+ (mkIf cfg.showManual {
49+ assertions = singleton {
50+ assertion = cfgd.enable && cfgd.nixos.enable;
51+ message = "Can't enable `services.nixosManual.showManual` without `documentation.nixos.enable`";
6752 };
68− };
69−
70− };
53+ })
54+ (mkIf (cfg.showManual && cfgd.enable && cfgd.nixos.enable) {
55+ boot.extraTTYs = [ "tty${toString cfg.ttyNumber}" ];
56+
57+ systemd.services."nixos-manual" = {
58+ description = "NixOS Manual";
59+ wantedBy = [ "multi-user.target" ];
60+ serviceConfig = {
61+ ExecStart = "${cfg.browser} ${config.system.build.manual.manualHTMLIndex}";
62+ StandardInput = "tty";
63+ StandardOutput = "tty";
64+ TTYPath = "/dev/tty${toString cfg.ttyNumber}";
65+ TTYReset = true;
66+ TTYVTDisallocate = true;
67+ Restart = "always";
68+ };
69+ };
70+ })
71+ ];
7172
7273}