nix-config/modules/nix/virt/qemu.nix
smayzy 6b003a8648
All checks were successful
nixos config pipeline / show-flake (push) Successful in 1m6s
nixos config pipeline / deploy (push) Successful in 50s
add comment for traversability of vm storage in home dir
2025-10-01 17:16:11 +02:00

34 lines
788 B
Nix

{
config,
lib,
pkgs,
...
}:
let
inherit (lib) mkIf mkOption types;
in
{
options.smayzy.virt.enable = mkOption {
type = types.bool;
default = false;
description = "enable virt-manager and qemu";
};
config = mkIf config.smayzy.virt.enable {
# chmod g+x ~/VM
# for traversability of the home dir
programs.virt-manager.enable = true;
users.groups.libvirtd.members = [ "smayzy" ];
virtualisation.libvirtd.enable = true;
virtualisation.libvirtd.qemu.runAsRoot = false;
virtualisation.libvirtd.qemu.ovmf.enable = true;
environment.systemPackages = with pkgs; [
qemu_kvm
];
# https://wiki.nixos.org/wiki/QEMU
systemd.tmpfiles.rules = [ "L+ /var/lib/qemu/firmware - - - - ${pkgs.qemu}/share/qemu/firmware" ];
};
}