add graphical.virt module

This commit is contained in:
Elec3137 2026-02-04 18:37:00 -08:00
commit f7ad07daf8
2 changed files with 34 additions and 0 deletions

View file

@ -15,6 +15,7 @@ in
./games ./games
./jp.nix ./jp.nix
./mpv.nix ./mpv.nix
./virt.nix
]; ];
options.nixowos.${name} = { options.nixowos.${name} = {

33
graphical/virt.nix Normal file
View file

@ -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" ];
};
}