services/enthalpy: dedup enthalpy configuration
This commit is contained in:
parent
a4549f7052
commit
f1ad024cd7
|
@ -6,20 +6,11 @@
|
|||
}:
|
||||
{
|
||||
imports = with profiles; [
|
||||
services.enthalpy
|
||||
services.enthalpy.customer
|
||||
];
|
||||
|
||||
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 = {
|
||||
enable = true;
|
||||
wait-online.anyInterface = true;
|
||||
|
|
|
@ -1,34 +1,17 @@
|
|||
{
|
||||
config,
|
||||
profiles,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = with profiles; [
|
||||
services.enthalpy
|
||||
services.enthalpy.customer-dualstack
|
||||
services.enthalpy.fw-proxy
|
||||
];
|
||||
|
||||
services.enthalpy = {
|
||||
ipsec.interfaces = [ "enp14s0" ];
|
||||
clat = {
|
||||
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" ];
|
||||
clat.segment = lib.singleton "fde3:3be3:a244:2676::2";
|
||||
};
|
||||
|
||||
systemd.network = {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
config,
|
||||
profiles,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = with profiles; [
|
||||
services.enthalpy
|
||||
services.enthalpy.customer-dualstack
|
||||
services.enthalpy.fw-proxy
|
||||
];
|
||||
|
||||
services.enthalpy = {
|
||||
|
@ -14,24 +14,7 @@
|
|||
interfaces = [ "wlan0" ];
|
||||
whitelist = [ "rebmit's edge network" ];
|
||||
};
|
||||
clat = {
|
||||
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" ];
|
||||
clat.segment = lib.singleton "fde3:3be3:a244:2676::2";
|
||||
};
|
||||
|
||||
systemd.network = {
|
||||
|
|
|
@ -1,28 +1,10 @@
|
|||
{
|
||||
profiles,
|
||||
data,
|
||||
...
|
||||
}:
|
||||
{ profiles, ... }:
|
||||
{
|
||||
imports = with profiles; [
|
||||
services.enthalpy
|
||||
services.enthalpy.transit-dualstack
|
||||
];
|
||||
|
||||
services.enthalpy = {
|
||||
ipsec.interfaces = [ "enp3s0" ];
|
||||
exit = {
|
||||
enable = true;
|
||||
prefix = [
|
||||
{
|
||||
type = "bird";
|
||||
destination = "::/0";
|
||||
source = data.enthalpy_network_prefix;
|
||||
}
|
||||
];
|
||||
};
|
||||
srv6.enable = true;
|
||||
nat64.enable = true;
|
||||
};
|
||||
services.enthalpy.ipsec.interfaces = [ "enp3s0" ];
|
||||
|
||||
networking.nftables.tables.nat = {
|
||||
family = "inet";
|
||||
|
|
|
@ -73,7 +73,7 @@ in
|
|||
|
||||
networking.nftables = {
|
||||
enable = true;
|
||||
tables.enthalpy4 = {
|
||||
tables.enthalpy-nat64 = {
|
||||
family = "ip";
|
||||
content = ''
|
||||
chain forward {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
data,
|
||||
hostData,
|
||||
self,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
@ -37,4 +38,13 @@
|
|||
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