Update containers

This commit is contained in:
albert 2024-04-05 13:54:07 +09:00
parent ee9c452083
commit 98ab0aa25e
No known key found for this signature in database
GPG key ID: 64F6C4EB46C4543A
2 changed files with 8 additions and 39 deletions

View file

@ -3,23 +3,17 @@
./${hostname}
../users/${username}
../common/modules/nixos.nix
../common/modules/networking.nix
# ,../common/modules/networking.nix
# Services
../common/services/promtail.nix
../common/services/telegraf.nix
../common/services/tailscale.nix
../common/services/openssh.nix
];
boot.isContainer = true;
networking.hostName = "${hostname}";
system.stateVersion = stateVersion;
# Workaround for bug https://github.com/NixOS/nixpkgs/issues/162686
# networking.useHostResolvConf = lib.mkForce false;
# services.resolved.enable = true;
networking.defaultGateway = "192.168.2.1";
networking.hostName = "${hostname}";
# Set up the secrets file:
sops.secrets."tailscale_key" = {
@ -31,30 +25,7 @@
];
};
services.tailscale.enable = true;
services.tailscale.authKeyFile = "/run/secrets/tailscale_key";
systemd.services.tailscaled.enable = lib.mkForce false;
services.tailscale = {
enable = true;
interfaceName = "tailscale0-${hostname}";
extraUpFlags = [
"--login-server=https://headscale.sysctl.io"
"--accept-dns"
"--accept-routes"
];
};
systemd.services = {
"tailscaled-custom" = {
enable = true;
path = [ pkgs.tailscale ];
script = ''tailscaled -no-logs-no-support -tun=userspace'';
after = [ "network.target" ];
wantedBy = [ "tailscaled-autoconnect.service" ];
serviceConfig.Restart = "on-failure";
serviceConfig.Type = "oneshot";
serviceConfig.User = "root";
serviceConfig.Group = "wheel";
};
};
services.tailscale.interfaceName = "userspace-networking";
}

View file

@ -8,11 +8,9 @@ in {
};
networking = {
networkmanager.unmanaged = [ "interface-name:ve-*" ];
nat = {
enable = true;
externalInterface = lanInterface;
internalInterfaces = [ "ve-+" ];
};
nat.enable = true;
nat.internalInterfaces = [ "ve-+" ];
nat.externalInterface = lanInterface;
firewall.extraCommands = ''iptables -t nat -A POSTROUTING -o ${lanInterface} -j MASQUERADE'';
};
}