Modularize libvirt

This commit is contained in:
jalr 2021-12-05 16:15:43 +00:00
parent 22f092e6e9
commit b236936061
5 changed files with 35 additions and 14 deletions

View file

@ -11,6 +11,7 @@
./fish.nix
./fonts.nix
./kvm-switch-enable-screen.nix
./libvirt.nix
./localization.nix
./mute-indicator.nix
./nix.nix

31
modules/libvirt.nix Normal file
View file

@ -0,0 +1,31 @@
{ config, lib, pkgs, ... }:
let
cfg = config.myConfig;
in
{
options.myConfig = {
libvirt = {
enable = pkgs.lib.mkEnableOption "Enable libvirt";
};
};
config = lib.mkIf cfg.libvirt.enable {
environment.systemPackages = with pkgs; [
spice-gtk
virt-manager
];
virtualisation = {
docker.enable = true;
libvirtd = {
enable = true;
qemu.ovmf.enable = true;
# start: starts all guests that were running prior to shutdown
# ignore: only start guests which are marked as autostart
onBoot = "ignore";
onShutdown = "shutdown";
};
};
};
}