Commit graph

456 commits

Author SHA1 Message Date
3146745a1e Bump deps, fix crosvm pulseaudio-rs git URL 2026-03-16 17:13:56 +00:00
e976b3d05b Add KDE/Breeze theming infrastructure to base guest config
Move Qt platform theme setup (plasma-integration, breeze, breeze-gtk,
breeze-icons) into the base VM configuration so all guests get consistent
theming out of the box. Previously qt.platformTheme was set in
optionalGuestSettings but qt.enable was never set, so it had no effect.

optionalGuestSettings now only configures dark theme (BreezeDark color
scheme, Breeze-Dark GTK theme, breeze-dark icons) on top of the base.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 00:31:05 +00:00
1eb064d184 Fix dark theme broken by xdg-desktop-portal-kde
xdg-desktop-portal-kde reports color-scheme via org.freedesktop.appearance
by reading QApplication palette colors. Without a KDE dark color scheme in
kdeglobals, the portal reported "prefer-light", overriding the GTK dark
theme settings for Firefox and other apps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 00:24:12 +00:00
5674b9e149 Enable KDE xdg-desktop-portal in VMs 2026-03-12 17:36:49 +00:00
00c9994e01 Bump wayland-proxy-virtwl to fix segfault 2026-03-10 16:03:32 +00:00
823cc4750d Fix memory leak in wayland proxy 2026-03-08 15:24:13 +00:00
f3d8984b32 Fix idle watchdog PAM errors and premature auto-shutdown
The idle watchdog used `systemctl --user --machine=user@.host` which
internally spawns systemd-stdio-bridge requiring PAM session setup.
A broken pam_lastlog2.so caused this to fail every 5 seconds, spamming
the journal. Worse, the failed query returned empty output (ACTIVE=0),
so the watchdog never detected running commands and shut down VMs
prematurely based on idle time alone.

Fix by connecting to the user D-Bus socket directly (root can access it)
and adding pipefail + || continue so query failures skip the cycle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 09:36:58 +00:00
ebf28dfc00 Fix TAP interfaces stuck in "configuring" by enabling ConfigureWithoutCarrier
When a VM is not running, its TAP interface has no carrier, so networkd
refuses to assign static addresses (hostAddress) and the link gets stuck
in "configuring" state. This causes systemd-networkd-wait-online to block
for 2 minutes. Setting ConfigureWithoutCarrier=yes lets networkd assign
addresses immediately regardless of carrier state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 02:20:08 +00:00
0a07f7f14e Switch ephemeral overlay from qcow2 to raw sparse image
qcow2 causes O_DIRECT failures on ext4 due to crosvm doing unaligned
access when parsing the qcow2 header. Since we don't use any qcow2
features (the disk is created fresh and deleted on stop), a raw sparse
file via truncate works just as well and also removes the qemu package
dependency from the VM service.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:49:44 +00:00
b8646f3020 Fix networkd wait-online by setting RequiredForOnline=no on vmsilo units
The previous --ignore approach (6a28576) didn't prevent the timeout
because bridges stayed in "configuring" setup state waiting for IPv6
autoconfiguration that never arrives. Set RequiredForOnline=no,
IPv6AcceptRA=no and LinkLocalAddressing=no directly in the networkd
.network units for all vmsilo TAP and bridge interfaces.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 20:19:15 +00:00
3b0bbd088d Update docs and examples 2026-03-07 17:49:04 +00:00
6a285760cd Exclude vmsilo interfaces from networkd wait-online
Prevents systemd-networkd-wait-online.service from timing out when
vmsilo TAP/bridge interfaces are not up (VMs not running), which
was causing long delays during nixos-rebuild switch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 17:44:29 +00:00
1a1b368c46 Add colored borders for VM app and menu icons 2026-03-07 17:33:48 +00:00
12ba119ad6 desktop: pass vm.color as-is instead of resolving to hex
KDE natively supports both named colors and hex, so no need to
resolve on the Nix side.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 17:22:51 +00:00
91692c709b desktop: add X-VmSilo-Color to .desktop files
Emit the resolved VM color as an X-VmSilo-Color attribute in all
generated .desktop and .directory files, for kicker to draw colored
icon borders in the application menu.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 17:21:34 +00:00
a188977d38 Remove dead code and simplify helpers
- Remove unused ifIndexToIfName and sanitizeName from helpers.nix
- Deduplicate normalizeBdfLocal in extractBdf (reuse module-level normalizeBdf)
- Remove unused sharedHomePath variable in scripts.nix
- Fix "Packate" typo in overlay.nix comment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 16:34:52 +00:00
3b640b1662 netvm: support network.netvm = "host" for host-routed networking
Route VM traffic through the host directly instead of requiring a
separate netvm VM. Uses the same nftables NAT and forward firewall
rules as VM-based netvms, applied on the host using TAP interface
names. Removes the hostNetworking.nat options in favor of the
unified netvm approach.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:28:47 +00:00
f33abeace0 Update README.md and examples to use netvm config 2026-03-07 15:07:04 +00:00
61f6a746bf services: add implicit dependsOn for netvm
VMs with network.netvm now automatically pull in their netvm via
Wants=, ensuring the netvm starts when the client VM is started.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 14:39:01 +00:00
f66a97a29d Use networkd for networking.* on host
Making VM network changes doesn't reliably update bridge config with the old
scripted NixOS networking.
2026-03-07 14:31:39 +00:00
d36ff56de4 networking: add bridge interfaces to networking.interfaces for networkd
Under networkd, networking.bridges only generates .netdev and member
.network files but not a .network file for the bridge device itself.
Without a matching .network unit, networkd won't bring the bridge link
up. Add empty networking.interfaces entries for each bridge so networkd
manages them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 14:25:28 +00:00
bb1ab85237 netvm: add network.netvm/isNetvm convenience layer for auto VM-to-VM links
Adds network.netvm / network.isNetvm options that auto-configure
point-to-point VM networking (host bridge, TAP interfaces, guest IPs,
default routes, masquerade NAT, and forward firewall rules) without
manual interface configuration.

