68 lines
1.4 KiB
Nix
68 lines
1.4 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
self,
|
|
...
|
|
}:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.modules.system.wireless;
|
|
in
|
|
{
|
|
options.modules.system.wireless = {
|
|
enable = mkOption {
|
|
default = false;
|
|
example = true;
|
|
description = mdDoc "Automatically connect to known networks";
|
|
};
|
|
interfaces = mkOption {
|
|
default = [ ]; # All interfaces
|
|
example = [ "wlan0" ];
|
|
description = mdDoc "Interfaces for `wpa_supplicant` to bind to";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
age.secrets."passwords/networks" = {
|
|
file = "${self.inputs.secrets}/passwords/networks.age";
|
|
};
|
|
|
|
networking = {
|
|
wireless = {
|
|
enable = true;
|
|
interfaces = cfg.interfaces;
|
|
secretsFile = config.age.secrets."passwords/networks".path;
|
|
networks = {
|
|
"Apollo 600 Mbps".pskRaw = "ext:PSK_APOLLO";
|
|
};
|
|
};
|
|
networkmanager.ensureProfiles.profiles = {
|
|
"Apollo" = {
|
|
connection = {
|
|
id = "Apollo 600 Mbps";
|
|
type = "wifi";
|
|
};
|
|
wifi = {
|
|
mode = "infrastructure";
|
|
ssid = "Apollo 600 Mbps";
|
|
};
|
|
wifi-security = {
|
|
auth-alg = "open";
|
|
key-mgmt = "wpa-psk";
|
|
psk = "";
|
|
};
|
|
ipv4 = {
|
|
method = "auto";
|
|
};
|
|
ipv6 = {
|
|
addr-gen-mode = "stable-privacy";
|
|
method = "auto";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|