mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 18:41:34 +01:00
Move modules in programs/services subfolders
This commit is contained in:
parent
2ff87c8404
commit
211ca98e92
38 changed files with 0 additions and 0 deletions
71
modules/system/services/wlan.nix
Normal file
71
modules/system/services/wlan.nix
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
pskSsids = [
|
||||
"WLAN-233151"
|
||||
"EW90N"
|
||||
"Fairphone4"
|
||||
"DSL_EXT"
|
||||
];
|
||||
in
|
||||
{
|
||||
options.custom.services.wlan.enable = lib.mkEnableOption "";
|
||||
|
||||
config = lib.mkIf config.custom.services.wlan.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
networking.wireless.iwd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
General.EnableNetworkConfiguration = true;
|
||||
Settings.AutoConnect = true;
|
||||
Network.NameResolvingService = "resolvconf";
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [ pkgs.iwgtk ];
|
||||
|
||||
sops = {
|
||||
secrets = {
|
||||
"wlan/eduroam/password" = { };
|
||||
"wlan/eduroam/cert" = { };
|
||||
};
|
||||
|
||||
templates."iwd/eduroam.8021x".content = ''
|
||||
[Security]
|
||||
EAP-Method=PEAP
|
||||
EAP-Identity=anonymous@h-da.de
|
||||
EAP-PEAP-CACert=${config.sops.secrets."wlan/eduroam/cert".path}
|
||||
EAP-PEAP-Phase2-Method=MSCHAPV2
|
||||
EAP-PEAP-Phase2-Identity=sebastian.stork@stud.h-da.de
|
||||
EAP-PEAP-Phase2-Password=${config.sops.placeholder."wlan/eduroam/password"}
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"C /var/lib/iwd/eduroam.8021x - - - - ${config.sops.templates."iwd/eduroam.8021x".path}"
|
||||
];
|
||||
}
|
||||
|
||||
(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