Compare commits
No commits in common. "3247d1edec6bd4b5958c7a67c8202311162b046a" and "0c29d4c6fc2d7350cb80a95d7827dadd2b4350df" have entirely different histories.
3247d1edec
...
0c29d4c6fc
3 changed files with 11 additions and 76 deletions
|
@ -50,6 +50,7 @@
|
||||||
catppuccin = {
|
catppuccin = {
|
||||||
url = "github:catppuccin/nix";
|
url = "github:catppuccin/nix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.home-manager.follows = "home-manager";
|
||||||
};
|
};
|
||||||
|
|
||||||
disko = {
|
disko = {
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
neovim
|
neovim
|
||||||
jq
|
jq
|
||||||
iptables
|
iptables
|
||||||
nftables
|
ebtables
|
||||||
tcpdump
|
tcpdump
|
||||||
busybox
|
busybox
|
||||||
ethtool
|
ethtool
|
||||||
|
@ -88,53 +88,15 @@
|
||||||
|
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
networks."lan" = {
|
||||||
|
matchConfig.Name = "enu1";
|
||||||
|
networkConfig.DHCP = "no";
|
||||||
|
linkConfig.RequiredForOnline = "no";
|
||||||
|
};
|
||||||
networks."wan" = {
|
networks."wan" = {
|
||||||
matchConfig.Name = "end0";
|
matchConfig.Name = "end0";
|
||||||
networkConfig.DHCP = "yes";
|
networkConfig.DHCP = "yes";
|
||||||
linkConfig.RequiredForOnline = false;
|
linkConfig.RequiredForOnline = "yes";
|
||||||
};
|
|
||||||
networks."lan" = {
|
|
||||||
matchConfig.Name = "enu1";
|
|
||||||
networkConfig = {
|
|
||||||
DHCP = "no";
|
|
||||||
DHCPServer = "yes";
|
|
||||||
Address = "10.1.1.1/24";
|
|
||||||
};
|
|
||||||
dhcpServerConfig = {
|
|
||||||
ServerAddress = "10.1.1.1/24";
|
|
||||||
UplinkInterface = "end0";
|
|
||||||
EmitDNS = "yes";
|
|
||||||
DNS = [ "192.168.1.1" ];
|
|
||||||
};
|
|
||||||
linkConfig.RequiredForOnline = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.firewall.enable = false;
|
|
||||||
networking.nftables = {
|
|
||||||
enable = true;
|
|
||||||
tables = {
|
|
||||||
filter = {
|
|
||||||
family = "inet";
|
|
||||||
content = ''
|
|
||||||
chain forward {
|
|
||||||
iifname { "enu1" } oifname { "end0" } accept comment "Allow trusted LAN to WAN"
|
|
||||||
iifname { "end0" } oifname { "enu1" } ct state { established, related } accept comment "Allow established back to LANs"
|
|
||||||
iifname { "enu1" } oifname { "tailscale0" } accept comment "Allow LAN to Tailscale"
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
nat = {
|
|
||||||
family = "ip";
|
|
||||||
content = ''
|
|
||||||
chain postrouting {
|
|
||||||
type nat hook postrouting priority 100; policy accept;
|
|
||||||
oifname "end0" masquerade
|
|
||||||
oifname "tailscale0" masquerade
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -143,11 +105,7 @@
|
||||||
configFile = "/var/lib/dae/config.dae";
|
configFile = "/var/lib/dae/config.dae";
|
||||||
};
|
};
|
||||||
|
|
||||||
services.tailscale = {
|
services.tailscale.enable = true;
|
||||||
enable = true;
|
|
||||||
extraSetFlags = [
|
|
||||||
"--advertise-routes=10.1.1.0/24"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) mkIf getExe;
|
inherit (lib) mkIf concatStringsSep;
|
||||||
inherit (config.my-lib.settings) prometheusCollectors;
|
inherit (config.my-lib.settings) prometheusCollectors;
|
||||||
cfg = config.custom.prometheus.exporters;
|
cfg = config.custom.prometheus.exporters;
|
||||||
in
|
in
|
||||||
|
@ -16,30 +16,6 @@ in
|
||||||
++ (lib.optional cfg.blackbox.enable "prometheus-blackbox-exporters.service")
|
++ (lib.optional cfg.blackbox.enable "prometheus-blackbox-exporters.service")
|
||||||
++ (lib.optional config.services.caddy.enable "caddy.service");
|
++ (lib.optional config.services.caddy.enable "caddy.service");
|
||||||
|
|
||||||
systemd.services.tailscaled.serviceConfig.ExecStartPost =
|
|
||||||
pkgs.writers.writePython3Bin "tailscale-wait-online"
|
|
||||||
{
|
|
||||||
flakeIgnore = [
|
|
||||||
"E401" # import on one line
|
|
||||||
"E501" # line length limit
|
|
||||||
];
|
|
||||||
}
|
|
||||||
''
|
|
||||||
import subprocess, json, time
|
|
||||||
|
|
||||||
for _ in range(30):
|
|
||||||
status = json.loads(
|
|
||||||
subprocess.run(
|
|
||||||
["${getExe config.services.tailscale.package}", "status", "--peers=false", "--json"], capture_output=True
|
|
||||||
).stdout
|
|
||||||
)["Self"]["Online"]
|
|
||||||
if status:
|
|
||||||
exit(0)
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
exit(1)
|
|
||||||
'';
|
|
||||||
|
|
||||||
services.prometheus.exporters.node = mkIf cfg.node.enable {
|
services.prometheus.exporters.node = mkIf cfg.node.enable {
|
||||||
enable = true;
|
enable = true;
|
||||||
enabledCollectors = [
|
enabledCollectors = [
|
||||||
|
|
Loading…
Add table
Reference in a new issue