]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - systems/zoldene/virtualisation.nix
Configure nginx and containers / virtualisation for zoldene
[perso/Immae/Config/Nix.git] / systems / zoldene / virtualisation.nix
CommitLineData
d3a40bd9
IB
1{ pkgs-no-overlay, ... }:
2{
3 boot.kernelModules = [ "nf_nat_ftp" ];
4
5 ### Enable Docker
6 virtualisation.docker.enable = true;
7 disko.devices.zpool.zfast.datasets."root/persist/var/lib/docker" =
8 { type = "zfs_fs"; mountpoint = "/persist/zfast/var/lib/docker"; options.mountpoint = "legacy"; };
9
10 ### Enable LXC
11 disko.devices.zpool.zfast.datasets."root/persist/var/lib/lxc" =
12 { type = "zfs_fs"; mountpoint = "/persist/zfast/var/lib/lxc"; options.mountpoint = "legacy"; };
13 virtualisation.lxc = {
14 enable = true;
15 lxcfs.enable = true;
16 };
17
18 ### Enable libvirtd
19 virtualisation.libvirtd = {
20 enable = true;
21 qemu.package = pkgs-no-overlay.qemu;
22 };
23
24 ### Persistence for LXC / Docker
25 environment.persistence."/persist/zfast".directories = [
26 {
27 directory = "/var/lib/lxc";
28 user = "root";
29 group = "root";
30 mode = "0755";
31 }
32 {
33 directory = "/var/lib/docker";
34 user = "root";
35 group = "root";
36 mode = "0750";
37 }
38 ];
39
40 # ip forwarding is needed for NAT'ing to work in containers/VMs.
41 boot.kernel.sysctl = {
42 "net.ipv4.conf.all.forwarding" = true;
43 "net.ipv4.conf.default.forwarding" = true;
44 };
45}
46