From f7ad07daf8e6539f0a2af0fc3c1729671f27a684 Mon Sep 17 00:00:00 2001 From: Elec3137 Date: Wed, 4 Feb 2026 18:37:00 -0800 Subject: [PATCH] add graphical.virt module --- graphical/default.nix | 1 + graphical/virt.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 graphical/virt.nix diff --git a/graphical/default.nix b/graphical/default.nix index 57a5099..af9b42d 100644 --- a/graphical/default.nix +++ b/graphical/default.nix @@ -15,6 +15,7 @@ in ./games ./jp.nix ./mpv.nix + ./virt.nix ]; options.nixowos.${name} = { diff --git a/graphical/virt.nix b/graphical/virt.nix new file mode 100644 index 0000000..e8706c9 --- /dev/null +++ b/graphical/virt.nix @@ -0,0 +1,33 @@ +{ + lib, + config, + ... +}: + +let + name = "virt"; + cfg = config.nixowos.graphical.${name}; +in +{ + options.nixowos.graphical.${name} = { + enable = lib.mkEnableOption name; + + user = lib.mkOption { + type = lib.types.nullOr lib.types.str; + default = null; + }; + }; + + config = lib.mkIf cfg.enable { + assertions = [ + { + assertion = cfg.user != null; + message = "you must set nixowos.graphical.${name}.user"; + } + ]; + + programs.virt-manager.enable = true; + virtualisation.libvirtd.enable = true; + users.users.${cfg.user}.extraGroups = [ "libvirtd" ]; + }; +}