diff options
| author | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2025-11-19 21:02:52 +0100 |
|---|---|---|
| committer | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2025-11-19 21:02:52 +0100 |
| commit | 892de67a9f64d0b0cdb023d830a019d8feec0a57 (patch) | |
| tree | 0c5fd0c60ef93bb5cdc5f83c8cade0c5dddb4899 /modules/virt.nix | |
| parent | f5b37610b3835ea26757ef36d554ec598d53100c (diff) | |
Nix fmt
Diffstat (limited to 'modules/virt.nix')
| -rw-r--r-- | modules/virt.nix | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/modules/virt.nix b/modules/virt.nix index 597b957..53bd70a 100644 --- a/modules/virt.nix +++ b/modules/virt.nix @@ -1,34 +1,39 @@ -{pkgs, config, lib, ...}: -let - cfg = config.addons.virtualisation; -in +{ + 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"; - }; + host = lib.mkEnableOption "Allow to host vm's and containers"; + guest = lib.mkEnableOption "Enable guest agents"; + }; - config = lib.mkMerge([ + config = lib.mkMerge ([ (lib.mkIf cfg.host { - environment.systemPackages = with pkgs; [ - qemu - ]; + environment.systemPackages = with pkgs; [ + qemu + ]; programs.virt-manager.enable = true; virtualisation = { - spiceUSBRedirection.enable = true; + spiceUSBRedirection.enable = true; docker.enable = true; libvirtd = { enable = true; qemu = { - swtpm.enable = true; + swtpm.enable = true; vhostUserPackages = with pkgs; [ virtiofsd ]; }; }; - }; - + }; + }) (lib.mkIf cfg.guest { - services.spice-vdagentd.enable = true; + services.spice-vdagentd.enable = true; }) ]); -} +} |
