diff options
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; }) ]); -} +} |
