Also rename the wifi module file

This commit is contained in:
SebastianStork 2025-05-29 22:20:32 +02:00
parent 42ea9b843e
commit 5c1b5c39d6

45
modules/system/wifi.nix Normal file
View file

@ -0,0 +1,45 @@
{
config,
pkgs,
lib,
...
}:
let
networks = [
"EW90N.psk"
"Fairphone4.psk"
"WLAN-233151.psk"
"DSL_EXT.psk"
"eduroam.8021x"
];
in
{
options.custom.wifi.enable = lib.mkEnableOption "";
config = lib.mkIf config.custom.wifi.enable (
lib.mkMerge (
lib.flatten [
{
networking.wireless.iwd = {
enable = true;
settings = {
General.EnableNetworkConfiguration = true;
Settings.AutoConnect = true;
Network.NameResolvingService = "resolvconf";
};
};
environment.systemPackages = [ pkgs.iwgtk ];
}
(lib.forEach networks (name: {
sops.secrets."iwd/${name}" = { };
systemd.tmpfiles.rules = [
"C /var/lib/iwd/${name} - - - - ${config.sops.secrets."iwd/${name}".path}"
];
}))
]
)
);
}