diff options
author | pennae <github@quasiparticle.net> | 2021-12-05 20:40:24 +0100 |
---|---|---|
committer | pennae <github@quasiparticle.net> | 2021-12-09 01:12:13 +0100 |
commit | e24a8775a86905ad001c4c965a7d180b41c10c52 (patch) | |
tree | 62da74c469bec798898d88029919f2bbd9f01442 /nixos/modules/services | |
parent | 70b105d1d062369c7489b0045df5a8b86bac5dd6 (diff) | |
download | nixpkgs-e24a8775a86905ad001c4c965a7d180b41c10c52.tar nixpkgs-e24a8775a86905ad001c4c965a7d180b41c10c52.tar.gz nixpkgs-e24a8775a86905ad001c4c965a7d180b41c10c52.tar.bz2 nixpkgs-e24a8775a86905ad001c4c965a7d180b41c10c52.tar.lz nixpkgs-e24a8775a86905ad001c4c965a7d180b41c10c52.tar.xz nixpkgs-e24a8775a86905ad001c4c965a7d180b41c10c52.tar.zst nixpkgs-e24a8775a86905ad001c4c965a7d180b41c10c52.zip |
treewide: set defaultText for options using simple path defaults
adds defaultText for all options that set their default to a path expression using the ubiquitous `cfg` shortcut bindings.
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/cluster/kubernetes/default.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/cluster/kubernetes/kubelet.nix | 3 | ||||
-rw-r--r-- | nixos/modules/services/computing/slurm/slurm.nix | 5 | ||||
-rw-r--r-- | nixos/modules/services/misc/etcd.nix | 8 | ||||
-rw-r--r-- | nixos/modules/services/misc/gitlab.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/misc/mwlib.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/misc/rippled.nix | 5 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/smartd.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/networking/ergo.nix | 6 | ||||
-rw-r--r-- | nixos/modules/services/networking/quorum.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/networking/wasabibackend.nix | 6 | ||||
-rw-r--r-- | nixos/modules/services/video/epgstation/default.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/web-apps/discourse.nix | 2 | ||||
-rw-r--r-- | nixos/modules/services/web-apps/peertube.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/x11/hardware/synaptics.nix | 7 |
15 files changed, 54 insertions, 16 deletions
diff --git a/nixos/modules/services/cluster/kubernetes/default.nix b/nixos/modules/services/cluster/kubernetes/default.nix index 433adf4d488..cf7fcb0a6d7 100644 --- a/nixos/modules/services/cluster/kubernetes/default.nix +++ b/nixos/modules/services/cluster/kubernetes/default.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: with lib; let cfg = config.services.kubernetes; + opt = options.services.kubernetes; defaultContainerdSettings = { version = 2; @@ -87,6 +88,7 @@ let description = "${prefix} certificate authority file used to connect to kube-apiserver."; type = types.nullOr types.path; default = cfg.caFile; + defaultText = literalExpression "config.${opt.caFile}"; }; certFile = mkOption { diff --git a/nixos/modules/services/cluster/kubernetes/kubelet.nix b/nixos/modules/services/cluster/kubernetes/kubelet.nix index eb0cb1f3dbc..7ecc4fd45b7 100644 --- a/nixos/modules/services/cluster/kubernetes/kubelet.nix +++ b/nixos/modules/services/cluster/kubernetes/kubelet.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: with lib; @@ -76,6 +76,7 @@ in clusterDomain = mkOption { description = "Use alternative domain."; default = config.services.kubernetes.addons.dns.clusterDomain; + defaultText = literalExpression "config.${options.services.kubernetes.addons.dns.clusterDomain}"; type = str; }; diff --git a/nixos/modules/services/computing/slurm/slurm.nix b/nixos/modules/services/computing/slurm/slurm.nix index 0c96f323132..02dfe2fe882 100644 --- a/nixos/modules/services/computing/slurm/slurm.nix +++ b/nixos/modules/services/computing/slurm/slurm.nix @@ -1,10 +1,11 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: with lib; let cfg = config.services.slurm; + opt = options.services.slurm; # configuration file can be generated by http://slurm.schedmd.com/configurator.html defaultUser = "slurm"; @@ -89,6 +90,7 @@ in storageUser = mkOption { type = types.str; default = cfg.user; + defaultText = literalExpression "config.${opt.user}"; description = '' Database user name. ''; @@ -153,6 +155,7 @@ in controlAddr = mkOption { type = types.nullOr types.str; default = cfg.controlMachine; + defaultText = literalExpression "config.${opt.controlMachine}"; example = null; description = '' Name that ControlMachine should be referred to in establishing a diff --git a/nixos/modules/services/misc/etcd.nix b/nixos/modules/services/misc/etcd.nix index c4ea091a038..fc6dfaa4285 100644 --- a/nixos/modules/services/misc/etcd.nix +++ b/nixos/modules/services/misc/etcd.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: with lib; let cfg = config.services.etcd; + opt = options.services.etcd; in { @@ -23,6 +24,7 @@ in { advertiseClientUrls = mkOption { description = "Etcd list of this member's client URLs to advertise to the rest of the cluster."; default = cfg.listenClientUrls; + defaultText = literalExpression "config.${opt.listenClientUrls}"; type = types.listOf types.str; }; @@ -41,6 +43,7 @@ in { initialAdvertisePeerUrls = mkOption { description = "Etcd list of this member's peer URLs to advertise to rest of the cluster."; default = cfg.listenPeerUrls; + defaultText = literalExpression "config.${opt.listenPeerUrls}"; type = types.listOf types.str; }; @@ -95,18 +98,21 @@ in { peerCertFile = mkOption { description = "Cert file to use for peer to peer communication"; default = cfg.certFile; + defaultText = literalExpression "config.${opt.certFile}"; type = types.nullOr types.path; }; peerKeyFile = mkOption { description = "Key file to use for peer to peer communication"; default = cfg.keyFile; + defaultText = literalExpression "config.${opt.keyFile}"; type = types.nullOr types.path; }; peerTrustedCaFile = mkOption { description = "Certificate authority file to use for peer to peer communication"; default = cfg.trustedCaFile; + defaultText = literalExpression "config.${opt.trustedCaFile}"; type = types.nullOr types.path; }; diff --git a/nixos/modules/services/misc/gitlab.nix b/nixos/modules/services/misc/gitlab.nix index b2abe70627d..cc924163ef0 100644 --- a/nixos/modules/services/misc/gitlab.nix +++ b/nixos/modules/services/misc/gitlab.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, utils, ... }: +{ config, lib, options, pkgs, utils, ... }: with lib; let cfg = config.services.gitlab; + opt = options.services.gitlab; ruby = cfg.packages.gitlab.ruby; @@ -552,6 +553,7 @@ in { defaultForProjects = mkOption { type = types.bool; default = cfg.registry.enable; + defaultText = literalExpression "config.${opt.registry.enable}"; description = "If GitLab container registry should be enabled by default for projects."; }; issuer = mkOption { diff --git a/nixos/modules/services/misc/mwlib.nix b/nixos/modules/services/misc/mwlib.nix index 8dd17c06c0b..ec8ecee8423 100644 --- a/nixos/modules/services/misc/mwlib.nix +++ b/nixos/modules/services/misc/mwlib.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: with lib; let cfg = config.services.mwlib; + opt = options.services.mwlib; pypkgs = pkgs.python27Packages; inherit (pypkgs) python mwlib; @@ -96,6 +97,7 @@ in nslave = { enable = mkOption { default = cfg.qserve.enable; + defaultText = literalExpression "config.${opt.qserve.enable}"; type = types.bool; description = '' Pulls new jobs from exactly one qserve instance diff --git a/nixos/modules/services/misc/rippled.nix b/nixos/modules/services/misc/rippled.nix index 9c66df2fce1..67768a97bfb 100644 --- a/nixos/modules/services/misc/rippled.nix +++ b/nixos/modules/services/misc/rippled.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: with lib; let cfg = config.services.rippled; + opt = options.services.rippled; b2i = val: if val then "1" else "0"; @@ -165,6 +166,7 @@ let description = "Location to store the database."; type = types.path; default = cfg.databasePath; + defaultText = literalExpression "config.${opt.databasePath}"; }; compression = mkOption { @@ -177,6 +179,7 @@ let description = "Enable automatic purging of older ledger information."; type = types.nullOr (types.addCheck types.int (v: v > 256)); default = cfg.ledgerHistory; + defaultText = literalExpression "config.${opt.ledgerHistory}"; }; advisoryDelete = mkOption { diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix index 3ea25437114..793791c4c12 100644 --- a/nixos/modules/services/monitoring/smartd.nix +++ b/nixos/modules/services/monitoring/smartd.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: with lib; @@ -8,6 +8,7 @@ let + optionalString (config.networking.domain != null) ".${config.networking.domain}"; cfg = config.services.smartd; + opt = options.services.smartd; nm = cfg.notifications.mail; nw = cfg.notifications.wall; @@ -208,6 +209,7 @@ in autodetected = mkOption { default = cfg.defaults.monitored; + defaultText = literalExpression "config.${opt.defaults.monitored}"; type = types.separatedString " "; description = '' Like <option>services.smartd.defaults.monitored</option>, but for the diff --git a/nixos/modules/services/networking/ergo.nix b/nixos/modules/services/networking/ergo.nix index c52de30dc36..6e55a7cfff6 100644 --- a/nixos/modules/services/networking/ergo.nix +++ b/nixos/modules/services/networking/ergo.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: let cfg = config.services.ergo; + opt = options.services.ergo; - inherit (lib) mkEnableOption mkIf mkOption optionalString types; + inherit (lib) literalExpression mkEnableOption mkIf mkOption optionalString types; configFile = pkgs.writeText "ergo.conf" ('' ergo { @@ -92,6 +93,7 @@ in { group = mkOption { type = types.str; default = cfg.user; + defaultText = literalExpression "config.${opt.user}"; description = "The group as which to run the Ergo node."; }; diff --git a/nixos/modules/services/networking/quorum.nix b/nixos/modules/services/networking/quorum.nix index 50148dc314d..bddcd18c7fb 100644 --- a/nixos/modules/services/networking/quorum.nix +++ b/nixos/modules/services/networking/quorum.nix @@ -1,9 +1,10 @@ -{ config, pkgs, lib, ... }: +{ config, options, pkgs, lib, ... }: let inherit (lib) mkEnableOption mkIf mkOption literalExpression types optionalString; cfg = config.services.quorum; + opt = options.services.quorum; dataDir = "/var/lib/quorum"; genesisFile = pkgs.writeText "genesis.json" (builtins.toJSON cfg.genesis); staticNodesFile = pkgs.writeText "static-nodes.json" (builtins.toJSON cfg.staticNodes); @@ -23,6 +24,7 @@ in { group = mkOption { type = types.str; default = cfg.user; + defaultText = literalExpression "config.${opt.user}"; description = "The group as which to run quorum."; }; diff --git a/nixos/modules/services/networking/wasabibackend.nix b/nixos/modules/services/networking/wasabibackend.nix index 8482823e197..b6dcd940915 100644 --- a/nixos/modules/services/networking/wasabibackend.nix +++ b/nixos/modules/services/networking/wasabibackend.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: let cfg = config.services.wasabibackend; + opt = options.services.wasabibackend; - inherit (lib) mkEnableOption mkIf mkOption optionalAttrs optionalString types; + inherit (lib) literalExpression mkEnableOption mkIf mkOption optionalAttrs optionalString types; confOptions = { BitcoinRpcConnectionString = "${cfg.rpc.user}:${cfg.rpc.password}"; @@ -103,6 +104,7 @@ in { group = mkOption { type = types.str; default = cfg.user; + defaultText = literalExpression "config.${opt.user}"; description = "The group as which to run the wasabibackend node."; }; }; diff --git a/nixos/modules/services/video/epgstation/default.nix b/nixos/modules/services/video/epgstation/default.nix index 36f7b937d5a..f895a1bfed1 100644 --- a/nixos/modules/services/video/epgstation/default.nix +++ b/nixos/modules/services/video/epgstation/default.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: with lib; let cfg = config.services.epgstation; + opt = options.services.epgstation; username = config.users.users.epgstation.name; groupname = config.users.users.epgstation.group; @@ -80,6 +81,7 @@ in clientSocketioPort = mkOption { type = types.port; default = cfg.socketioPort; + defaultText = literalExpression "config.${opt.socketioPort}"; description = '' Socket.io port that the web client is going to connect to. This may be different from <option>socketioPort</option> if EPGStation is hidden diff --git a/nixos/modules/services/web-apps/discourse.nix b/nixos/modules/services/web-apps/discourse.nix index c4fb7e2b316..e128e88cfad 100644 --- a/nixos/modules/services/web-apps/discourse.nix +++ b/nixos/modules/services/web-apps/discourse.nix @@ -4,6 +4,7 @@ let json = pkgs.formats.json {}; cfg = config.services.discourse; + opt = options.services.discourse; # Keep in sync with https://github.com/discourse/discourse_docker/blob/master/image/base/Dockerfile#L5 upstreamPostgresqlVersion = lib.getVersion pkgs.postgresql_13; @@ -399,6 +400,7 @@ in domain = lib.mkOption { type = lib.types.str; default = cfg.hostname; + defaultText = lib.literalExpression "config.${opt.hostname}"; description = '' HELO domain to use for outgoing mail. ''; diff --git a/nixos/modules/services/web-apps/peertube.nix b/nixos/modules/services/web-apps/peertube.nix index 362a3358b79..a9473fb8178 100644 --- a/nixos/modules/services/web-apps/peertube.nix +++ b/nixos/modules/services/web-apps/peertube.nix @@ -1,7 +1,8 @@ -{ lib, pkgs, config, ... }: +{ lib, pkgs, config, options, ... }: let cfg = config.services.peertube; + opt = options.services.peertube; settingsFormat = pkgs.formats.json {}; configFile = settingsFormat.generate "production.json" cfg.settings; @@ -212,6 +213,7 @@ in { enableUnixSocket = lib.mkOption { type = lib.types.bool; default = cfg.redis.createLocally; + defaultText = lib.literalExpression "config.${opt.redis.createLocally}"; description = "Use Unix socket."; }; }; diff --git a/nixos/modules/services/x11/hardware/synaptics.nix b/nixos/modules/services/x11/hardware/synaptics.nix index 22af869f1f8..93dd560bca4 100644 --- a/nixos/modules/services/x11/hardware/synaptics.nix +++ b/nixos/modules/services/x11/hardware/synaptics.nix @@ -1,8 +1,9 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: with lib; let cfg = config.services.xserver.synaptics; + opt = options.services.xserver.synaptics; tapConfig = if cfg.tapButtons then enabledTapConfig else disabledTapConfig; enabledTapConfig = '' Option "MaxTapTime" "180" @@ -77,24 +78,28 @@ in { horizTwoFingerScroll = mkOption { type = types.bool; default = cfg.twoFingerScroll; + defaultText = literalExpression "config.${opt.twoFingerScroll}"; description = "Whether to enable horizontal two-finger drag-scrolling."; }; vertTwoFingerScroll = mkOption { type = types.bool; default = cfg.twoFingerScroll; + defaultText = literalExpression "config.${opt.twoFingerScroll}"; description = "Whether to enable vertical two-finger drag-scrolling."; }; horizEdgeScroll = mkOption { type = types.bool; default = ! cfg.horizTwoFingerScroll; + defaultText = literalExpression "! config.${opt.horizTwoFingerScroll}"; description = "Whether to enable horizontal edge drag-scrolling."; }; vertEdgeScroll = mkOption { type = types.bool; default = ! cfg.vertTwoFingerScroll; + defaultText = literalExpression "! config.${opt.vertTwoFingerScroll}"; description = "Whether to enable vertical edge drag-scrolling."; }; |