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;};
|
importLib = file: import file {lib = final;};
|
||||||
in {
|
in {
|
||||||
patches = importLib ./patches.nix;
|
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,
|
config,
|
||||||
|
lib,
|
||||||
flakeSelf,
|
flakeSelf,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
|
@ -16,35 +17,21 @@ in {
|
||||||
];
|
];
|
||||||
ensureProfiles = {
|
ensureProfiles = {
|
||||||
environmentFiles = [config.sops.secrets.wifiPasswords.path];
|
environmentFiles = [config.sops.secrets.wifiPasswords.path];
|
||||||
profiles = {
|
profiles = with lib.toast.networkManager; {
|
||||||
"4g-modem" = {
|
"4g-modem" = mkWifiProfile {
|
||||||
connection = {
|
id = "4G Modem";
|
||||||
id = "4G Modem";
|
priority = 5;
|
||||||
type = "wifi";
|
ssid = "TP-Link_CCB4";
|
||||||
autoconnect-priority = 5;
|
|
||||||
};
|
|
||||||
ipv4.method = "auto";
|
|
||||||
wifi = {
|
|
||||||
mode = "infrastructure";
|
|
||||||
ssid = "TP-Link_CCB4";
|
|
||||||
};
|
|
||||||
wifi-security = {
|
wifi-security = {
|
||||||
auth-alg = "open";
|
auth-alg = "open";
|
||||||
key-mgmt = "wpa-psk";
|
key-mgmt = "wpa-psk";
|
||||||
psk = "$MODEM";
|
psk = "$MODEM";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
phone = {
|
phone = mkWifiProfile {
|
||||||
connection = {
|
id = "Phone";
|
||||||
id = "Phone";
|
priority = 5;
|
||||||
type = "wifi";
|
ssid = "Redmi Note 10 Pro_5197";
|
||||||
autoconnect-priority = 5;
|
|
||||||
};
|
|
||||||
ipv4.method = "auto";
|
|
||||||
wifi = {
|
|
||||||
mode = "infrastructure";
|
|
||||||
ssid = "Redmi Note 10 Pro_5197";
|
|
||||||
};
|
|
||||||
wifi-security = {
|
wifi-security = {
|
||||||
auth-alg = "open";
|
auth-alg = "open";
|
||||||
key-mgmt = "sae";
|
key-mgmt = "sae";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue