blob: 53bd70a26000948817f16bee69d8fa4678b6293d (
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
35
36
37
38
39
|
{
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;
})
]);
}
|