diff --git a/system/common.nix b/system/common.nix index 5a9db90..aa67120 100644 --- a/system/common.nix +++ b/system/common.nix @@ -11,7 +11,6 @@ }: { imports = [ - ./declarative-nm.nix # ./vm.nix ./steam.nix ./networking.nix diff --git a/system/declarative-nm.nix b/system/declarative-nm.nix deleted file mode 100644 index c011896..0000000 --- a/system/declarative-nm.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -# from: https://discourse.nixos.org/t/imperative-declarative-wifi-networks-with-wpa-supplicant/12394/6 -let - cfg = config.networking.networkmanager; - - getFileName = lib.stringAsChars (x: if x == " " then "-" else x); - - createWifi = ssid: opt: { - name = "NetworkManager/system-connections/${getFileName ssid}.nmconnection"; - value = { - mode = "0400"; - source = pkgs.writeText "${ssid}.nmconnection" '' - [connection] - id=${ssid} - type=wifi - - [wifi] - ssid=${ssid} - - [wifi-security] - ${lib.optionalString (opt.psk != null) '' - key-mgmt=wpa-psk - psk=${opt.psk}''} - ''; - }; - }; - - keyFiles = lib.mapAttrs' createWifi config.networking.wireless.networks; -in -{ - config = lib.mkIf cfg.enable { - environment.etc = keyFiles; - - systemd.services.NetworkManager-predefined-connections = { - restartTriggers = lib.mapAttrsToList (name: value: value.source) keyFiles; - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - ExecStart = "${pkgs.coreutils}/bin/true"; - ExecReload = "${pkgs.networkmanager}/bin/nmcli connection reload"; - }; - reloadIfChanged = true; - wantedBy = [ "multi-user.target" ]; - }; - }; -} diff --git a/system/networking.nix b/system/networking.nix index 976aaa9..b47530e 100644 --- a/system/networking.nix +++ b/system/networking.nix @@ -19,8 +19,8 @@ # fix suspend issue powersave = false; }; - }; - wireless.networks = import ./secrets/wifi-passwords.nix; + ensureProfiles.profiles = import ./secrets/wifi-passwords.nix; + }; }; } diff --git a/system/secrets/wifi-passwords.nix b/system/secrets/wifi-passwords.nix index 42d15a5..f00fd26 100644 Binary files a/system/secrets/wifi-passwords.nix and b/system/secrets/wifi-passwords.nix differ