nix-flakes/modules/nixos/features/system/virtualisation.nix
2026-07-05 13:31:18 +09:00

23 lines
654 B
Nix

{ pkgs, ... }:
{
virtualisation.docker = {
enable = true;
};
virtualisation.libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
runAsRoot = true;
swtpm.enable = true;
};
};
# Override the virt-secret-init-encryption service to use correct shell path
systemd.services.virt-secret-init-encryption = {
serviceConfig.ExecStart = [
""
"${pkgs.bash}/bin/bash -c 'umask 0077 && (${pkgs.coreutils}/bin/dd if=/dev/urandom status=none bs=32 count=1 | ${pkgs.systemd}/bin/systemd-creds encrypt --name=secrets-encryption-key - /var/lib/libvirt/secrets/secrets-encryption-key)'"
];
};
}