New options:
  programs.vmsilo.netvmRange         — IP pool for /31 auto-allocation (default 10.200.0.0/16)
  vm.network.isNetvm                  — mark VM as a network gateway
  vm.network.netvm                    — route this VM through a named netvm
  vm.network.netvmSubnet              — override auto-allocated /31 (pin specific address)

Architecture:
  modules/netvm.nix computes all (netvm, client) pairs and writes to
  _internal.netvmInjections to avoid infinite recursion in the module
  system. networking.nix, scripts.nix, and services.nix each have a
  getEffectiveInterfaces helper that merges user-configured and
  injected interfaces transparently.

  Guest nftables config (masquerade NAT, forward isolation between
  clients, ip_forward sysctl) is injected via _generatedGuestConfig
  and merged into the rootfs build in scripts.nix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 14:21:38 +00:00
1f8a628052 services: Start bridge netdev units before VM service
When a bridge is added to the config and nixos-rebuild switch is run,
the per-bridge netdev service is not started automatically because
network-setup.service is already active (RemainAfterExit). Add Wants
and After dependencies on <bridge>-netdev.service for each bridge used
by a VM's TAP interfaces so systemd starts it on demand when the VM
service starts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 23:26:24 +00:00
7444de0b16 assertions: Validate tap.name length and characters
Add assertion to check user-specified tap.name overrides against Linux
IFNAMSIZ constraints (max 15 chars, letter start, alphanumeric/hyphen/
underscore). Previously only guest-visible interface names were validated;
invalid tap.name values would only surface as runtime kernel errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 11:27:55 +00:00
85c88cfb33 Change nixosVms from list to attrset keyed by VM name
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 20:26:55 +00:00
cde2c3e727 crosvm: Add disable-msix option for PCI passthrough
Work around an annoying issue with the Intel AX210. It has a hardware bug
where the PCIe link will go into L1 before initialisation is complete. The
driver works around this by spamming read calls to an MSI-X register to keep
the link alive until firmware is ready. But these register accesses are
trapped by crosvm, and that's not fast enough.

As a shitty workaround, add an option to hide device MSI-X capability from
the VM. It should fall back to MSI. I hope.
2026-02-26 17:39:20 +00:00
63551fb547 Enable hugepages for crosvm 2026-02-26 09:21:48 +00:00
315de3fc05 Fix vsock command handler starting before graphical session is ready
The vsock-cmd socket was wantedBy sockets.target, causing it to listen
on vsock:5000 as soon as the user manager started — before wayland,
dbus, and pipewire were ready. Commands arriving during this window
would fail. This also caused root's user manager to try binding the
same port ("Address already in use").

