config/hosts/vno1-oh2/configuration.nix

266 lines
6.3 KiB
Nix
Raw Normal View History

2023-07-22 16:05:44 +03:00
{
config,
pkgs,
myData,
...
2024-07-29 15:39:54 +03:00
}:
{
2023-07-22 16:05:44 +03:00
zfs-root = {
boot = {
enable = true;
devNodes = "/dev/disk/by-id/";
2024-07-29 15:39:54 +03:00
bootDevices = [ "nvme-Samsung_SSD_970_EVO_Plus_2TB_S6P1NX0TA00913P" ];
2023-07-22 16:05:44 +03:00
immutable = false;
2023-09-12 09:59:55 +03:00
availableKernelModules = [
"ahci"
"xhci_pci"
"nvme"
"usbhid"
"sdhci_pci"
"r8169" # builtin non working
"r8152" # startech usb-ethernet adapter
];
2023-07-22 16:05:44 +03:00
removableEfi = true;
kernelParams = [
2023-09-12 09:59:55 +03:00
"ip=192.168.189.1::192.168.189.4:255.255.255.0:vno1-oh2.jakstys.lt:enp0s21f0u2:off"
2023-07-22 16:05:44 +03:00
];
};
};
2024-07-29 15:39:54 +03:00
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
2023-07-22 16:05:44 +03:00
mj = {
stateVersion = "23.05";
timeZone = "Europe/Vilnius";
username = "motiejus";
2023-07-22 16:05:44 +03:00
base = {
zfs.enable = true;
2023-08-18 16:39:03 +03:00
users = {
2024-02-04 16:18:47 +02:00
enable = true;
root.hashedPasswordFile = config.age.secrets.root-passwd-hash.path;
user.hashedPasswordFile = config.age.secrets.motiejus-passwd-hash.path;
2023-07-22 16:05:44 +03:00
};
2023-07-26 13:09:40 +03:00
snapshot = {
enable = true;
2024-07-29 15:39:54 +03:00
mountpoints = [
"/home"
"/var/lib"
"/var/log"
];
2023-07-26 13:09:40 +03:00
};
2023-07-26 14:23:12 +03:00
zfsborg = {
enable = true;
passwordPath = config.age.secrets.borgbackup-password.path;
2023-07-26 14:39:34 +03:00
sshKeyPath = "/etc/ssh/ssh_host_ed25519_key";
dirs = [
2023-09-11 17:50:35 +03:00
# TODO merge
{
mountpoint = "/var/lib";
repo = "zh2769@zh2769.rsync.net:${config.networking.hostName}.${config.networking.domain}-var_lib";
paths = [
"tailscale"
"private/soju"
];
backup_at = "*-*-* 01:00:00 UTC";
2024-05-02 17:41:13 +03:00
prune.keep = {
within = "1d";
daily = 1;
weekly = 0;
monthly = 0;
};
}
2023-09-11 17:50:35 +03:00
{
mountpoint = "/var/lib";
2024-07-29 15:39:54 +03:00
repo = "borgstor@${
myData.hosts."vno3-rp3b.servers.jakst".jakstIP
}:${config.networking.hostName}.${config.networking.domain}-var_lib";
2023-09-11 17:50:35 +03:00
paths = [
"tailscale"
"private/soju"
2023-09-11 17:50:35 +03:00
];
backup_at = "*-*-* 01:00:00 UTC";
2023-09-11 17:50:35 +03:00
}
2023-09-11 17:40:47 +03:00
];
2023-07-26 14:23:12 +03:00
};
unitstatus = {
enable = true;
email = "motiejus+alerts@jakstys.lt";
};
2023-07-22 16:05:44 +03:00
};
2023-07-24 09:23:20 +03:00
2023-07-26 13:26:11 +03:00
services = {
2023-09-12 15:46:44 +03:00
friendlyport.ports = [
{
2024-07-29 15:39:54 +03:00
subnets = [ myData.subnets.tailscale.cidr ];
2023-10-22 09:10:09 +03:00
tcp = with myData.ports; [
2023-09-12 15:46:44 +03:00
80
443
2023-10-22 09:10:09 +03:00
soju
2024-02-12 15:50:52 +02:00
soju-ws
2023-09-12 15:46:44 +03:00
];
}
2023-08-06 00:15:13 +03:00
];
tailscale.enable = true;
2023-08-18 09:31:19 +03:00
node_exporter.enable = true;
2023-09-14 06:41:16 +03:00
sshguard.enable = true;
2023-09-05 14:41:52 +03:00
2024-07-29 15:39:54 +03:00
nsd-acme =
let
accountKey = config.age.secrets.letsencrypt-account-key.path;
in
{
enable = true;
zones = {
"irc.jakstys.lt".accountKey = accountKey;
"hdd.jakstys.lt".accountKey = accountKey;
"grafana.jakstys.lt".accountKey = accountKey;
2024-07-29 15:39:54 +03:00
"bitwarden.jakstys.lt".accountKey = accountKey;
};
2023-11-27 18:17:27 +02:00
};
2023-08-09 14:24:43 +03:00
2023-07-30 05:49:54 +03:00
deployerbot = {
follower = {
2024-07-31 09:19:13 +03:00
publicKeys = [ myData.hosts."fwminex.servers.jakst".publicKey ];
2023-07-30 05:49:54 +03:00
enable = true;
2024-07-29 15:39:54 +03:00
sshAllowSubnets = [ myData.subnets.tailscale.sshPattern ];
2023-07-30 05:49:54 +03:00
uidgid = myData.uidgid.updaterbot-deployee;
};
2023-07-28 14:20:50 +03:00
};
2023-07-26 13:26:11 +03:00
postfix = {
enable = true;
saslPasswdPath = config.age.secrets.sasl-passwd.path;
};
2023-07-26 11:36:54 +03:00
2023-07-26 13:26:11 +03:00
syncthing = {
enable = true;
dataDir = "/home/motiejus/";
user = "motiejus";
group = "users";
};
2023-08-25 15:55:06 +03:00
matrix-synapse = {
enable = true;
signingKeyPath = config.age.secrets.synapse-jakstys-signing-key.path;
registrationSharedSecretPath = config.age.secrets.synapse-registration-shared-secret.path;
macaroonSecretKeyPath = config.age.secrets.synapse-macaroon-secret-key.path;
};
2024-07-29 15:39:54 +03:00
remote-builder.client =
let
2024-07-31 09:06:53 +03:00
host = myData.hosts."fra1-b.servers.jakst";
2024-07-29 15:39:54 +03:00
in
{
enable = true;
inherit (host) system supportedFeatures;
hostName = host.jakstIP;
sshKey = "/etc/ssh/ssh_host_ed25519_key";
};
2023-07-24 09:23:20 +03:00
};
2023-07-22 16:05:44 +03:00
};
services = {
2023-07-22 16:05:44 +03:00
nsd = {
enable = true;
2024-07-29 15:39:54 +03:00
interfaces = [
"0.0.0.0"
"::"
];
2023-07-22 16:05:44 +03:00
zones = {
"jakstys.lt.".data = myData.jakstysLTZone;
2024-01-15 15:08:04 +02:00
"11sync.net.".data = myData.e11syncZone;
2023-07-22 16:05:44 +03:00
};
2023-08-07 01:23:41 +03:00
};
2023-08-22 14:28:59 +03:00
soju = {
enable = true;
2024-02-12 15:50:52 +02:00
listen = [
2024-06-05 23:18:40 +03:00
#"unix+admin://"
2024-02-12 15:50:52 +02:00
":${toString myData.ports.soju}"
2024-02-12 16:03:32 +02:00
"wss://:${toString myData.ports.soju-ws}"
2024-02-12 15:50:52 +02:00
];
2023-08-22 14:28:59 +03:00
tlsCertificate = "/run/soju/cert.pem";
tlsCertificateKey = "/run/soju/key.pem";
hostName = "irc.jakstys.lt";
2024-07-29 15:39:54 +03:00
httpOrigins = [ "*" ];
2023-08-22 14:28:59 +03:00
extraConfig = ''
2023-08-22 15:13:33 +03:00
message-store fs /var/lib/soju
2023-08-22 14:28:59 +03:00
'';
};
2023-09-07 08:29:14 +03:00
2024-08-03 06:53:37 +03:00
#syncthing.relay = {
# enable = true;
# providedBy = "11sync.net";
#};
2023-09-07 22:24:00 +03:00
};
2023-09-07 13:04:38 +03:00
systemd.services = {
2024-07-29 15:39:54 +03:00
soju =
let
acme = config.mj.services.nsd-acme.zones."irc.jakstys.lt";
in
{
serviceConfig = {
RuntimeDirectory = "soju";
LoadCredential = [
"irc.jakstys.lt-cert.pem:${acme.certFile}"
"irc.jakstys.lt-key.pem:${acme.keyFile}"
];
};
preStart = ''
ln -sf $CREDENTIALS_DIRECTORY/irc.jakstys.lt-cert.pem /run/soju/cert.pem
ln -sf $CREDENTIALS_DIRECTORY/irc.jakstys.lt-key.pem /run/soju/key.pem
'';
after = [ "nsd-acme-irc.jakstys.lt.service" ];
requires = [ "nsd-acme-irc.jakstys.lt.service" ];
};
2023-08-22 14:28:59 +03:00
2024-02-22 10:08:19 +02:00
syncthing-relay.restartIfChanged = false;
};
2023-12-16 00:20:17 +02:00
environment.systemPackages = with pkgs; [
2024-01-14 18:23:17 +02:00
yt-dlp
2024-06-16 15:45:23 +03:00
ffmpeg
2023-12-16 00:20:17 +02:00
imapsync
geoipWithDatabase
];
2023-12-07 22:56:16 +02:00
2023-07-22 16:05:44 +03:00
networking = {
hostId = "f9117e1b";
hostName = "vno1-oh2";
2023-07-26 11:36:54 +03:00
domain = "servers.jakst";
2023-07-22 16:05:44 +03:00
defaultGateway = "192.168.189.4";
2024-07-29 15:39:54 +03:00
nameservers = [ "192.168.189.4" ];
2023-09-12 09:59:55 +03:00
interfaces.enp0s21f0u2.ipv4.addresses = [
2023-07-22 16:05:44 +03:00
{
address = "192.168.189.1";
prefixLength = 24;
}
];
2023-08-07 00:33:37 +03:00
firewall = {
2024-07-29 15:39:54 +03:00
allowedUDPPorts = [
53
80
443
];
2024-01-25 12:15:59 +02:00
allowedTCPPorts = [
53
80
443
config.services.syncthing.relay.port
config.services.syncthing.relay.statusPort
];
2023-09-21 15:08:26 +03:00
rejectPackets = true;
2023-08-07 00:33:37 +03:00
};
2023-07-22 16:05:44 +03:00
};
}