blob: 424f43f5fb2793ee2d5c6128223805bdb16519be (
plain) (
blame)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
{ pkgs-no-overlay, ... }:
{
boot.kernelModules = [ "nf_nat_ftp" ];
### Enable Docker
virtualisation.docker.enable = true;
disko.devices.zpool.zfast.datasets."root/persist/var/lib/docker" =
{ type = "zfs_fs"; mountpoint = "/persist/zfast/var/lib/docker"; options.mountpoint = "legacy"; };
systemd.services.docker.after = [
"var-lib-docker.mount"
"persist-zfast-var-lib-docker.mount"
];
systemd.services.docker.unitConfig.BindsTo = [
"var-lib-docker.mount"
"persist-zfast-var-lib-docker.mount"
];
### Enable LXC
disko.devices.zpool.zfast.datasets."root/persist/var/lib/lxc" =
{ type = "zfs_fs"; mountpoint = "/persist/zfast/var/lib/lxc"; options.mountpoint = "legacy"; };
virtualisation.lxc = {
enable = true;
lxcfs.enable = true;
};
systemd.services.lxc.after = [
"var-lib-lxc.mount"
"persist-zfast-var-lib-lxc.mount"
];
systemd.services.lxc.unitConfig.BindsTo = [
"var-lib-lxc.mount"
"persist-zfast-var-lib-lxc.mount"
];
### Enable libvirtd
virtualisation.libvirtd = {
enable = true;
qemu.package = pkgs-no-overlay.qemu;
};
# No persistence for libvirtd: config is supposed to be persisted via config
### Persistence for LXC / Docker
environment.persistence."/persist/zfast".directories = [
{
directory = "/var/lib/lxc";
user = "root";
group = "root";
mode = "0755";
}
{
directory = "/var/lib/docker";
user = "root";
group = "root";
mode = "0750";
}
];
# ip forwarding is needed for NAT'ing to work in containers/VMs.
boot.kernel.sysctl = {
"net.ipv4.conf.all.forwarding" = true;
"net.ipv4.conf.default.forwarding" = true;
};
}
|