feat(libvirt): service configuration and persist
This commit is contained in:
parent
ca9471bfb3
commit
a56f98417d
30
faucet/libvirt/default.nix
Normal file
30
faucet/libvirt/default.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ... }: with lib; let
|
||||
cfg = config.faucet.libvirt;
|
||||
in {
|
||||
options.faucet.libvirt = {
|
||||
enable = mkEnableOption "libvirt virtualisation daemon" // { default = true; };
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation.libvirtd = {
|
||||
enable = true;
|
||||
qemu.runAsRoot = false;
|
||||
qemu.swtpm.enable = true;
|
||||
|
||||
# disable as much implicit state as possible
|
||||
onBoot = "ignore";
|
||||
onShutdown = "shutdown";
|
||||
parallelShutdown = 5;
|
||||
};
|
||||
|
||||
# USB redirection requires a setuid wrapper
|
||||
virtualisation.spiceUSBRedirection.enable = true;
|
||||
|
||||
environment.persistence."/nix/persist/fhs".directories = [
|
||||
"/var/lib/libvirt"
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue