mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
feat(hakurei): exit
This commit is contained in:
parent
2039fd8cb6
commit
3c1d233b4e
3 changed files with 10 additions and 3 deletions
|
|
@ -46,13 +46,19 @@ in {
|
||||||
fixResolved = optionalString config.services.resolved.enable ''
|
fixResolved = optionalString config.services.resolved.enable ''
|
||||||
resolvectl revert ${config.services.tailscale.interfaceName} || true
|
resolvectl revert ${config.services.tailscale.interfaceName} || true
|
||||||
'';
|
'';
|
||||||
advertiseExitNode = optionalString cfg.advertiseExitNode " --advertise-exit-node";
|
# https://tailscale.com/kb/1320/performance-best-practices#ethtool-configuration
|
||||||
|
exitNodeRouting = optionalString cfg.advertiseExitNode ''
|
||||||
|
netdev=$(${pkgs.iproute2}/bin/ip route show 0/0 | ${pkgs.coreutils}/bin/cut -f5 -d' ' || echo eth0)
|
||||||
|
${getExe pkgs.ethtool} -K "$netdev" rx-udp-gro-forwarding on rx-gro-list off || true
|
||||||
|
'';
|
||||||
|
advertiseExitNode = "--advertise-exit-node" + optionalString (!cfg.advertiseExitNode) "=false";
|
||||||
in
|
in
|
||||||
with pkgs; ''
|
with pkgs; ''
|
||||||
# wait for tailscaled to settle
|
# wait for tailscaled to settle
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
${fixResolved}
|
${fixResolved}
|
||||||
|
${exitNodeRouting}
|
||||||
|
|
||||||
# check if we are already authenticated to tailscale
|
# check if we are already authenticated to tailscale
|
||||||
status="$(${getExe tailscale} status -json | ${getExe jq} -r .BackendState)"
|
status="$(${getExe tailscale} status -json | ${getExe jq} -r .BackendState)"
|
||||||
|
|
@ -62,7 +68,7 @@ in {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# otherwise authenticate with tailscale
|
# otherwise authenticate with tailscale
|
||||||
${getExe tailscale} up${advertiseExitNode} -authkey $(cat ${config.sops.secrets.tailscale-key.path})
|
${getExe tailscale} up ${advertiseExitNode} -authkey $(cat ${config.sops.secrets.tailscale-key.path})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,8 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.tailscale.advertiseExitNode = true;
|
||||||
|
|
||||||
systemd.network.networks.eth0 = {
|
systemd.network.networks.eth0 = {
|
||||||
name = "eth0";
|
name = "eth0";
|
||||||
matchConfig = {
|
matchConfig = {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
services.kanidm.serverSettings.db_fs_type = "zfs";
|
services.kanidm.serverSettings.db_fs_type = "zfs";
|
||||||
services.tailscale.advertiseExitNode = true;
|
|
||||||
services.postgresql.package = pkgs.postgresql_14;
|
services.postgresql.package = pkgs.postgresql_14;
|
||||||
|
|
||||||
sops.defaultSopsFile = ./secrets.yaml;
|
sops.defaultSopsFile = ./secrets.yaml;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue