blob: 597b957b58dde75099273a1a1b20e51fe43bb16b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
{pkgs, config, lib, ...}:
let
cfg = config.addons.virtualisation;
in
{
options.addons.virtualisation = {
host = lib.mkEnableOption "Allow to host vm's and containers";
guest = lib.mkEnableOption "Enable guest agents";
};
config = lib.mkMerge([
(lib.mkIf cfg.host {
environment.systemPackages = with pkgs; [
qemu
];
programs.virt-manager.enable = true;
virtualisation = {
spiceUSBRedirection.enable = true;
docker.enable = true;
libvirtd = {
enable = true;
qemu = {
swtpm.enable = true;
vhostUserPackages = with pkgs; [ virtiofsd ];
};
};
};
})
(lib.mkIf cfg.guest {
services.spice-vdagentd.enable = true;
})
]);
}
|