nixos-config/modules/nixos/linux/incus/default.nix
Sridhar Ratnakumar 4c648e912c
Enable incus on pureintent (#113)
* Enable incus on pureintent, rename lxd.nix, drop unused flake-parts

- Add incus module import to pureintent and bind the UI to its
  Tailscale IP (no firewall change needed since tailscale0 is trusted).
- Rename modules/nixos/linux/lxd.nix -> incus.nix since the module
  configures virtualisation.incus, and enable the bundled web UI.
- Drop the unused modules/flake-parts/incus-image helper; the
  `images:nixos/*` community images cover container/VM launches.

* Move incus module into a directory with a README

The troubleshooting notes used to live as comments in the module; they
belong in docs alongside a quick-start on launching containers/VMs and
configuring the UI listener.

* Expand incus README with VM gotchas

Document the sharp edges hit while bringing up a NixOS VM for the first
time: secureboot, memory/cpu/disk limits (with the error signatures
that point at each), configuring the guest (flakes, firewall), and a
three-step guide to exposing a service from inside.
2026-04-19 11:21:39 -04:00

55 lines
1 KiB
Nix

# See ./README.md for usage and troubleshooting.
{ flake, ... }:
let
networkName = "incusbr0";
preseedConfig = {
networks = [
{
name = networkName;
type = "bridge";
}
];
profiles = [
{
name = "default";
devices = {
eth0 = {
name = "eth0";
network = networkName;
type = "nic";
};
root = {
path = "/";
pool = "default";
type = "disk";
};
};
}
];
storage_pools = [
{
name = "default";
driver = "dir";
config = {
source = "/var/lib/incus/storage-pools/default";
};
}
];
};
in
{
virtualisation.incus = {
enable = true;
ui.enable = true;
preseed = preseedConfig;
};
users.users.${flake.config.me.username} = {
extraGroups = [ "incus" "incus-admin" ];
};
networking.nftables.enable = true;
networking.firewall.trustedInterfaces = [ networkName ];
}