diff options
author | Naïm Favier <n@monade.li> | 2021-10-03 18:06:03 +0200 |
---|---|---|
committer | Naïm Favier <n@monade.li> | 2021-10-04 12:47:20 +0200 |
commit | 2ddc335e6f32b875e14ad9610101325b306a0add (patch) | |
tree | 2a4591c137cb363a6ec09f529d587a10aa7a0bc7 /nixos/modules/system | |
parent | 330b1e08b8df4e1f0100a0a7810ec3157749e5ee (diff) | |
download | nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.gz nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.bz2 nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.lz nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.xz nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.zst nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.zip |
nixos/doc: clean up defaults and examples
Diffstat (limited to 'nixos/modules/system')
-rw-r--r-- | nixos/modules/system/activation/activation-script.nix | 9 | ||||
-rw-r--r-- | nixos/modules/system/activation/top-level.nix | 10 | ||||
-rw-r--r-- | nixos/modules/system/boot/initrd-openvpn.nix | 2 | ||||
-rw-r--r-- | nixos/modules/system/boot/initrd-ssh.nix | 2 | ||||
-rw-r--r-- | nixos/modules/system/boot/kernel.nix | 12 | ||||
-rw-r--r-- | nixos/modules/system/boot/kernel_config.nix | 2 | ||||
-rw-r--r-- | nixos/modules/system/boot/loader/grub/grub.nix | 12 | ||||
-rw-r--r-- | nixos/modules/system/boot/loader/grub/ipxe.nix | 2 | ||||
-rw-r--r-- | nixos/modules/system/boot/luksroot.nix | 2 | ||||
-rw-r--r-- | nixos/modules/system/boot/networkd.nix | 12 | ||||
-rw-r--r-- | nixos/modules/system/boot/plymouth.nix | 3 | ||||
-rw-r--r-- | nixos/modules/system/boot/stage-1.nix | 6 | ||||
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 10 | ||||
-rw-r--r-- | nixos/modules/system/etc/etc.nix | 2 |
14 files changed, 42 insertions, 44 deletions
diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix index 704fc15fe20..8dbfe393f10 100644 --- a/nixos/modules/system/activation/activation-script.nix +++ b/nixos/modules/system/activation/activation-script.nix @@ -110,7 +110,7 @@ in system.activationScripts = mkOption { default = {}; - example = literalExample '' + example = literalExpression '' { stdio.text = ''' # Needed by some programs. @@ -147,7 +147,7 @@ in system.userActivationScripts = mkOption { default = {}; - example = literalExample '' + example = literalExpression '' { plasmaSetup = { text = ''' ${pkgs.libsForQt5.kservice}/bin/kbuildsycoca5" @@ -193,9 +193,8 @@ in environment.usrbinenv = mkOption { default = "${pkgs.coreutils}/bin/env"; - example = literalExample '' - "''${pkgs.busybox}/bin/env" - ''; + defaultText = literalExpression ''"''${pkgs.coreutils}/bin/env"''; + example = literalExpression ''"''${pkgs.busybox}/bin/env"''; type = types.nullOr types.path; visible = false; description = '' diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index dad9acba91a..026fd1791d3 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -155,7 +155,7 @@ in specialisation = mkOption { default = {}; - example = lib.literalExample "{ fewJobsManyCores.configuration = { nix.buildCores = 0; nix.maxJobs = 1; }; }"; + example = lib.literalExpression "{ fewJobsManyCores.configuration = { nix.buildCores = 0; nix.maxJobs = 1; }; }"; description = '' Additional configurations to build. If <literal>inheritParentConfig</literal> is true, the system @@ -243,7 +243,7 @@ in system.replaceRuntimeDependencies = mkOption { default = []; - example = lib.literalExample "[ ({ original = pkgs.openssl; replacement = pkgs.callPackage /path/to/openssl { }; }) ]"; + example = lib.literalExpression "[ ({ original = pkgs.openssl; replacement = pkgs.callPackage /path/to/openssl { }; }) ]"; type = types.listOf (types.submodule ( { ... }: { options.original = mkOption { @@ -274,7 +274,11 @@ in if config.networking.hostName == "" then "unnamed" else config.networking.hostName; - defaultText = '''networking.hostName' if non empty else "unnamed"''; + defaultText = literalExpression '' + if config.networking.hostName == "" + then "unnamed" + else config.networking.hostName; + ''; description = '' The name of the system used in the <option>system.build.toplevel</option> derivation. </para><para> diff --git a/nixos/modules/system/boot/initrd-openvpn.nix b/nixos/modules/system/boot/initrd-openvpn.nix index b35fb0b57c0..9b52d4bbdb1 100644 --- a/nixos/modules/system/boot/initrd-openvpn.nix +++ b/nixos/modules/system/boot/initrd-openvpn.nix @@ -35,7 +35,7 @@ in </para> </warning> ''; - example = "./configuration.ovpn"; + example = literalExpression "./configuration.ovpn"; }; }; diff --git a/nixos/modules/system/boot/initrd-ssh.nix b/nixos/modules/system/boot/initrd-ssh.nix index 00ac83a1897..0999142de86 100644 --- a/nixos/modules/system/boot/initrd-ssh.nix +++ b/nixos/modules/system/boot/initrd-ssh.nix @@ -78,7 +78,7 @@ in authorizedKeys = mkOption { type = types.listOf types.str; default = config.users.users.root.openssh.authorizedKeys.keys; - defaultText = "config.users.users.root.openssh.authorizedKeys.keys"; + defaultText = literalExpression "config.users.users.root.openssh.authorizedKeys.keys"; description = '' Authorized keys for the root user on initrd. ''; diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 15a5fd23609..46f2e3fec04 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -23,7 +23,7 @@ in boot.kernel.features = mkOption { default = {}; - example = literalExample "{ debug = true; }"; + example = literalExpression "{ debug = true; }"; internal = true; description = '' This option allows to enable or disable certain kernel features. @@ -46,8 +46,8 @@ in }); # We don't want to evaluate all of linuxPackages for the manual # - some of it might not even evaluate correctly. - defaultText = "pkgs.linuxPackages"; - example = literalExample "pkgs.linuxKernel.packages.linux_5_10"; + defaultText = literalExpression "pkgs.linuxPackages"; + example = literalExpression "pkgs.linuxKernel.packages.linux_5_10"; description = '' This option allows you to override the Linux kernel used by NixOS. Since things like external kernel module packages are @@ -65,7 +65,7 @@ in boot.kernelPatches = mkOption { type = types.listOf types.attrs; default = []; - example = literalExample "[ pkgs.kernelPatches.ubuntu_fan_4_4 ]"; + example = literalExpression "[ pkgs.kernelPatches.ubuntu_fan_4_4 ]"; description = "A list of additional patches to apply to the kernel."; }; @@ -113,7 +113,7 @@ in boot.extraModulePackages = mkOption { type = types.listOf types.package; default = []; - example = literalExample "[ config.boot.kernelPackages.nvidia_x11 ]"; + example = literalExpression "[ config.boot.kernelPackages.nvidia_x11 ]"; description = "A list of additional packages supplying kernel modules."; }; @@ -181,7 +181,7 @@ in system.requiredKernelConfig = mkOption { default = []; - example = literalExample '' + example = literalExpression '' with config.lib.kernelConfig; [ (isYes "MODULES") (isEnabled "FB_CON_DECOR") diff --git a/nixos/modules/system/boot/kernel_config.nix b/nixos/modules/system/boot/kernel_config.nix index 5d9534024b0..495fe74bc21 100644 --- a/nixos/modules/system/boot/kernel_config.nix +++ b/nixos/modules/system/boot/kernel_config.nix @@ -100,7 +100,7 @@ in settings = mkOption { type = types.attrsOf kernelItem; - example = literalExample '' with lib.kernel; { + example = literalExpression '' with lib.kernel; { "9P_NET" = yes; USB = option yes; MMC_BLOCK_MINORS = freeform "32"; diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index 1be66367038..fa8500dd42b 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -329,7 +329,7 @@ in extraInstallCommands = mkOption { default = ""; - example = literalExample '' + example = '' # the example below generates detached signatures that GRUB can verify # https://www.gnu.org/software/grub/manual/grub/grub.html#Using-digital-signatures ''${pkgs.findutils}/bin/find /boot -not -path "/boot/efi/*" -type f -name '*.sig' -delete @@ -392,7 +392,7 @@ in extraFiles = mkOption { type = types.attrsOf types.path; default = {}; - example = literalExample '' + example = literalExpression '' { "memtest.bin" = "''${pkgs.memtest86plus}/memtest.bin"; } ''; description = '' @@ -413,7 +413,7 @@ in splashImage = mkOption { type = types.nullOr types.path; - example = literalExample "./my-background.png"; + example = literalExpression "./my-background.png"; description = '' Background image used for GRUB. Set to <literal>null</literal> to run GRUB in text mode. @@ -449,7 +449,7 @@ in theme = mkOption { type = types.nullOr types.path; - example = literalExample "pkgs.nixos-grub2-theme"; + example = literalExpression "pkgs.nixos-grub2-theme"; default = null; description = '' Grub theme to be used. @@ -475,7 +475,7 @@ in font = mkOption { type = types.nullOr types.path; default = "${realGrub}/share/grub/unicode.pf2"; - defaultText = ''"''${pkgs.grub2}/share/grub/unicode.pf2"''; + defaultText = literalExpression ''"''${pkgs.grub2}/share/grub/unicode.pf2"''; description = '' Path to a TrueType, OpenType, or pf2 font to be used by Grub. ''; @@ -483,7 +483,7 @@ in fontSize = mkOption { type = types.nullOr types.int; - example = literalExample 16; + example = 16; default = null; description = '' Font size for the grub menu. Ignored unless <literal>font</literal> diff --git a/nixos/modules/system/boot/loader/grub/ipxe.nix b/nixos/modules/system/boot/loader/grub/ipxe.nix index 249c2761934..ef8595592f4 100644 --- a/nixos/modules/system/boot/loader/grub/ipxe.nix +++ b/nixos/modules/system/boot/loader/grub/ipxe.nix @@ -33,7 +33,7 @@ in booting from the GRUB boot menu. ''; default = { }; - example = literalExample '' + example = literalExpression '' { demo = ''' #!ipxe dhcp diff --git a/nixos/modules/system/boot/luksroot.nix b/nixos/modules/system/boot/luksroot.nix index f87d3b07a36..fb5269e43d0 100644 --- a/nixos/modules/system/boot/luksroot.nix +++ b/nixos/modules/system/boot/luksroot.nix @@ -663,13 +663,11 @@ in }; encryptedPass = mkOption { - default = ""; type = types.path; description = "Path to the GPG encrypted passphrase."; }; publicKey = mkOption { - default = ""; type = types.path; description = "Path to the Public Key."; }; diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index bf254be1341..a50abc73511 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -844,7 +844,6 @@ let options = { wireguardPeerConfig = mkOption { default = {}; - example = { }; type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionWireGuardPeer; description = '' Each attribute in this set specifies an option in the @@ -859,7 +858,6 @@ let netdevOptions = commonNetworkOptions // { netdevConfig = mkOption { - default = {}; example = { Name = "mybridge"; Kind = "bridge"; }; type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionNetdev; description = '' @@ -896,7 +894,6 @@ let vxlanConfig = mkOption { default = {}; - example = { Id = "4"; }; type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionVXLAN; description = '' Each attribute in this set specifies an option in the @@ -959,7 +956,7 @@ let example = { PrivateKeyFile = "/etc/wireguard/secret.key"; ListenPort = 51820; - FwMark = 42; + FirewallMark = 42; }; type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionWireGuard; description = '' @@ -1038,7 +1035,6 @@ let addressOptions = { options = { addressConfig = mkOption { - default = {}; example = { Address = "192.168.0.100/24"; }; type = types.addCheck (types.attrsOf unitOption) check.network.sectionAddress; description = '' @@ -1055,7 +1051,7 @@ let options = { routingPolicyRuleConfig = mkOption { default = { }; - example = { routingPolicyRuleConfig = { Table = 10; IncomingInterface = "eth1"; Family = "both"; } ;}; + example = { Table = 10; IncomingInterface = "eth1"; Family = "both"; }; type = types.addCheck (types.attrsOf unitOption) check.network.sectionRoutingPolicyRule; description = '' Each attribute in this set specifies an option in the @@ -1146,7 +1142,7 @@ let dhcpV6Config = mkOption { default = {}; - example = { UseDNS = true; UseRoutes = true; }; + example = { UseDNS = true; }; type = types.addCheck (types.attrsOf unitOption) check.network.sectionDHCPv6; description = '' Each attribute in this set specifies an option in the @@ -1213,7 +1209,7 @@ let ipv6Prefixes = mkOption { default = []; - example = { AddressAutoconfiguration = true; OnLink = true; }; + example = [ { AddressAutoconfiguration = true; OnLink = true; } ]; type = with types; listOf (submodule ipv6PrefixOptions); description = '' A list of ipv6Prefix sections to be added to the unit. See diff --git a/nixos/modules/system/boot/plymouth.nix b/nixos/modules/system/boot/plymouth.nix index 2a545e55251..4b8194d2f85 100644 --- a/nixos/modules/system/boot/plymouth.nix +++ b/nixos/modules/system/boot/plymouth.nix @@ -62,6 +62,7 @@ in font = mkOption { default = "${pkgs.dejavu_fonts.minimal}/share/fonts/truetype/DejaVuSans.ttf"; + defaultText = literalExpression ''"''${pkgs.dejavu_fonts.minimal}/share/fonts/truetype/DejaVuSans.ttf"''; type = types.path; description = '' Font file made available for displaying text on the splash screen. @@ -88,7 +89,7 @@ in type = types.path; # Dimensions are 48x48 to match GDM logo default = "${nixos-icons}/share/icons/hicolor/48x48/apps/nix-snowflake-white.png"; - defaultText = ''pkgs.fetchurl { + defaultText = literalExpression ''pkgs.fetchurl { url = "https://nixos.org/logo/nixos-hires.png"; sha256 = "1ivzgd7iz0i06y36p8m5w48fd8pjqwxhdaavc0pxs7w1g7mcy5si"; }''; diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 03133fa1bc4..bd7e955a6f4 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -411,7 +411,7 @@ in boot.initrd.enable = mkOption { type = types.bool; default = !config.boot.isContainer; - defaultText = "!config.boot.isContainer"; + defaultText = literalExpression "!config.boot.isContainer"; description = '' Whether to enable the NixOS initial RAM disk (initrd). This may be needed to perform some initialisation tasks (like mounting @@ -527,7 +527,7 @@ in then "zstd" else "gzip" ); - defaultText = "zstd if the kernel supports it (5.9+), gzip if not."; + defaultText = literalDocBook "<literal>zstd</literal> if the kernel supports it (5.9+), <literal>gzip</literal> if not"; type = types.unspecified; # We don't have a function type... description = '' The compressor to use on the initrd image. May be any of: @@ -559,7 +559,7 @@ in is the path it should be copied from (or null for the same path inside and out). ''; - example = literalExample + example = literalExpression '' { "/etc/dropbear/dropbear_rsa_host_key" = ./secret-dropbear-key; diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 9693e2e377a..93ea77d1ee7 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -426,7 +426,7 @@ in systemd.package = mkOption { default = pkgs.systemd; - defaultText = "pkgs.systemd"; + defaultText = literalExpression "pkgs.systemd"; type = types.package; description = "The systemd package."; }; @@ -446,7 +446,7 @@ in systemd.packages = mkOption { default = []; type = types.listOf types.package; - example = literalExample "[ pkgs.systemd-cryptsetup-generator ]"; + example = literalExpression "[ pkgs.systemd-cryptsetup-generator ]"; description = "Packages providing systemd units and hooks."; }; @@ -663,7 +663,7 @@ in services.journald.forwardToSyslog = mkOption { default = config.services.rsyslogd.enable || config.services.syslog-ng.enable; - defaultText = "services.rsyslogd.enable || services.syslog-ng.enable"; + defaultText = literalExpression "services.rsyslogd.enable || services.syslog-ng.enable"; type = types.bool; description = '' Whether to forward log messages to syslog. @@ -722,7 +722,7 @@ in services.logind.lidSwitchExternalPower = mkOption { default = config.services.logind.lidSwitch; - defaultText = "services.logind.lidSwitch"; + defaultText = literalExpression "services.logind.lidSwitch"; example = "ignore"; type = logindHandlerType; @@ -768,7 +768,7 @@ in systemd.tmpfiles.packages = mkOption { type = types.listOf types.package; default = []; - example = literalExample "[ pkgs.lvm2 ]"; + example = literalExpression "[ pkgs.lvm2 ]"; apply = map getLib; description = '' List of packages containing <command>systemd-tmpfiles</command> rules. diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix index 80e728d09a6..8f14f04a1f6 100644 --- a/nixos/modules/system/etc/etc.nix +++ b/nixos/modules/system/etc/etc.nix @@ -72,7 +72,7 @@ in environment.etc = mkOption { default = {}; - example = literalExample '' + example = literalExpression '' { example-configuration-file = { source = "/nix/store/.../etc/dir/file.conf.example"; mode = "0440"; |