qemu options
This commit is contained in:
@@ -3,6 +3,6 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./podman.nix
|
./podman.nix
|
||||||
./qemu.nix
|
./qemu.nix
|
||||||
./lima.nix
|
./options.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,5 +24,34 @@ in
|
|||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# qemu
|
||||||
|
qemu = {
|
||||||
|
enable = lib.mkEnableOption "QEMU support";
|
||||||
|
|
||||||
|
containers = lib.mkEnableOption "Enable container support for QEMU" {
|
||||||
|
enable = true;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
spiceUSBRedirection = lib.mkEnableOption "Enable spice USB redirection support for QEMU" {
|
||||||
|
enable = true;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
virtManager = lib.mkEnableOption "Enable virt-manager support for QEMU" {
|
||||||
|
enable = true;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
bootModules = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [
|
||||||
|
"kvm-intel"
|
||||||
|
"kvm-amd"
|
||||||
|
];
|
||||||
|
description = "The kernel modules to load for QEMU support.";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
{ pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
virtualisation.spiceUSBRedirection.enable = true;
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.homelab.virtualization;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = lib.mkMerge [
|
||||||
|
(lib.mkIf cfg.qemu.enable {
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
containers.enable = true;
|
containers.enable = true;
|
||||||
libvirtd = {
|
libvirtd = {
|
||||||
@@ -13,16 +20,22 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
users.users.${cfg.user}.extraGroups = [
|
||||||
programs.virt-manager.enable = true;
|
|
||||||
|
|
||||||
users.users.river.extraGroups = [
|
|
||||||
"libvirtd"
|
"libvirtd"
|
||||||
"kvm"
|
"kvm"
|
||||||
];
|
];
|
||||||
|
})
|
||||||
|
|
||||||
boot.kernelModules = [
|
(lib.mkIf cfg.qemu.spiceUSBRedirection {
|
||||||
"kvm-intel"
|
virtualisation.spiceUSBRedirection.enable = true;
|
||||||
"kvm-amd"
|
})
|
||||||
|
|
||||||
|
(lib.mkIf cfg.qemu.virtManager {
|
||||||
|
programs.virt-manager.enable = true;
|
||||||
|
})
|
||||||
|
|
||||||
|
(lib.mkIf cfg.qemu.bootModules {
|
||||||
|
boot.kernelModules = cfg.qemu.bootModules;
|
||||||
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user