Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos: doc: implement #12542 #46193

Merged
merged 2 commits into from Sep 24, 2018
Merged

nixos: doc: implement #12542 #46193

merged 2 commits into from Sep 24, 2018

Conversation

oxij
Copy link
Member

@oxij oxij commented Sep 6, 2018

Motivation for this change

NixOS documentation subtree was born out of 2/3s of #12542, this implements the leftover 1/3. This patchset consists of option renames, code movements, a bit of cleanup, and one new assert.

In short, nothing substantial.

This simply makes the configuration.nix(5) manual cleaner and the services.nixosManual service is now actually a service, not an amalgamation of different things.

Known issues

services.nixosManual.showManual should be renamed to services.nixosManual.enable, but since services.nixosManual.enable meant a completely different thing before and there's no configVersion-thing yet I left it as is.

Things done
  • It builds.

Don't merge sooner than 2018-09-09 23:59 UTC.

@oxij
Copy link
Member Author

oxij commented Sep 6, 2018

/cc @vcunat from the original issue and @grahamc since you frequently edit documentation

Copy link
Member

@vcunat vcunat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just skimmed this quickly, but I do like it.

Copy link
Member

@samueldr samueldr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks fine, just a nit pick with the phrasing. 👍 Thanks for the work!

<citerefentry><refentrytitle>configuration.nix</refentrytitle>
<manvolnum>5</manvolnum></citerefentry> if <option>man.enable</option> is
set.</para></listitem>
<listitem><para>This includes HTML manual and <command>nixos-help</command> script if
Copy link
Member

@samueldr samueldr Sep 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be phrased "This includes the HTML manual and the nixos-help [...]". Additionally, the end-user wouldn't care much whether it is a script or a binary. "the nixos-help command" represents better what the end-user would use; a command.

(The previous sentence "This includes man pages like [...]", though is fine without adding "the".)

@samueldr
Copy link
Member

For those wondering what the XML in the documentation.nixos.enable looks like:

image

This will be different, yet similar on the NixOS website.

@oxij
Copy link
Member Author

oxij commented Sep 23, 2018

Status: this conflicts with merged #46510 and I have questions about that change there, so this is now stalled.

Because when I see "config.system.build.manual.manual" after I forgot
what it means I ask "Why do I need that second `.manual` there again?".
Doesn't happen with `config.system.build.manual.manualHTML`.
@oxij
Copy link
Member Author

oxij commented Sep 23, 2018

Fixed nitpicks. Fixed conflicts and rebased.

@samueldr samueldr merged commit ebf041d into NixOS:master Sep 24, 2018
@Izorkin
Copy link
Contributor

Izorkin commented Sep 24, 2018

Error update NixOS

sudo nixos-rebuild switch --upgrade
unpacking channels...
building Nix...
building the system configuration...
error: attribute 'manual' missing, at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/nixos/modules/services/misc/nixos-manual.nix:57:39

with --show-trace

