Add virtualization capabilities
This commit is contained in:
parent
8df1bb82a9
commit
fb4b56a6fd
3 changed files with 62 additions and 0 deletions
|
@ -11,6 +11,8 @@
|
|||
./hardware-configuration.nix
|
||||
../../modules/hardware/nvidia.nix
|
||||
../../modules/services/avahi.nix
|
||||
../../modules/virtualization/docker.nix
|
||||
../../modules/virtualization/qemu.nix
|
||||
];
|
||||
|
||||
boot = {
|
||||
|
|
18
modules/virtualization/docker.nix
Normal file
18
modules/virtualization/docker.nix
Normal 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
|
||||
];
|
||||
}
|
42
modules/virtualization/qemu.nix
Normal file
42
modules/virtualization/qemu.nix
Normal 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;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue