2024-03-05 22:57:41 +01:00
|
|
|
{lib, ...}: {
|
2023-08-12 02:13:50 +02:00
|
|
|
networking = {
|
2023-08-25 00:57:42 +02:00
|
|
|
# It's a little too much to define every WiFi network declaratively.
|
|
|
|
# Instead, we enable NetworkManager and the nmtui interface.
|
2023-08-12 02:13:50 +02:00
|
|
|
networkmanager = {
|
|
|
|
enable = true;
|
2024-04-05 01:07:48 +02:00
|
|
|
dns = lib.mkForce "none"; # see modules/base/network.nix
|
2023-08-12 02:13:50 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-08-25 00:59:39 +02:00
|
|
|
# Allow our user to configure the network
|
2024-04-06 01:20:19 +02:00
|
|
|
users.groups.networkmanager.members = ["caspervk"];
|
2023-08-25 00:59:39 +02:00
|
|
|
|
|
|
|
# Persist WiFi passwords and other network configuration
|
|
|
|
environment.persistence."/nix/persist" = {
|
|
|
|
directories = [
|
2024-03-05 22:57:41 +01:00
|
|
|
{
|
|
|
|
directory = "/etc/NetworkManager/system-connections";
|
|
|
|
user = "root";
|
|
|
|
group = "root";
|
|
|
|
mode = "0700";
|
|
|
|
}
|
2023-08-25 00:59:39 +02:00
|
|
|
];
|
|
|
|
};
|
2023-12-13 20:25:40 +01:00
|
|
|
|
|
|
|
# systemd-networkd-wait-online can timeout and fail if there are no network
|
|
|
|
# interfaces available for it to manage. When systemd-networkd is enabled but
|
|
|
|
# a different service is responsible for managing the system's internet
|
|
|
|
# connection (for example, NetworkManager), this service is unnecessary and
|
|
|
|
# can be disabled.
|
|
|
|
# https://search.nixos.org/options?channel=23.11&show=systemd.network.wait-online.enable
|
|
|
|
systemd.network.wait-online.enable = false;
|
2023-08-12 02:13:50 +02:00
|
|
|
}
|