···
1
-
{ lib, config, pkgs, ... }:
cfg = config.modules.network.wifi;
7
-
connection = { id = name; type = "wifi"; };
9
-
ipv6 = { addr-gen-mode = "stable-privacy"; method = "auto"; };
10
-
wifi = { mode = "infrastructure"; ssid = name; };
19
+
addr-gen-mode = "stable-privacy";
23
+
mode = "infrastructure";
13
-
if (p ? pskVar && p.pskVar != null) then { wifi-security = { key-mgmt = "wpa-psk"; psk = "$${" + p.pskVar + "}"; }; }
14
-
else if (p ? psk && p.psk != null) then { wifi-security = { key-mgmt = "wpa-psk"; psk = p.psk; }; }
15
-
else if (p ? pskFile && p.pskFile != null) then { wifi-security = { key-mgmt = "wpa-psk"; psk = "$(" + pkgs.coreutils + "/bin/cat " + p.pskFile + ")"; }; }
28
+
if (p ? pskVar && p.pskVar != null) then
31
+
key-mgmt = "wpa-psk";
32
+
psk = "$${" + p.pskVar + "}";
35
+
else if (p ? psk && p.psk != null) then
38
+
key-mgmt = "wpa-psk";
42
+
else if (p ? pskFile && p.pskFile != null) then
45
+
key-mgmt = "wpa-psk";
46
+
psk = "$(" + pkgs.coreutils + "/bin/cat " + p.pskFile + ")";
options.modules.network.wifi = {
enable = lib.mkEnableOption "Enable NetworkManager with simplified Wi-Fi profiles";
22
-
hostName = lib.mkOption { type = lib.types.str; default = config.networking.hostName or ""; };
23
-
nameservers = lib.mkOption { type = lib.types.listOf lib.types.str; default = []; };
57
+
hostName = lib.mkOption {
58
+
type = lib.types.str;
59
+
default = config.networking.hostName or "";
61
+
nameservers = lib.mkOption {
62
+
type = lib.types.listOf lib.types.str;
type = lib.types.nullOr lib.types.path;
···
profiles = lib.mkOption {
31
-
type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: {
33
-
pskVar = lib.mkOption { type = lib.types.nullOr lib.types.str; default = null; description = "Variable name in envFile providing PSK"; };
34
-
psk = lib.mkOption { type = lib.types.nullOr lib.types.str; default = null; };
35
-
pskFile = lib.mkOption { type = lib.types.nullOr lib.types.path; default = null; };
72
+
type = lib.types.attrsOf (
73
+
lib.types.submodule (
77
+
pskVar = lib.mkOption {
78
+
type = lib.types.nullOr lib.types.str;
80
+
description = "Variable name in envFile providing PSK";
82
+
psk = lib.mkOption {
83
+
type = lib.types.nullOr lib.types.str;
86
+
pskFile = lib.mkOption {
87
+
type = lib.types.nullOr lib.types.path;
description = "Map of SSID -> { pskVar | psk | pskFile }.";
···
config = lib.mkIf cfg.enable {
hostName = lib.mkIf (cfg.hostName != "") cfg.hostName;
46
-
nameservers = lib.mkIf (cfg.nameservers != []) cfg.nameservers;
102
+
nameservers = lib.mkIf (cfg.nameservers != [ ]) cfg.nameservers;