mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 21:01:34 +01:00
Simplify wlan module
This commit is contained in:
parent
4adbb026e1
commit
d97a299ea3
1 changed files with 36 additions and 35 deletions
|
|
@ -4,31 +4,19 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
pskSsids = [
|
||||||
|
"WLAN-233151"
|
||||||
|
"Fairphone4"
|
||||||
|
"DSL_EXT"
|
||||||
|
];
|
||||||
|
in
|
||||||
{
|
{
|
||||||
options.myConfig.wlan.enable = lib.mkEnableOption "";
|
options.myConfig.wlan.enable = lib.mkEnableOption "";
|
||||||
|
|
||||||
config = lib.mkIf config.myConfig.wlan.enable {
|
config = lib.mkIf config.myConfig.wlan.enable (
|
||||||
sops = {
|
lib.mkMerge [
|
||||||
secrets = {
|
|
||||||
"wlan/WLAN-233151/key" = { };
|
|
||||||
"wlan/Fairphone4/key" = { };
|
|
||||||
"wlan/DSL_EXT/key" = { };
|
|
||||||
};
|
|
||||||
|
|
||||||
templates =
|
|
||||||
let
|
|
||||||
makePskFile = name: ''
|
|
||||||
[Security]
|
|
||||||
Passphrase=${config.sops.placeholder."wlan/${name}/key"}
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
"iwd/WLAN-233151.psk".content = makePskFile "WLAN-233151";
|
|
||||||
"iwd/Fairphone4.psk".content = makePskFile "Fairphone4";
|
|
||||||
"iwd/DSL_EXT.psk".content = makePskFile "DSL_EXT";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.wireless.iwd = {
|
networking.wireless.iwd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
|
|
@ -38,12 +26,25 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
|
||||||
"C /var/lib/iwd/WLAN-233151.psk - - - - ${config.sops.templates."iwd/WLAN-233151.psk".path}"
|
|
||||||
"C /var/lib/iwd/Fairphone4.psk - - - - ${config.sops.templates."iwd/Fairphone4.psk".path}"
|
|
||||||
"C /var/lib/iwd/DSL_EXT.psk - - - - ${config.sops.templates."iwd/DSL_EXT.psk".path}"
|
|
||||||
];
|
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.iwgtk ];
|
environment.systemPackages = [ pkgs.iwgtk ];
|
||||||
|
}
|
||||||
|
|
||||||
|
(lib.mkMerge (
|
||||||
|
lib.forEach pskSsids (ssid: {
|
||||||
|
sops = {
|
||||||
|
secrets."wlan/${ssid}/key" = { };
|
||||||
|
|
||||||
|
templates."iwd/${ssid}.psk".content = ''
|
||||||
|
[Security]
|
||||||
|
Passphrase=${config.sops.placeholder."wlan/${ssid}/key"}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"C /var/lib/iwd/${ssid}.psk - - - - ${config.sops.templates."iwd/${ssid}.psk".path}"
|
||||||
|
];
|
||||||
|
})
|
||||||
|
))
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue