faucet(libvirt): add service configuration and persist
This commit is contained in:
parent
bfbc9a462c
commit
fb59579563
1 changed files with 30 additions and 0 deletions
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…
Add table
Add a link
Reference in a new issue