diff options
| author | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2025-08-17 11:25:33 +0200 |
|---|---|---|
| committer | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2025-08-17 11:25:33 +0200 |
| commit | 1be972048dd58218cd689ecb5cac562eb398b751 (patch) | |
| tree | 203f19ee01ad5fe28f2868e8c1451f9538e4ab12 /modules/virt.nix | |
| parent | 3cd59d4670711e34a50adea912c3b0894883e490 (diff) | |
refreshed config
Diffstat (limited to 'modules/virt.nix')
| -rw-r--r-- | modules/virt.nix | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/modules/virt.nix b/modules/virt.nix new file mode 100644 index 0000000..416f1c4 --- /dev/null +++ b/modules/virt.nix @@ -0,0 +1,35 @@ +{pkgs, config, lib, ...}: +let + cfg = config.addons.virtualisation; +in +{ + options.addons.virtualisation = { + host = lib.mkEnableOption "Allow to host vm's and containers"; + guest = lib.mkEnableOption "Enable guest agents"; + }; + + config = lib.mkMerge([ + (lib.mkIf cfg.host { + environment.systemPackages = with pkgs; [ + qemu + ]; + virtualisation = { + docker.enable = true; + libvirtd = { + enable = true; + qemu = { + swtpm.enable = true; + vhostUserPackages = with pkgs; [ virtiofsd ]; + ovmf.enable = true; + ovmf.packages = [ pkgs.OVMFFull.fd ]; + }; + }; + }; + + }) + (lib.mkIf cfg.guest { + virtualisation.spiceUSBRedirection.enable = true; + services.spice-vdagentd.enable = true; + }) + ]); +} |
