tweaking vm options
This commit is contained in:
parent
768340f8e3
commit
0cd9d9ea95
1 changed files with 38 additions and 32 deletions
|
|
@ -2,45 +2,51 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
# Name of the group needed to use VirtualBox
|
#sharePublicSourceDirectory = "/home/${user}/Public/"; # it's named public right
|
||||||
vmgroup = "vmusers";
|
#sharePublicTargetDirectory = "F:"; # for windows
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
# Permissions configuration
|
# Security
|
||||||
users = {
|
#users.groups = { # creates grouped virtualisation permissions
|
||||||
# Gives users virtualisation permissions
|
#kvm.members = [ "${user}" "${anotherUser}" ];
|
||||||
groups.kvm.members = [ "${user}" ];
|
#libvirtd.members = [ "${user}" "${anotherUser}" ];
|
||||||
groups.libvirtd.members = [ "${user}" ];
|
#};
|
||||||
extraGroups."${vmgroup}".members = [ "${user}" ];
|
users.users."${user}" = { # Gives primary user virtualisation permissions
|
||||||
users."${user}".extraGroups = [ "${vmgroup}" ];
|
extraGroups = [ "libvirtd" "kvm" ];
|
||||||
};
|
};
|
||||||
|
networking.firewall.trustedInterfaces = [ "virbr0" ]; # network bridge to VM
|
||||||
|
# https://wiki.nixos.org/wiki/Virt-manager#Networking
|
||||||
|
# Inactive by default, enable in host by running:
|
||||||
|
# `sudo virsh net-start default`
|
||||||
|
# Enable it automatically it at boot by running:
|
||||||
|
# `sudo virsh net-autostart default`
|
||||||
|
|
||||||
# Virtualisation packages
|
# virtualisation
|
||||||
|
programs.virt-manager.enable = true; # simple vm frontend
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
gnome-boxes # VM frontend
|
dnsmasq # for vm networking
|
||||||
dnsmasq # Vm networking
|
#phodav # for vm fileshare
|
||||||
phodav # Fileshare with guest VMs
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# Virtualisation configuration
|
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
# Base virtualisation set up
|
#cores = 4; # fine for now
|
||||||
libvirtd.enable = true;
|
graphics = true; # run qemu in gui or no gui mode
|
||||||
# TPM emulation for Win11
|
spiceUSBRedirection.enable = true; # for USB passthrough
|
||||||
libvirtd.qemu = {
|
libvirtd = {
|
||||||
swtpm.enable = true;
|
enable = true;
|
||||||
};
|
qemu = {
|
||||||
# Enables USB passthrough
|
vhostUserPackages = with pkgs; [ virtiofsd ]; # host fileshare
|
||||||
spiceUSBRedirection.enable = true;
|
swtpm.enable = true; # tpm emulation for windows 11
|
||||||
# VirtualBox configuration
|
runAsRoot = true; # for `passthrough` security on fileshare
|
||||||
virtualbox = {
|
};
|
||||||
# Enables VirtualBox with this machine as the host
|
|
||||||
#host.enable = false;
|
|
||||||
# Increases security when using VirtualBox
|
|
||||||
#host.enableHardening = true;
|
|
||||||
# Needed for USB2 and USB3 passthrough
|
|
||||||
#host.enableExtensionPack = true;
|
|
||||||
};
|
};
|
||||||
|
#sharedDirectories = { # list of directories to share to VMs
|
||||||
|
#Public = { # ~/Public
|
||||||
|
#securityModel = "passthrough";
|
||||||
|
#source = "${sharePublicSourceDirectory}";
|
||||||
|
#target = "${sharePublicTargetDirectory}";
|
||||||
|
#};
|
||||||
|
#};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue