diff options
author | pennae <github@quasiparticle.net> | 2021-12-05 21:45:35 +0100 |
---|---|---|
committer | pennae <github@quasiparticle.net> | 2021-12-09 01:14:16 +0100 |
commit | ed673a69dbf5f9be67183621eb0f5c1759d48299 (patch) | |
tree | c5c2aa29c87a0f517e66f805d593fc74deb6ae79 /nixos/modules/services/networking | |
parent | fb0e5be84331188a69b3edd31679ca6576edb75a (diff) | |
download | nixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.tar nixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.tar.gz nixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.tar.bz2 nixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.tar.lz nixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.tar.xz nixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.tar.zst nixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.zip |
treewide: add defaultText for options with simple cfg.* expression defaults
adds defaultText for options with defaults that use only literals, full config.* paths, and the cfg shortcut binding.
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r-- | nixos/modules/services/networking/wireguard.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/networking/wpa_supplicant.nix | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/nixos/modules/services/networking/wireguard.nix b/nixos/modules/services/networking/wireguard.nix index 55b84935b6c..7cd44b2f8a0 100644 --- a/nixos/modules/services/networking/wireguard.nix +++ b/nixos/modules/services/networking/wireguard.nix @@ -1,10 +1,11 @@ -{ config, lib, pkgs, ... }: +{ config, lib, options, pkgs, ... }: with lib; let cfg = config.networking.wireguard; + opt = options.networking.wireguard; kernel = config.boot.kernelPackages; @@ -438,6 +439,7 @@ in type = types.bool; # 2019-05-25: Backwards compatibility. default = cfg.interfaces != {}; + defaultText = literalExpression "config.${opt.interfaces} != { }"; example = true; }; diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix index 4aa350d21a2..07dec8ea718 100644 --- a/nixos/modules/services/networking/wpa_supplicant.nix +++ b/nixos/modules/services/networking/wpa_supplicant.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, utils, ... }: +{ config, lib, options, pkgs, utils, ... }: with lib; @@ -8,6 +8,7 @@ let else pkgs.wpa_supplicant; cfg = config.networking.wireless; + opt = options.networking.wireless; # Content of wpa_supplicant.conf generatedConfig = concatStringsSep "\n" ( @@ -421,6 +422,7 @@ in { dbusControlled = mkOption { type = types.bool; default = lib.length cfg.interfaces < 2; + defaultText = literalExpression "length config.${opt.interfaces} < 2"; description = '' Whether to enable the DBus control interface. This is only needed when using NetworkManager or connman. |