nix-config/modules/nix/virt/qemu.nix
smayzy 092579af98
All checks were successful
nix flake show / show-flake (push) Successful in 27s
format with nixfmt to nixpkgs standarts
2025-07-24 19:19:46 +02:00

32 lines
726 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 {
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" ];
};
}