services/enthalpy: dedup enthalpy configuration
This commit is contained in:
parent
a4549f7052
commit
f1ad024cd7
|
@ -6,20 +6,11 @@
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
imports = with profiles; [
|
imports = with profiles; [
|
||||||
services.enthalpy
|
services.enthalpy.customer
|
||||||
];
|
];
|
||||||
|
|
||||||
services.enthalpy.ipsec.interfaces = [ "enp2s0" ];
|
services.enthalpy.ipsec.interfaces = [ "enp2s0" ];
|
||||||
|
|
||||||
networking.netns.enthalpy.forwardPorts = [
|
|
||||||
{
|
|
||||||
protocol = "tcp";
|
|
||||||
netns = "default";
|
|
||||||
source = "[::]:${toString config.networking.ports.ssh}";
|
|
||||||
target = "[::]:${toString config.networking.ports.ssh}";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
enable = true;
|
enable = true;
|
||||||
wait-online.anyInterface = true;
|
wait-online.anyInterface = true;
|
||||||
|
|
|
@ -1,34 +1,17 @@
|
||||||
{
|
{
|
||||||
config,
|
|
||||||
profiles,
|
profiles,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
imports = with profiles; [
|
imports = with profiles; [
|
||||||
services.enthalpy
|
services.enthalpy.customer-dualstack
|
||||||
|
services.enthalpy.fw-proxy
|
||||||
];
|
];
|
||||||
|
|
||||||
services.enthalpy = {
|
services.enthalpy = {
|
||||||
ipsec.interfaces = [ "enp14s0" ];
|
ipsec.interfaces = [ "enp14s0" ];
|
||||||
clat = {
|
clat.segment = lib.singleton "fde3:3be3:a244:2676::2";
|
||||||
enable = true;
|
|
||||||
segment = lib.singleton "fde3:3be3:a244:2676::2";
|
|
||||||
};
|
|
||||||
gost.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services.nix-daemon = {
|
|
||||||
serviceConfig = config.networking.netns.enthalpy.serviceConfig;
|
|
||||||
after = [ "netns-enthalpy.service" ];
|
|
||||||
requires = [ "netns-enthalpy.service" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services."user@${toString config.users.users.rebmit.uid}" = {
|
|
||||||
overrideStrategy = "asDropin";
|
|
||||||
serviceConfig = config.networking.netns.enthalpy.serviceConfig;
|
|
||||||
after = [ "netns-enthalpy.service" ];
|
|
||||||
requires = [ "netns-enthalpy.service" ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
config,
|
|
||||||
profiles,
|
profiles,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
imports = with profiles; [
|
imports = with profiles; [
|
||||||
services.enthalpy
|
services.enthalpy.customer-dualstack
|
||||||
|
services.enthalpy.fw-proxy
|
||||||
];
|
];
|
||||||
|
|
||||||
services.enthalpy = {
|
services.enthalpy = {
|
||||||
|
@ -14,24 +14,7 @@
|
||||||
interfaces = [ "wlan0" ];
|
interfaces = [ "wlan0" ];
|
||||||
whitelist = [ "rebmit's edge network" ];
|
whitelist = [ "rebmit's edge network" ];
|
||||||
};
|
};
|
||||||
clat = {
|
clat.segment = lib.singleton "fde3:3be3:a244:2676::2";
|
||||||
enable = true;
|
|
||||||
segment = lib.singleton "fde3:3be3:a244:2676::2";
|
|
||||||
};
|
|
||||||
gost.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services.nix-daemon = {
|
|
||||||
serviceConfig = config.networking.netns.enthalpy.serviceConfig;
|
|
||||||
after = [ "netns-enthalpy.service" ];
|
|
||||||
requires = [ "netns-enthalpy.service" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services."user@${toString config.users.users.rebmit.uid}" = {
|
|
||||||
overrideStrategy = "asDropin";
|
|
||||||
serviceConfig = config.networking.netns.enthalpy.serviceConfig;
|
|
||||||
after = [ "netns-enthalpy.service" ];
|
|
||||||
requires = [ "netns-enthalpy.service" ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
|
|
|
@ -1,28 +1,10 @@
|
||||||
{
|
{ profiles, ... }:
|
||||||
profiles,
|
|
||||||
data,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
{
|
||||||
imports = with profiles; [
|
imports = with profiles; [
|
||||||
services.enthalpy
|
services.enthalpy.transit-dualstack
|
||||||
];
|
];
|
||||||
|
|
||||||
services.enthalpy = {
|
services.enthalpy.ipsec.interfaces = [ "enp3s0" ];
|
||||||
ipsec.interfaces = [ "enp3s0" ];
|
|
||||||
exit = {
|
|
||||||
enable = true;
|
|
||||||
prefix = [
|
|
||||||
{
|
|
||||||
type = "bird";
|
|
||||||
destination = "::/0";
|
|
||||||
source = data.enthalpy_network_prefix;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
srv6.enable = true;
|
|
||||||
nat64.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.nftables.tables.nat = {
|
networking.nftables.tables.nat = {
|
||||||
family = "inet";
|
family = "inet";
|
||||||
|
|
|
@ -73,7 +73,7 @@ in
|
||||||
|
|
||||||
networking.nftables = {
|
networking.nftables = {
|
||||||
enable = true;
|
enable = true;
|
||||||
tables.enthalpy4 = {
|
tables.enthalpy-nat64 = {
|
||||||
family = "ip";
|
family = "ip";
|
||||||
content = ''
|
content = ''
|
||||||
chain forward {
|
chain forward {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
data,
|
data,
|
||||||
hostData,
|
hostData,
|
||||||
self,
|
self,
|
||||||
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
@ -37,4 +38,13 @@
|
||||||
routerId = hostData.enthalpy_node_id;
|
routerId = hostData.enthalpy_node_id;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
networking.netns.enthalpy.forwardPorts = lib.optionals config.services.openssh.enable [
|
||||||
|
{
|
||||||
|
protocol = "tcp";
|
||||||
|
netns = "default";
|
||||||
|
source = "[::]:${toString config.networking.ports.ssh}";
|
||||||
|
target = "[::]:${toString config.networking.ports.ssh}";
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
8
nixos/profiles/services/enthalpy/customer-dualstack.nix
Normal file
8
nixos/profiles/services/enthalpy/customer-dualstack.nix
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{ profiles, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
profiles.services.enthalpy.customer
|
||||||
|
];
|
||||||
|
|
||||||
|
services.enthalpy.clat.enable = true;
|
||||||
|
}
|
6
nixos/profiles/services/enthalpy/customer.nix
Normal file
6
nixos/profiles/services/enthalpy/customer.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{ profiles, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
profiles.services.enthalpy.common
|
||||||
|
];
|
||||||
|
}
|
17
nixos/profiles/services/enthalpy/fw-proxy.nix
Normal file
17
nixos/profiles/services/enthalpy/fw-proxy.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
services.enthalpy.gost.enable = true;
|
||||||
|
|
||||||
|
systemd.services.nix-daemon = {
|
||||||
|
inherit (config.networking.netns.enthalpy) serviceConfig;
|
||||||
|
after = [ "netns-enthalpy.service" ];
|
||||||
|
requires = [ "netns-enthalpy.service" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services."user@${toString config.users.users.rebmit.uid}" = {
|
||||||
|
inherit (config.networking.netns.enthalpy) serviceConfig;
|
||||||
|
overrideStrategy = "asDropin";
|
||||||
|
after = [ "netns-enthalpy.service" ];
|
||||||
|
requires = [ "netns-enthalpy.service" ];
|
||||||
|
};
|
||||||
|
}
|
11
nixos/profiles/services/enthalpy/transit-dualstack.nix
Normal file
11
nixos/profiles/services/enthalpy/transit-dualstack.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{ profiles, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
profiles.services.enthalpy.transit
|
||||||
|
];
|
||||||
|
|
||||||
|
services.enthalpy = {
|
||||||
|
srv6.enable = true;
|
||||||
|
nat64.enable = true;
|
||||||
|
};
|
||||||
|
}
|
20
nixos/profiles/services/enthalpy/transit.nix
Normal file
20
nixos/profiles/services/enthalpy/transit.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
profiles,
|
||||||
|
lib,
|
||||||
|
data,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
profiles.services.enthalpy.common
|
||||||
|
];
|
||||||
|
|
||||||
|
services.enthalpy.exit = {
|
||||||
|
enable = true;
|
||||||
|
prefix = lib.singleton {
|
||||||
|
type = "bird";
|
||||||
|
destination = "::/0";
|
||||||
|
source = data.enthalpy_network_prefix;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue