4e925f8a89
also added the configuration bc idk how to add only certain files but whatever
42 lines
771 B
Nix
42 lines
771 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.homelab.virtualization;
|
|
in
|
|
{
|
|
config = lib.mkMerge [
|
|
(lib.mkIf cfg.qemu.enable {
|
|
virtualisation = {
|
|
containers.enable = cfg.qemu.containers;
|
|
libvirtd = {
|
|
enable = true;
|
|
qemu = {
|
|
package = pkgs.qemu_kvm;
|
|
swtpm.enable = true;
|
|
};
|
|
};
|
|
};
|
|
users.users.${cfg.user}.extraGroups = [
|
|
"libvirtd"
|
|
"kvm"
|
|
];
|
|
})
|
|
|
|
(lib.mkIf cfg.qemu.spiceUSBRedirection {
|
|
virtualisation.spiceUSBRedirection.enable = true;
|
|
})
|
|
|
|
(lib.mkIf cfg.qemu.virtManager {
|
|
programs.virt-manager.enable = true;
|
|
})
|
|
|
|
(lib.mkIf cfg.qemu.enable {
|
|
boot.kernelModules = cfg.qemu.bootModules;
|
|
})
|
|
];
|
|
}
|