summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilas Schöffel <sils@sils.li>2024-04-20 19:24:58 +0200
committerSilas Schöffel <sils@sils.li>2024-04-20 19:24:58 +0200
commit5ecc3573b82f99ed401e0685eb92a5dfccb7f407 (patch)
treeff3570ac527d909a7182a22da704215b6c4859fb
parentsils/meta: make declarations nullable (diff)
downloadnix-config-5ecc3573b82f99ed401e0685eb92a5dfccb7f407.zip
sils: make networking toggleable
-rw-r--r--modules/nixos/sils/networking.nix70
-rw-r--r--modules/nixos/sils/roles.nix1
2 files changed, 39 insertions, 32 deletions
diff --git a/modules/nixos/sils/networking.nix b/modules/nixos/sils/networking.nix
index 8884742..aed4eb4 100644
--- a/modules/nixos/sils/networking.nix
+++ b/modules/nixos/sils/networking.nix
@@ -1,41 +1,47 @@
{
config,
self,
+ lib,
...
-}: {
- networking = {
- enableIPv6 = false;
- useDHCP = true;
- #nameservers = ["2620:fe::fe" "2620:fe::9" "9.9.9.9" "149.112.112.112"];
- wireless = {
- enable = true;
- environmentFile = config.age.secrets.wireless.path;
- networks = {
- # Important: Never forget the second '@'!
- "@SSID_N0@".psk = "@PSK_N0@";
- "@SSID_N1@".psk = "@PSK_N1@";
- "@SSID_N2@" = {
- hidden = true;
- psk = "@PSK_N2@";
+}: let
+ cfg = config.sils.networking;
+in {
+ options.sils.networking.enable = lib.mkEnableOption "networking";
+ config = lib.mkIf cfg.enable {
+ networking = {
+ enableIPv6 = false;
+ useDHCP = true;
+ #nameservers = ["2620:fe::fe" "2620:fe::9" "9.9.9.9" "149.112.112.112"];
+ wireless = {
+ enable = true;
+ environmentFile = config.age.secrets.wireless.path;
+ networks = {
+ # Important: Never forget the second '@'!
+ "@SSID_N0@".psk = "@PSK_N0@";
+ "@SSID_N1@".psk = "@PSK_N1@";
+ "@SSID_N2@" = {
+ hidden = true;
+ psk = "@PSK_N2@";
+ };
+ "@SSID_N3@".psk = "@PSK_N3@";
+ "@SSID_N4@" = {
+ auth = ''
+ proto=RSN
+ key_mgmt=WPA-EAP
+ pairwise=CCMP
+ auth_alg=OPEN
+ eap=PEAP
+ identity="@IDENTITY_N4@"
+ password="@PSK_N4@"
+ ca_cert="${self}/files/DNSX-CA.pem"
+ '';
+ };
+ "@SSID_N5@".psk = "@PSK_N5@";
};
- "@SSID_N3@".psk = "@PSK_N3@";
- "@SSID_N4@" = {
- auth = ''
- proto=RSN
- key_mgmt=WPA-EAP
- pairwise=CCMP
- auth_alg=OPEN
- eap=PEAP
- identity="@IDENTITY_N4@"
- password="@PSK_N4@"
- ca_cert="${self}/files/DNSX-CA.pem"
- '';
+ userControlled = {
+ enable = true;
+ group = "wheel"; # TODO: Change this?
};
- "@SSID_N5@".psk = "@PSK_N5@";
- };
- userControlled = {
- enable = true;
- group = "wheel"; # TODO: Change this?
};
};
};
diff --git a/modules/nixos/sils/roles.nix b/modules/nixos/sils/roles.nix
index 73edf85..811c0ea 100644
--- a/modules/nixos/sils/roles.nix
+++ b/modules/nixos/sils/roles.nix
@@ -5,6 +5,7 @@ in {
if roleCmp "laptop"
then {
basesystem.enable = true;
+ networking.enable = true;
nix-config.enable = true;
plymouth.enable = true;
theming.enable = true;