Tie the socket to graphical-session.target so it only listens once the
session environment is fully set up. The host proxy's existing retry
loop handles the brief delay.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 07:26:42 +00:00
ced153597a Improve battery life by not using polling for corked audio streams 2026-02-26 07:26:42 +00:00
86fe2d7f49 Fix wayland-proxy-virtwl build error 2026-02-25 23:26:30 +00:00
72b78e0573 Cork pulseaudio streams when VM pauses virtio-snd
Reduces unnecessary wakeups to improve battery life.
2026-02-25 22:54:41 +00:00
9b1b22df84 Bump wayland-proxy-virtwl (build warning fixes) 2026-02-25 22:53:51 +00:00
b247b46066 Start autoStart GPU VMs with session instead of at boot
GPU VMs need a Wayland socket, so starting them at multi-user.target
(boot) fails. The session-bind user service now also starts autoStart
GPU VMs when the graphical session begins. Non-GPU VMs still start at
boot.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 22:14:53 +00:00
77ce2423d5 Fix audio capture configuration (was always enabled) 2026-02-25 21:19:40 +00:00
4b5a1c0e3c Allow hyphens in network interface names and validate at build time
The guest-side ifname regex rejected `-`, which is a legal character for
Linux interface names. Also add a NixOS assertion so invalid names are
caught at config evaluation rather than silently skipped at guest boot.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:07:42 +00:00
49fc439ebb Bump wayland-proxy-virtwl for build fix 2026-02-25 13:06:46 +00:00
f34b494dd1 Fix last blocker for guest-side vulkan
Add libvulkan.so to crosvm LD_LIBRARY_PATH. Along with the earlier fix
commits, this now enables full guest-side vulkan (tested with vkcube
and vulkaninfo - they're using the host GPU). Huzzah!

Was hoping enabling vulkan and not opengl would make mesa fall back to
zink, so we could skip virgl2 and just translate opengl to vulkan. But
it still ends up using llvmpipe. Forcing zink gives errors, getting that
working will be the next goal.
2026-02-22 16:16:25 +00:00
51008b7f47 Use virglrenderer and mesa from latest git 2026-02-22 14:22:23 +00:00
f1041db662 Refactor GPU option from raw crosvm attrset to high-level feature config
Replace the low-level gpu attrset (mapped directly to --gpu args) with a
submodule of supported features: wayland (cross-domain), opengl (virgl2),
and vulkan (venus). Vulkan automatically adds --gpu-render-server.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 13:06:41 +00:00
97bd90b4c2 Fix global copy/paste OSD notification being cut off
Ensure the OSD is large enough for the displayed text.
2026-02-22 01:41:15 +00:00
7a3c610341 Bump crosvm
Adds a --disable-gpu-render-server-sandbox option for debugging
2026-02-21 02:51:23 +00:00
01dde64c4b Fix ephemeral disk ID exceeding crosvm's 20-char limit
Use fixed string "ephemeral" instead of deriving from VM name, since
disk IDs only need to be unique within a single VM's block devices.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 02:25:49 +00:00
79b4184891 Move createSharedHome to virtiofsd-home unit
virtiofsd fails if the shared home directory doesn't exist yet. The
createSharedHome script was running as ExecStartPre on the crosvm VM
service, but virtiofsd starts before the VM service. Move it to the
virtiofsd-home unit so the directory is created before virtiofsd needs it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 02:13:29 +00:00
23a3cace1c crosvm gpu-render-server: more seccomp fixes 2026-02-21 01:23:06 +00:00
16b08cc3c8 Add nvidiaWeakenSandbox option to select crosvm-nvidia package
Nvidia GPU drivers require RWX memory pages, which crosvm's seccomp
sandbox blocks. This option switches to a crosvm-nvidia build with
a relaxed W+X memory policy, keeping the default secure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 00:46:58 +00:00
bc8659fed9 Fix seccomp crash with crosvm --gpu-render-server 2026-02-21 00:11:43 +00:00
2de6f83076 Remove redundant dbus launch, fix sommelier
We're already starting a dbus normally, the wrapped dbus-launch is
not needed. Passing a command also prevents sommelier from working.

Also update sommelier since the old version was broken for virtio-gpu.
2026-02-20 23:30:03 +00:00
898e8ffa1c Enable sshd vsock listener 2026-02-20 21:18:41 +00:00
d357d47050 Split guest rootfs configuration into focused submodules
Breaks the monolithic rootfs-nixos/configuration.nix (582 lines) into
7 files under rootfs-nixos/guest/ for better readability and separation
of concerns: boot, users, networking, wayland, command, system, plus a
shared kernel-param-helper.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 19:40:51 +00:00
041d12c21b Enable powertop in VMs to reduce wakeups 2026-02-20 19:21:22 +00:00