From 7233a1af4857bdb3ea393c647f78344ed7ded4a6 Mon Sep 17 00:00:00 2001 From: smayzy Date: Sun, 6 Jul 2025 13:13:14 +0200 Subject: [PATCH] virt toogle --- hosts/common/common.nix | 2 ++ modules/nix/virt.nix | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/hosts/common/common.nix b/hosts/common/common.nix index 2ba8cdc..1517d9b 100644 --- a/hosts/common/common.nix +++ b/hosts/common/common.nix @@ -11,6 +11,8 @@ ../../modules/nix/nh.nix ]; + smayzy.virt.enable = true; + users.users.smayzy = { isNormalUser = true; description = "smayzy"; diff --git a/modules/nix/virt.nix b/modules/nix/virt.nix index ae874d6..0e4c4b9 100644 --- a/modules/nix/virt.nix +++ b/modules/nix/virt.nix @@ -1,10 +1,20 @@ { config, lib, pkgs, ... }: +let + inherit (lib) mkIf mkOption types; +in { - programs.virt-manager.enable = true; - users.groups.libvirtd.members = ["smayzy"]; - virtualisation.libvirtd.enable = true; + options.smayzy.virt.enable = mkOption { + type = types.bool; + default = false; + description = "enable virt-manager and qemu"; + }; - environment.systemPackages = with pkgs; [ - qemu - ]; + config = mkIf config.smayzy.virt.enable { + programs.virt-manager.enable = true; + users.groups.libvirtd.members = ["smayzy"]; + virtualisation.libvirtd.enable = true; + environment.systemPackages = with pkgs; [ + qemu + ]; + }; }