diff options
Diffstat (limited to 'nixos/opt')
| -rw-r--r-- | nixos/opt/default.nix | 2 | ||||
| -rw-r--r-- | nixos/opt/tailscale.nix | 24 | ||||
| -rw-r--r-- | nixos/opt/vm.nix | 18 |
3 files changed, 44 insertions, 0 deletions
diff --git a/nixos/opt/default.nix b/nixos/opt/default.nix index 58a6dcf..86f4073 100644 --- a/nixos/opt/default.nix +++ b/nixos/opt/default.nix @@ -2,5 +2,7 @@ { imports = (if opt.nvidia then [ ./nvidia.nix ] else []) ++ + (if opt.tailscale then [ ./tailscale.nix ] else []) ++ + (if opt.vm then [ ./vm.nix ] else []) ++ (if opt.llm then [ ./llm.nix ] else []); } diff --git a/nixos/opt/tailscale.nix b/nixos/opt/tailscale.nix new file mode 100644 index 0000000..a14c93b --- /dev/null +++ b/nixos/opt/tailscale.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ... }: +{ + # 1. Enable the service and the firewall + services.tailscale.enable = true; + networking.nftables.enable = true; + networking.firewall = { + enable = true; + # Always allow traffic from your Tailscale network + trustedInterfaces = [ "tailscale0" ]; + # Allow the Tailscale UDP port through the firewall + allowedUDPPorts = [ config.services.tailscale.port ]; + }; + + # 2. Force tailscaled to use nftables (Critical for clean nftables-only systems) + # This avoids the "iptables-compat" translation layer issues. + systemd.services.tailscaled.serviceConfig.Environment = [ + "TS_DEBUG_FIREWALL_MODE=nftables" + ]; + + # 3. Optimization: Prevent systemd from waiting for network online + # (Optional but recommended for faster boot with VPNs) + systemd.network.wait-online.enable = false; + boot.initrd.systemd.network.wait-online.enable = false; +} diff --git a/nixos/opt/vm.nix b/nixos/opt/vm.nix new file mode 100644 index 0000000..0549b41 --- /dev/null +++ b/nixos/opt/vm.nix @@ -0,0 +1,18 @@ +{ config, pkgs, username, ... }: +{ + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + users.users.${username}.extraGroups = [ + "libvirtd" + ]; + + environment.systemPackages = with pkgs; [ + virt-manager + qemu + mkcert + ]; + + networking.extraHosts = '' + 192.168.122.232 home.arpa + ''; +} |
