diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2026-05-14 22:00:50 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2026-05-14 22:00:50 +0530 |
| commit | 74d75a040d1a30e44737aec5afb5dacc67ebdb82 (patch) | |
| tree | a20106771706d5afe73c2e18aa4d1b8c1fdd9a81 | |
| parent | cd88149245daf8ee8b93bb1cc84e2ab391cc2a1d (diff) | |
VMs + broken tailscale
| -rw-r--r-- | flake.nix | 2 | ||||
| -rw-r--r-- | nixos/apps/browser.nix | 1 | ||||
| -rw-r--r-- | nixos/environment.nix | 4 | ||||
| -rw-r--r-- | nixos/games/default.nix | 3 | ||||
| -rw-r--r-- | nixos/home.nix | 14 | ||||
| -rw-r--r-- | nixos/opt/default.nix | 2 | ||||
| -rw-r--r-- | nixos/opt/tailscale.nix | 24 | ||||
| -rw-r--r-- | nixos/opt/vm.nix | 18 |
8 files changed, 64 insertions, 4 deletions
@@ -36,6 +36,8 @@ hostname = "pegasus"; opt = { nvidia = true; + tailscale = false; + vm = true; llm = true; }; languages = { diff --git a/nixos/apps/browser.nix b/nixos/apps/browser.nix index 52456e8..95d43dc 100644 --- a/nixos/apps/browser.nix +++ b/nixos/apps/browser.nix @@ -7,7 +7,6 @@ value = "zen-browser.desktop"; associations = { - "application/pdf" = "org.kde.okular.desktop"; } // builtins.listToAttrs (map (name: { inherit name value; }) [ diff --git a/nixos/environment.nix b/nixos/environment.nix index b575b96..c8a6f5d 100644 --- a/nixos/environment.nix +++ b/nixos/environment.nix @@ -30,6 +30,7 @@ tokei wiki-tui bluetui + tdf fastfetch pipes @@ -70,4 +71,7 @@ dejavu_fonts nerd-fonts.jetbrains-mono ]; + xdg.mime.defaultApplications = { + "application/pdf" = "org.kde.okular.desktop"; + }; } diff --git a/nixos/games/default.nix b/nixos/games/default.nix index 5894464..d54cae2 100644 --- a/nixos/games/default.nix +++ b/nixos/games/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, games, ... }: +{ config, unstable, pkgs, games, ... }: { imports = (if games.minecraft then [ ./minecraft.nix ] else []); @@ -8,6 +8,7 @@ proton-ge-bin ]; environment.systemPackages = with pkgs; [ + lutris steam-run mangohud freetype diff --git a/nixos/home.nix b/nixos/home.nix index ede2a2f..6271724 100644 --- a/nixos/home.nix +++ b/nixos/home.nix @@ -1,4 +1,4 @@ -{ config, pkgs, username, terminalworkspace, ... }: +{ config, pkgs, username, terminalworkspace, opt, ... }: { users.users.${username} = { isNormalUser = true; @@ -83,7 +83,17 @@ end scrcpy="scrcpy --render-driver=opengl"; wisdom="fortune ~/.config/fortune/showerthoughts | cowsay | lolcat"; search="rg --color=always --line-number --no-heading \"\" | fzf --ansi --phony --query \"\" --bind \"change:reload(rg --color=always --line-number --no-heading {q} || true)\""; - }; + } // (if opt.vm then { + vm = '' + if test "$(virsh --connect qemu:///system domstate ubuntu25.10)" != "running" + virsh --connect qemu:///system start ubuntu25.10 + sleep 5 + end + + ssh vm@192.168.122.232 + ''; + vmstop = "virsh --connect qemu:///system shutdown ubuntu25.10"; + } else {}); }; environment.systemPackages = with pkgs; [ nushell 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 + ''; +} |