unpacking channels...
building Nix...
building the system configuration...
error: while evaluating the attribute 'installBootLoader' of the derivation 'nixos-system-NixOS-Local-19.03pre153447.2da6f215d31' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/pkgs/stdenv/generic/make-derivation.nix:177:11:
while evaluating the attribute 'text' of the derivation 'install-grub.sh' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/pkgs/stdenv/generic/make-derivation.nix:177:11:
while evaluating 'flip' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/trivial.nix:74:16, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/boot/loader/grub/grub.nix:591:12:
while evaluating 'concatMapStrings' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/strings.nix:27:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/trivial.nix:74:19:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/boot/loader/grub/grub.nix:591:53, called from undefined position:
while evaluating the attribute 'text' of the derivation 'grub-config.xml' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/pkgs/stdenv/generic/make-derivation.nix:177:11:
while evaluating the attribute 'extraEntries' at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:336:9:
while evaluating the option `boot.loader.grub.extraEntries':
while evaluating the attribute 'isDefined' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:374:5:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:362:9:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:458:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:348:28, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:348:17:
while evaluating 'dischargeProperties' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:416:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:349:62:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:232:58:
while evaluating the attribute 'config.extraEntries' at /etc/nixos/services/rescue-boot.nix:44:3:
while evaluating the attribute 'config.system.build.toplevel' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/nixos/modules/system/activation/top-level.nix:272:5:
while evaluating 'foldr' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/lists.nix:36:20, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/nixos/modules/system/activation/top-level.nix:136:12:
while evaluating 'fold'' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/lists.nix:39:15, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/lists.nix:43:8:
while evaluating 'showWarnings' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/nixos/modules/system/activation/top-level.nix:100:18, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/nixos/modules/system/activation/top-level.nix:107:16:
while evaluating 'foldr' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/lists.nix:36:20, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/nixos/modules/system/activation/top-level.nix:100:23:
while evaluating 'fold'' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/lists.nix:39:15, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/lists.nix:43:8:
while evaluating the attribute 'warnings' at undefined position:
while evaluating anonymous function at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:336:9:
while evaluating the option `warnings':
while evaluating the attribute 'isDefined' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:374:5:
while evaluating the attribute 'values' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:362:9:
while evaluating the attribute 'values' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:458:7:
while evaluating anonymous function at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:348:28, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:348:17:
while evaluating 'dischargeProperties' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:416:25, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:349:62:
while evaluating the attribute 'value' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:232:58:
while evaluating the attribute 'config.warnings' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/nixos/modules/system/boot/systemd.nix:707:5:
while evaluating anonymous function at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/attrsets.nix:225:10, called from undefined position:
while evaluating anonymous function at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/nixos/modules/system/boot/systemd.nix:707:51, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/attrsets.nix:225:16:
while evaluating 'optional' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/lists.nix:199:20, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/nixos/modules/system/boot/systemd.nix:708:7:
while evaluating the attribute 'serviceConfig.Type' at undefined position:
while evaluating anonymous function at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:336:9:
while evaluating the option `systemd.services.nixos-manual.serviceConfig':
while evaluating the attribute 'mergedValue' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:369:5:
while evaluating anonymous function at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:369:32, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:369:19:
while evaluating 'merge' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/types.nix:276:20, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:372:8:
while evaluating 'filterAttrs' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/attrsets.nix:115:23, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/types.nix:277:35:
while evaluating anonymous function at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/attrsets.nix:116:29, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/attrsets.nix:116:18:
while evaluating anonymous function at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/types.nix:277:51, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/attrsets.nix:116:62:
while evaluating the attribute 'ExecStart' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/attrsets.nix:335:7:
while evaluating anonymous function at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/types.nix:277:86, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/attrsets.nix:335:15:
while evaluating the attribute 'optionalValue' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:376:5:
while evaluating the attribute 'values' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:362:9:
while evaluating the attribute 'values' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:458:7:
while evaluating anonymous function at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:348:28, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:348:17:
while evaluating 'dischargeProperties' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:416:25, called from /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/modules.nix:349:62:
while evaluating the attribute 'value' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/lib/types.nix:282:55:
while evaluating the attribute 'ExecStart' at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/nixos/modules/services/misc/nixos-manual.nix:57:9:
while evaluating the attribute 'system.build.manual.manualHTMLIndex' at undefined position:
attribute 'manual' missing, at /nix/store/0hfq6hrgyv5r8zz6lflxwhglgzgws2sb-nixos-19.03pre153447.2da6f215d31/nixos/nixos/modules/services/misc/nixos-manual.nix:57:39

@oxij
Copy link
Member Author

oxij commented Sep 24, 2018 via email

@Izorkin
Copy link
Contributor

Izorkin commented Sep 24, 2018

Not found nixosManual in /etc/nixos/*

@oxij
Copy link
Member Author

oxij commented Sep 24, 2018

Indeed, I reproduced your error it with a minimal config with the above combination of options, so evaluation order is indeed buggy, fixed in #47293.

Now the question is what sets this combination of variables in your config. Do you include any profiles?

(In principle, I can "fix" this by simply disabling showManual if manual is not being generated, but that combination of options is semantically incorrect.)

@Izorkin
Copy link
Contributor

Izorkin commented Sep 24, 2018

This config causes an error

{ pkgs, ... }:
let
  netboot = import (pkgs.path + "/nixos/lib/eval-config.nix") {
      modules = [
        (pkgs.path + "/nixos/modules/installer/netboot/netboot-minimal.nix")
        module
      ];
    };
    module = {
      boot.supportedFilesystems = [ "zfs" ];
      boot.loader.grub.extraConfig = "
        serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
        terminal_input console
        terminal_output console
      ";
      boot.kernelParams = [ "console=ttyS0,115200n8" ];
      boot.kernelPackages = pkgs.linuxPackages_4_18;
      boot.zfs.enableUnstable = true;
      services.openssh = {
        enable = true;
        ports = [ 22 ];
        passwordAuthentication = false;
        allowSFTP = true;
        forwardX11 = false;
        startWhenNeeded = true;
      };
    };
in {
  boot.loader.grub.extraEntries = ''
    menuentry "NixOS - Rescue boot" {
      linux ($drive1)/rescue-kernel init=${netboot.config.system.build.toplevel}/init ${toString netboot.config.boot.kernelParams}
      initrd ($drive1)/rescue-initrd
    }
  '';
  boot.loader.grub.extraFiles = {
    "rescue-kernel" = "${netboot.config.system.build.kernel}/bzImage";
    "rescue-initrd" = "${netboot.config.system.build.netbootRamdisk}/initrd";
  };
}

@oxij oxij mentioned this pull request Sep 24, 2018
1 task
@oxij
Copy link
Member Author

oxij commented Sep 24, 2018

Should be fixed by #47298.

7c6f434c added a commit that referenced this pull request Sep 25, 2018
oxij referenced this pull request Sep 25, 2018
Introduced by 0f3b89b.

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
@oxij oxij deleted the nixos/manual-to-doc branch November 18, 2018 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants