Add virtualization capabilities

This commit is contained in:
GHOSCHT 2023-10-14 13:24:01 +02:00
parent 8df1bb82a9
commit fb4b56a6fd
3 changed files with 62 additions and 0 deletions

View file

@ -11,6 +11,8 @@
./hardware-configuration.nix
../../modules/hardware/nvidia.nix
../../modules/services/avahi.nix
../../modules/virtualization/docker.nix
../../modules/virtualization/qemu.nix
];
boot = {

View file

@ -0,0 +1,18 @@
{
config,
pkgs,
vars,
...
}: {
virtualisation = {
docker.enable = true;
};
users.groups.docker.members = ["${vars.user}"];
environment.systemPackages = with pkgs; [
docker # Containers
docker-compose # Multi-Container
lazydocker
];
}

View file

@ -0,0 +1,42 @@
{
config,
pkgs,
vars,
...
}: {
boot.extraModprobeConfig = ''
options kvm_intel nested=1
'';
users.groups.libvirtd.members = ["root" "${vars.user}"];
virtualisation = {
libvirtd = {
enable = true;
qemu = {
verbatimConfig = ''
nvram = [ "${pkgs.OVMF}/FV/OVMF.fd:${pkgs.OVMF}/FV/OVMF_VARS.fd" ]
'';
swtpm.enable = true;
};
};
spiceUSBRedirection.enable = true;
};
environment = {
systemPackages = with pkgs; [
virt-manager # VM Interface
virt-viewer # Remote VM
qemu # Virtualizer
OVMF # UEFI Firmware
gvfs # Shared Directory
swtpm # TPM
virglrenderer # Virtual OpenGL
];
};
services = {
# File Sharing
gvfs.enable = true;
};
}