diff options
author | Azat Bahawi <azat@bahawi.net> | 2024-04-21 02:15:42 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2024-04-21 02:15:42 +0300 |
commit | e6ed60548397627bf10f561f9438201dbba0a36e (patch) | |
tree | f9a84c5957d2cc4fcd148065ee9365a0c851ae1c /modules/libvirtd.nix | |
parent | 9ac64328603d44bd272175942d3ea3eaadcabd04 (diff) |
2024-04-21
Diffstat (limited to 'modules/libvirtd.nix')
-rw-r--r-- | modules/libvirtd.nix | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/modules/libvirtd.nix b/modules/libvirtd.nix new file mode 100644 index 0000000..009fd24 --- /dev/null +++ b/modules/libvirtd.nix @@ -0,0 +1,53 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; +let + cfg = config.nixfiles.modules.libvirtd; +in +{ + options.nixfiles.modules.libvirtd.enable = mkEnableOption "libvirtd"; + + config = mkIf cfg.enable { + ark.directories = [ "/var/lib/libvirt" ]; + + hm.home.packages = with pkgs; [ + bridge-utils + qemu-utils + quickemu + virt-manager + ]; + + virtualisation.libvirtd = { + enable = true; + + onBoot = "ignore"; + onShutdown = "shutdown"; + + extraConfig = '' + log_level = 4 + log_outputs = "4:stderr" + ''; + + qemu = { + package = pkgs.qemu_kvm; + runAsRoot = false; + + ovmf = { + enable = true; + packages = [ pkgs.OVMFFull.fd ]; + }; + + swtpm = { + enable = true; + package = pkgs.swtpm; + }; + }; + }; + + my.extraGroups = [ "libvirtd" ]; + }; +} |