Skip to content

Commit

Permalink
feat: add declarative networks
Browse files Browse the repository at this point in the history
  • Loading branch information
glwbr committed Jun 20, 2024
1 parent af8a949 commit 39e5ce9
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions system/hardware/network.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
{lib, ...}: {
networking = {
networkmanager = {
{config, ...}: {
sops.secrets.wireless = {
sopsFile = ../../hosts/shared/secrets.yaml;
neededForUsers = true;
};

networking.wireless = {
enable = true;
fallbackToWPA2 = false;
environmentFile = config.sops.secrets.wireless.path;
networks = {
"UAIFAI" = {
pskRaw = "@UAIFAI@";
};

"UAIFAI_5G" = {
pskRaw = "@UAIFAI5G@";
};
};

# Imperative
allowAuxiliaryImperativeNetworks = true;
userControlled = {
enable = true;
wifi.powersave = false;
group = "network";
};

enableIPv6 = false;
dhcpcd.wait = "background";
dhcpcd.extraConfig = "noarp";
extraConfig = ''
update_config=1
'';
};

services = {
Expand All @@ -16,4 +36,9 @@
settings.UseDns = true;
};
};

# Ensure group exists
users.groups.network = {};

systemd.services.wpa_supplicant.preStart = "touch /etc/wpa_supplicant.conf";
}

0 comments on commit 39e5ce9

Please sign in to comment.