diff options
107 files changed, 591 insertions, 161 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index e3bb27aa9462..573bf40e4b34 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -614,6 +614,8 @@ rec { definitions = map (def: def.value) res.defsFinal; files = map (def: def.file) res.defsFinal; inherit (res) isDefined; + # This allows options to be correctly displayed using `${options.path.to.it}` + __toString = _: showOption loc; }; # Merge definitions of a value of a given type. diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix index 11307e331200..133a150df82c 100644 --- a/nixos/modules/config/networking.nix +++ b/nixos/modules/config/networking.nix @@ -1,12 +1,13 @@ # /etc files related to networking, such as /etc/services. -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: with lib; let cfg = config.networking; + opt = options.networking; localhostMultiple = any (elem "localhost") (attrValues (removeAttrs cfg.hosts [ "127.0.0.1" "::1" ])); @@ -78,6 +79,7 @@ in httpProxy = lib.mkOption { type = types.nullOr types.str; default = cfg.proxy.default; + defaultText = literalExpression "config.${opt.proxy.default}"; description = '' This option specifies the http_proxy environment variable. ''; @@ -87,6 +89,7 @@ in httpsProxy = lib.mkOption { type = types.nullOr types.str; default = cfg.proxy.default; + defaultText = literalExpression "config.${opt.proxy.default}"; description = '' This option specifies the https_proxy environment variable. ''; @@ -96,6 +99,7 @@ in ftpProxy = lib.mkOption { type = types.nullOr types.str; default = cfg.proxy.default; + defaultText = literalExpression "config.${opt.proxy.default}"; description = '' This option specifies the ftp_proxy environment variable. ''; @@ -105,6 +109,7 @@ in rsyncProxy = lib.mkOption { type = types.nullOr types.str; default = cfg.proxy.default; + defaultText = literalExpression "config.${opt.proxy.default}"; description = '' This option specifies the rsync_proxy environment variable. ''; @@ -114,6 +119,7 @@ in allProxy = lib.mkOption { type = types.nullOr types.str; default = cfg.proxy.default; + defaultText = literalExpression "config.${opt.proxy.default}"; description = '' This option specifies the all_proxy environment variable. ''; diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix index 6ff4ec2921cf..875c4c9c4415 100644 --- a/nixos/modules/config/system-path.nix +++ b/nixos/modules/config/system-path.nix @@ -41,12 +41,17 @@ let pkgs.zstd ]; - defaultPackages = map (pkg: setPrio ((pkg.meta.priority or 5) + 3) pkg) - [ pkgs.nano - pkgs.perl - pkgs.rsync - pkgs.strace - ]; + defaultPackageNames = + [ "nano" + "perl" + "rsync" + "strace" + ]; + defaultPackages = + map + (n: let pkg = pkgs.${n}; in setPrio ((pkg.meta.priority or 5) + 3) pkg) + defaultPackageNames; + defaultPackagesText = "[ ${concatMapStringsSep " " (n: "pkgs.${n}") defaultPackageNames } ]"; in @@ -73,6 +78,11 @@ in defaultPackages = mkOption { type = types.listOf types.package; default = defaultPackages; + defaultText = literalDocBook '' + these packages, with their <literal>meta.priority</literal> numerically increased + (thus lowering their installation priority): + <programlisting>${defaultPackagesText}</programlisting> + ''; example = []; description = '' Set of default packages that aren't strictly necessary diff --git a/nixos/modules/hardware/system-76.nix b/nixos/modules/hardware/system-76.nix index d4896541dbae..ca40ee0ebb37 100644 --- a/nixos/modules/hardware/system-76.nix +++ b/nixos/modules/hardware/system-76.nix @@ -1,8 +1,9 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: let - inherit (lib) mkOption mkEnableOption types mkIf mkMerge optional versionOlder; + inherit (lib) literalExpression mkOption mkEnableOption types mkIf mkMerge optional versionOlder; cfg = config.hardware.system76; + opt = options.hardware.system76; kpkgs = config.boot.kernelPackages; modules = [ "system76" "system76-io" ] ++ (optional (versionOlder kpkgs.kernel.version "5.5") "system76-acpi"); @@ -60,6 +61,7 @@ in { firmware-daemon.enable = mkOption { default = cfg.enableAll; + defaultText = literalExpression "config.${opt.enableAll}"; example = true; description = "Whether to enable the system76 firmware daemon"; type = types.bool; @@ -67,6 +69,7 @@ in { kernel-modules.enable = mkOption { default = cfg.enableAll; + defaultText = literalExpression "config.${opt.enableAll}"; example = true; description = "Whether to make the system76 out-of-tree kernel modules available"; type = types.bool; @@ -74,6 +77,7 @@ in { power-daemon.enable = mkOption { default = cfg.enableAll; + defaultText = literalExpression "config.${opt.enableAll}"; example = true; description = "Whether to enable the system76 power daemon"; type = types.bool; diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index 8f246a9278b7..fc0d65d5148e 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: with lib; let cfg = config.system.nixos; + opt = options.system.nixos; in { @@ -53,6 +54,7 @@ in stateVersion = mkOption { type = types.str; default = cfg.release; + defaultText = liter |