Desktop/networkManager: refactor
This commit is contained in:
parent
8c6fdd5b51
commit
7277135a5b
3 changed files with 29 additions and 23 deletions
|
|
@ -4,5 +4,6 @@ nixpkgs.lib.extend (final: prev: {
|
|||
importLib = file: import file {lib = final;};
|
||||
in {
|
||||
patches = importLib ./patches.nix;
|
||||
networkManager = importLib ./networkManager.nix;
|
||||
};
|
||||
})
|
||||
|
|
|
|||
18
lib/networkManager.nix
Normal file
18
lib/networkManager.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{lib}: {
|
||||
/**
|
||||
Make a NetworkManager wifi profile, to be used with ensureProfiles
|
||||
*/
|
||||
mkWifiProfile = {id, ssid, priority ? 0, wifi-security}: {
|
||||
connection = {
|
||||
inherit id;
|
||||
type = "wifi";
|
||||
autoconnect-priority = priority;
|
||||
};
|
||||
ipv4.method = "auto";
|
||||
wifi = {
|
||||
mode = "infrastructure";
|
||||
inherit ssid;
|
||||
};
|
||||
inherit wifi-security;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
flakeSelf,
|
||||
...
|
||||
}: let
|
||||
|
|
@ -16,35 +17,21 @@ in {
|
|||
];
|
||||
ensureProfiles = {
|
||||
environmentFiles = [config.sops.secrets.wifiPasswords.path];
|
||||
profiles = {
|
||||
"4g-modem" = {
|
||||
connection = {
|
||||
profiles = with lib.toast.networkManager; {
|
||||
"4g-modem" = mkWifiProfile {
|
||||
id = "4G Modem";
|
||||
type = "wifi";
|
||||
autoconnect-priority = 5;
|
||||
};
|
||||
ipv4.method = "auto";
|
||||
wifi = {
|
||||
mode = "infrastructure";
|
||||
priority = 5;
|
||||
ssid = "TP-Link_CCB4";
|
||||
};
|
||||
wifi-security = {
|
||||
auth-alg = "open";
|
||||
key-mgmt = "wpa-psk";
|
||||
psk = "$MODEM";
|
||||
};
|
||||
};
|
||||
phone = {
|
||||
connection = {
|
||||
phone = mkWifiProfile {
|
||||
id = "Phone";
|
||||
type = "wifi";
|
||||
autoconnect-priority = 5;
|
||||
};
|
||||
ipv4.method = "auto";
|
||||
wifi = {
|
||||
mode = "infrastructure";
|
||||
priority = 5;
|
||||
ssid = "Redmi Note 10 Pro_5197";
|
||||
};
|
||||
wifi-security = {
|
||||
auth-alg = "open";
|
||||
key-mgmt = "sae";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue