2022-12-31 07:24:17 +01:00
|
|
|
{ config, lib, ... }:
|
2021-03-06 08:27:39 +01:00
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.networking.nix-community;
|
2022-08-14 16:49:30 +02:00
|
|
|
in
|
|
|
|
{
|
2021-03-06 08:27:39 +01:00
|
|
|
options = {
|
|
|
|
networking.nix-community.ipv6.address = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
|
|
|
|
networking.nix-community.ipv6.cidr = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "64";
|
|
|
|
};
|
|
|
|
|
|
|
|
networking.nix-community.ipv6.gateway = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "fe80::1";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
networking.usePredictableInterfaceNames = false;
|
|
|
|
networking.dhcpcd.enable = false;
|
2022-07-14 07:15:25 +02:00
|
|
|
# Don't take down the network for too long, this will use `systemctl
|
|
|
|
# restart` rather than stopping it with `systemctl stop` followed by a
|
|
|
|
# delayed `systemctl start`
|
|
|
|
systemd.services.systemd-networkd.stopIfChanged = true;
|
|
|
|
|
2021-03-06 08:27:39 +01:00
|
|
|
systemd.network = {
|
|
|
|
enable = true;
|
2021-03-24 18:09:23 +01:00
|
|
|
networks."ethernet".extraConfig = ''
|
2021-03-06 08:27:39 +01:00
|
|
|
[Match]
|
2021-03-24 18:09:23 +01:00
|
|
|
Type = ether
|
2021-03-06 08:27:39 +01:00
|
|
|
[Network]
|
2021-03-24 18:09:23 +01:00
|
|
|
DHCP = ipv4
|
2021-03-06 08:27:39 +01:00
|
|
|
Address = ${cfg.ipv6.address}/${cfg.ipv6.cidr}
|
|
|
|
Gateway = ${cfg.ipv6.gateway}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|