-
Notifications
You must be signed in to change notification settings - Fork 1
/
incus.nix
49 lines (41 loc) · 1.28 KB
/
incus.nix
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
{ config, pkgs, lib, ... }:
with lib;
{
boot.kernel.sysctl = {
# fix too many files open
"fs.file-max" = "20480000";
"fs.inotify.max_user_watches" = "20480000";
"fs.inotify.max_user_instances" = "20480000";
"fs.inotify.max_queued_events" = "20480000";
# allow IPv6 addrs to directly go out
"net.ipv6.conf.all.proxy_ndp" = "1";
# swap improvments
"vm.swappiness" = 80;
# fix docker
"kernel.keys.root_maxkeys" = 1000000;
"kernel.keys.maxkeys" = 1000000;
# forwarding
"net.ipv6.conf.all.forwarding" = 1;
"net.ipv4.conf.all.forwarding" = 1;
};
networking.firewall = {
extraForwardRules = ''
iifname { "incusbr0", "incusbr1", "enp1s0" } oifname { "incusbr0", "incusbr1", "enp1s0" } accept
'';
trustedInterfaces = [ "incusbr0" "incusbr1" ];
};
systemd.services.incus = {
restartIfChanged = false; # do it later
requires = mkForce ["network-online.target" "incus.socket"];
wantedBy = mkForce [];
};
boot.kernelModules = ["vhost_vsock"]; # for vms
environment.systemPackages = with pkgs; [
tcpdump
socat
mtr
# edac-util -rfull => ecc errors
edac-utils
];
networking.firewall.allowedTCPPorts = [ 8443 ];
}