net
This commit is contained in:
@@ -49,8 +49,35 @@ let
|
||||
psk = profile.psk;
|
||||
};
|
||||
};
|
||||
|
||||
userProfiles = mapAttrs' make cfg.networkmanager.profiles;
|
||||
|
||||
# When using manual IP with NM enabled, auto-generate an ethernet profile
|
||||
# so NM actually assigns the static address (not just DHCP).
|
||||
ethernetProfile =
|
||||
optionalAttrs (cfg.ipv4.method == "manual" && cfg.ipv4.interface != "" && cfg.networkmanager.enable)
|
||||
{
|
||||
"static-${cfg.ipv4.interface}" = {
|
||||
connection = {
|
||||
id = "static-${cfg.ipv4.interface}";
|
||||
type = "ethernet";
|
||||
autoconnect = true;
|
||||
interface-name = cfg.ipv4.interface;
|
||||
};
|
||||
ipv4 = {
|
||||
method = "manual";
|
||||
address = cfg.ipv4.address;
|
||||
gateway = cfg.ipv4.gateway;
|
||||
dns = cfg.ipv4.dns;
|
||||
};
|
||||
ipv6 = {
|
||||
addr-gen-mode = "stable-privacy";
|
||||
method = "auto";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
mapAttrs' make cfg.networkmanager.profiles;
|
||||
userProfiles // ethernetProfile;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -173,8 +200,8 @@ in
|
||||
networkmanager-vpnc
|
||||
];
|
||||
|
||||
# Configure WiFi profiles if any are defined
|
||||
ensureProfiles = mkIf (cfg.networkmanager.profiles != { }) {
|
||||
# Configure profiles if any are defined
|
||||
ensureProfiles = mkIf (profiles != { }) {
|
||||
environmentFiles = lib.optional (config.sops.secrets ? wifi) config.sops.secrets.wifi.path;
|
||||
profiles = profiles;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user