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
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2023-08-15 23:37:06 +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";
|
2024-03-06 10:33:48 +02:00
|
|
|
username = "motiejus";
|
2023-07-22 16:05:44 +03:00
|
|
|
|
|
|
|
base = {
|
2023-07-26 13:58:42 +03:00
|
|
|
zfs.enable = true;
|
2023-08-18 16:39:03 +03:00
|
|
|
users = {
|
2024-02-04 16:18:47 +02:00
|
|
|
enable = true;
|
2024-03-06 10:33:48 +02:00
|
|
|
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 13:58:42 +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";
|
2023-09-11 17:25:12 +03:00
|
|
|
dirs = [
|
2023-09-11 17:50:35 +03:00
|
|
|
# TODO merge
|
2023-09-11 17:25:12 +03:00
|
|
|
{
|
|
|
|
mountpoint = "/var/lib";
|
2023-08-22 15:18:24 +03:00
|
|
|
repo = "zh2769@zh2769.rsync.net:${config.networking.hostName}.${config.networking.domain}-var_lib";
|
|
|
|
paths = [
|
2023-09-15 11:04:20 +03:00
|
|
|
"bitwarden_rs"
|
|
|
|
"caddy"
|
2023-11-22 22:19:20 +02:00
|
|
|
"hass"
|
2023-09-15 11:04:20 +03:00
|
|
|
"nsd-acme"
|
|
|
|
"tailscale"
|
|
|
|
"private/soju"
|
2023-08-22 15:18:24 +03:00
|
|
|
];
|
2023-09-21 06:55:17 +03:00
|
|
|
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:25:12 +03:00
|
|
|
}
|
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 = [
|
2023-09-15 11:04:20 +03:00
|
|
|
"bitwarden_rs"
|
|
|
|
"caddy"
|
2023-11-22 22:19:20 +02:00
|
|
|
"hass"
|
2023-09-15 11:04:20 +03:00
|
|
|
"nsd-acme"
|
|
|
|
"tailscale"
|
|
|
|
"private/soju"
|
2023-09-11 17:50:35 +03:00
|
|
|
];
|
2023-09-21 06:55:17 +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-09-11 17:50:35 +03:00
|
|
|
# TODO: merge
|
2023-09-11 17:25:12 +03:00
|
|
|
{
|
|
|
|
mountpoint = "/var/log";
|
2023-08-25 19:41:26 +03:00
|
|
|
repo = "zh2769@zh2769.rsync.net:${config.networking.hostName}.${config.networking.domain}-var_log";
|
2024-07-29 15:39:54 +03:00
|
|
|
paths = [ "caddy" ];
|
2023-08-25 19:41:26 +03:00
|
|
|
patterns = [
|
2023-09-15 11:04:20 +03:00
|
|
|
"+ caddy/access-jakstys.lt.log-*.zst"
|
2023-08-25 19:41:26 +03:00
|
|
|
"- *"
|
|
|
|
];
|
2024-03-24 17:42:19 +02:00
|
|
|
backup_at = "*-*-* 01:30:00 UTC";
|
2023-09-11 17:25:12 +03:00
|
|
|
}
|
2023-09-11 17:40:47 +03:00
|
|
|
{
|
|
|
|
mountpoint = "/var/log";
|
2024-07-29 15:39:54 +03:00
|
|
|
repo = "borgstor@${
|
|
|
|
myData.hosts."vno3-rp3b.servers.jakst".jakstIP
|
|
|
|
}:${config.networking.hostName}.${config.networking.domain}-var_log";
|
|
|
|
paths = [ "caddy" ];
|
2023-09-11 17:40:47 +03:00
|
|
|
patterns = [
|
2023-09-15 11:04:20 +03:00
|
|
|
"+ caddy/access-jakstys.lt.log-*.zst"
|
2023-09-11 17:40:47 +03:00
|
|
|
"- *"
|
|
|
|
];
|
2024-03-24 17:42:19 +02:00
|
|
|
backup_at = "*-*-* 01:30:00 UTC";
|
2023-09-11 17:40:47 +03:00
|
|
|
}
|
|
|
|
|
2023-09-11 17:50:35 +03:00
|
|
|
# TODO merge
|
2023-09-11 17:25:12 +03:00
|
|
|
{
|
|
|
|
mountpoint = "/home";
|
2023-07-26 14:23:12 +03:00
|
|
|
repo = "zh2769@zh2769.rsync.net:${config.networking.hostName}.${config.networking.domain}-home-motiejus-annex2";
|
2024-07-30 22:46:29 +03:00
|
|
|
paths = [ "motiejus/annex2" ];
|
2024-03-24 17:42:19 +02:00
|
|
|
backup_at = "*-*-* 02:00:00 UTC";
|
2023-09-11 17:50:35 +03:00
|
|
|
}
|
|
|
|
{
|
|
|
|
mountpoint = "/home";
|
2024-07-29 15:39:54 +03:00
|
|
|
repo = "borgstor@${
|
|
|
|
myData.hosts."vno3-rp3b.servers.jakst".jakstIP
|
|
|
|
}:${config.networking.hostName}.${config.networking.domain}-home-motiejus-annex2";
|
2024-07-30 22:46:29 +03:00
|
|
|
paths = [ "motiejus/annex2" ];
|
2024-03-24 17:42:19 +02:00
|
|
|
backup_at = "*-*-* 02:00:00 UTC";
|
2023-09-11 17:25:12 +03:00
|
|
|
}
|
|
|
|
];
|
2023-07-26 14:23:12 +03:00
|
|
|
};
|
|
|
|
|
2023-07-26 13:58:42 +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
|
|
|
];
|
2023-10-22 20:14:25 +03:00
|
|
|
|
2023-09-14 14:37:55 +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-11-14 09:01:02 +02:00
|
|
|
hass.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;
|
|
|
|
"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-10-01 23:26:01 +03:00
|
|
|
|
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-08-14 08:46:41 +03:00
|
|
|
caddy = {
|
|
|
|
enable = true;
|
2023-08-25 10:14:10 +03:00
|
|
|
email = "motiejus+acme@jakstys.lt";
|
2023-09-06 17:44:30 +03:00
|
|
|
globalConfig = ''
|
|
|
|
servers {
|
|
|
|
metrics
|
|
|
|
}
|
|
|
|
'';
|
2024-08-03 06:10:03 +03:00
|
|
|
virtualHosts =
|
|
|
|
let
|
|
|
|
fwminex-vno1 = myData.hosts."fwminex.servers.jakst".vno1IP;
|
|
|
|
fwminex-jakst = myData.hosts."fwminex.servers.jakst".jakstIP;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
"www.11sync.net".extraConfig = "redir https://jakstys.lt/2024/11sync-shutdown/";
|
|
|
|
"11sync.net".extraConfig = "redir https://jakstys.lt/2024/11sync-shutdown/";
|
2024-08-03 06:16:00 +03:00
|
|
|
"vpn.jakstys.lt".extraConfig = ''reverse_proxy ${fwminex-vno1}:${toString myData.ports.headscale}'';
|
2024-08-03 06:10:03 +03:00
|
|
|
"git.jakstys.lt".extraConfig = ''reverse_proxy http://${fwminex-vno1}'';
|
|
|
|
"hass.jakstys.lt:80".extraConfig = ''
|
2024-07-29 15:39:54 +03:00
|
|
|
@denied not remote_ip ${myData.subnets.tailscale.cidr}
|
|
|
|
abort @denied
|
2024-08-03 06:23:30 +03:00
|
|
|
reverse_proxy 127.0.0.1:${toString myData.ports.hass}
|
2024-07-29 15:39:54 +03:00
|
|
|
'';
|
2024-08-03 06:10:03 +03:00
|
|
|
"grafana.jakstys.lt:80".extraConfig = ''
|
|
|
|
@denied not remote_ip ${myData.subnets.tailscale.cidr}
|
|
|
|
abort @denied
|
2024-08-03 06:12:35 +03:00
|
|
|
reverse_proxy ${fwminex-jakst}:${toString myData.ports.grafana}
|
2023-11-27 18:17:27 +02:00
|
|
|
'';
|
2024-08-03 06:10:03 +03:00
|
|
|
"bitwarden.jakstys.lt".extraConfig = ''
|
|
|
|
@denied not remote_ip ${myData.subnets.tailscale.cidr}
|
|
|
|
abort @denied
|
|
|
|
tls {$CREDENTIALS_DIRECTORY}/bitwarden.jakstys.lt-cert.pem {$CREDENTIALS_DIRECTORY}/bitwarden.jakstys.lt-key.pem
|
|
|
|
|
|
|
|
# from https://github.com/dani-garcia/vaultwarden/wiki/Proxy-examples
|
|
|
|
encode gzip
|
|
|
|
header {
|
|
|
|
# Enable HTTP Strict Transport Security (HSTS)
|
|
|
|
Strict-Transport-Security "max-age=31536000;"
|
|
|
|
# Enable cross-site filter (XSS) and tell browser to block detected attacks
|
|
|
|
X-XSS-Protection "1; mode=block"
|
|
|
|
# Disallow the site to be rendered within a frame (clickjacking protection)
|
|
|
|
X-Frame-Options "SAMEORIGIN"
|
2023-11-27 18:17:27 +02:00
|
|
|
}
|
2023-08-25 16:44:41 +03:00
|
|
|
|
2024-08-03 06:10:03 +03:00
|
|
|
reverse_proxy 127.0.0.1:${toString myData.ports.vaultwarden} {
|
|
|
|
header_up X-Real-IP {remote_host}
|
2023-11-27 18:17:27 +02:00
|
|
|
}
|
2024-08-03 06:10:03 +03:00
|
|
|
'';
|
|
|
|
"www.jakstys.lt".extraConfig = ''
|
|
|
|
redir https://jakstys.lt
|
|
|
|
'';
|
|
|
|
"irc.jakstys.lt".extraConfig =
|
|
|
|
let
|
|
|
|
gamja = pkgs.compressDrvWeb (pkgs.gamja.override {
|
|
|
|
gamjaConfig = {
|
|
|
|
server = {
|
|
|
|
url = "irc.jakstys.lt:6698";
|
|
|
|
nick = "motiejus";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}) { };
|
|
|
|
in
|
|
|
|
''
|
|
|
|
@denied not remote_ip ${myData.subnets.tailscale.cidr}
|
|
|
|
abort @denied
|
|
|
|
tls {$CREDENTIALS_DIRECTORY}/irc.jakstys.lt-cert.pem {$CREDENTIALS_DIRECTORY}/irc.jakstys.lt-key.pem
|
|
|
|
|
|
|
|
root * ${gamja}
|
|
|
|
file_server browse {
|
|
|
|
precompressed br gzip
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
"dl.jakstys.lt".extraConfig = ''
|
|
|
|
root * /var/www/dl
|
|
|
|
file_server browse {
|
|
|
|
hide .stfolder
|
2023-11-27 18:17:27 +02:00
|
|
|
}
|
2024-08-03 06:10:03 +03:00
|
|
|
encode gzip
|
2023-11-27 18:17:27 +02:00
|
|
|
'';
|
2024-08-03 06:10:03 +03:00
|
|
|
"jakstys.lt" = {
|
|
|
|
logFormat = ''
|
|
|
|
output file ${config.services.caddy.logDir}/access-jakstys.lt.log {
|
|
|
|
roll_disabled
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
extraConfig = ''
|
|
|
|
header Strict-Transport-Security "max-age=31536000"
|
|
|
|
|
|
|
|
header /_/* Cache-Control "public, max-age=31536000, immutable"
|
|
|
|
|
|
|
|
root * /var/www/jakstys.lt
|
|
|
|
file_server {
|
|
|
|
precompressed br gzip
|
|
|
|
}
|
|
|
|
|
|
|
|
handle /.well-known/carddav {
|
|
|
|
redir https://cdav.migadu.com/
|
|
|
|
}
|
|
|
|
handle /.well-known/caldav {
|
|
|
|
redir https://cdav.migadu.com/
|
|
|
|
}
|
|
|
|
|
|
|
|
@matrixMatch {
|
|
|
|
path /.well-known/matrix/client
|
|
|
|
path /.well-known/matrix/server
|
|
|
|
}
|
|
|
|
header @matrixMatch Content-Type application/json
|
|
|
|
header @matrixMatch Access-Control-Allow-Origin *
|
|
|
|
header @matrixMatch Cache-Control "public, max-age=3600, immutable"
|
|
|
|
|
|
|
|
handle /.well-known/matrix/client {
|
|
|
|
respond "{\"m.homeserver\": {\"base_url\": \"https://jakstys.lt\"}}" 200
|
|
|
|
}
|
|
|
|
handle /.well-known/matrix/server {
|
|
|
|
respond "{\"m.server\": \"jakstys.lt:443\"}" 200
|
|
|
|
}
|
|
|
|
|
|
|
|
handle /_matrix/* {
|
|
|
|
reverse_proxy http://127.0.0.1:${toString myData.ports.matrix-synapse}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
2023-11-27 18:17:27 +02:00
|
|
|
};
|
2023-08-14 08:46:41 +03:00
|
|
|
};
|
|
|
|
|
2023-08-25 17:03:01 +03:00
|
|
|
logrotate = {
|
|
|
|
settings = {
|
|
|
|
"/var/log/caddy/access-jakstys.lt.log" = {
|
|
|
|
rotate = -1;
|
|
|
|
frequency = "daily";
|
|
|
|
dateext = true;
|
|
|
|
dateyesterday = true;
|
|
|
|
compress = true;
|
|
|
|
compresscmd = "${pkgs.zstd}/bin/zstd";
|
|
|
|
compressext = ".zst";
|
|
|
|
compressoptions = "--long -19";
|
|
|
|
uncompresscmd = "${pkgs.zstd}/bin/unzstd";
|
|
|
|
postrotate = "${pkgs.systemd}/bin/systemctl restart caddy";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
|
|
|
vaultwarden = {
|
|
|
|
enable = true;
|
2023-09-07 10:51:27 +03:00
|
|
|
|
2023-09-07 08:29:14 +03:00
|
|
|
config = {
|
|
|
|
ROCKET_ADDRESS = "127.0.0.1";
|
|
|
|
ROCKET_PORT = myData.ports.vaultwarden;
|
2023-09-07 14:26:00 +03:00
|
|
|
LOG_LEVEL = "warn";
|
2023-09-07 10:51:27 +03:00
|
|
|
DOMAIN = "https://bitwarden.jakstys.lt";
|
2023-09-07 14:26:00 +03:00
|
|
|
SIGNUPS_ALLOWED = false;
|
2023-09-07 13:04:38 +03:00
|
|
|
INVITATION_ORG_NAME = "jakstys";
|
2023-09-07 14:29:08 +03:00
|
|
|
PUSH_ENABLED = true;
|
2023-09-07 08:29:14 +03:00
|
|
|
|
2023-09-07 13:51:43 +03:00
|
|
|
SMTP_HOST = "localhost";
|
2023-09-07 08:29:14 +03:00
|
|
|
SMTP_PORT = 25;
|
|
|
|
SMTP_SECURITY = "off";
|
2023-09-07 13:51:43 +03:00
|
|
|
SMTP_FROM = "admin@jakstys.lt";
|
|
|
|
SMTP_FROM_NAME = "Bitwarden at jakstys.lt";
|
2023-09-07 08:29:14 +03:00
|
|
|
};
|
|
|
|
};
|
2023-08-07 01:23:41 +03:00
|
|
|
|
2023-09-07 22:24:00 +03:00
|
|
|
minidlna = {
|
|
|
|
enable = true;
|
|
|
|
openFirewall = true;
|
|
|
|
settings = {
|
2024-07-29 15:39:54 +03:00
|
|
|
media_dir = [ "/home/motiejus/video" ];
|
2023-09-07 22:24:00 +03:00
|
|
|
friendly_name = "vno1-oh2";
|
|
|
|
inotify = "yes";
|
|
|
|
};
|
|
|
|
};
|
2024-01-25 12:15:59 +02:00
|
|
|
|
|
|
|
syncthing.relay = {
|
|
|
|
enable = true;
|
|
|
|
providedBy = "11sync.net";
|
|
|
|
};
|
2023-09-07 22:24:00 +03:00
|
|
|
};
|
2023-09-07 13:04:38 +03:00
|
|
|
|
2023-08-14 08:46:41 +03:00
|
|
|
systemd.services = {
|
2024-07-29 15:39:54 +03:00
|
|
|
caddy =
|
|
|
|
let
|
|
|
|
irc = config.mj.services.nsd-acme.zones."irc.jakstys.lt";
|
|
|
|
bitwarden = config.mj.services.nsd-acme.zones."bitwarden.jakstys.lt";
|
|
|
|
in
|
|
|
|
{
|
|
|
|
serviceConfig.LoadCredential = [
|
|
|
|
"irc.jakstys.lt-cert.pem:${irc.certFile}"
|
|
|
|
"irc.jakstys.lt-key.pem:${irc.keyFile}"
|
|
|
|
"bitwarden.jakstys.lt-cert.pem:${bitwarden.certFile}"
|
|
|
|
"bitwarden.jakstys.lt-key.pem:${bitwarden.keyFile}"
|
|
|
|
];
|
|
|
|
after = [
|
|
|
|
"nsd-acme-irc.jakstys.lt.service"
|
|
|
|
"nsd-acme-bitwarden.jakstys.lt.service"
|
|
|
|
];
|
|
|
|
requires = [
|
|
|
|
"nsd-acme-irc.jakstys.lt.service"
|
|
|
|
"nsd-acme-bitwarden.jakstys.lt.service"
|
2023-08-22 14:28:59 +03:00
|
|
|
];
|
|
|
|
};
|
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
|
|
|
|
2023-09-07 10:51:27 +03:00
|
|
|
vaultwarden = {
|
2023-09-07 13:04:38 +03:00
|
|
|
preStart = "ln -sf $CREDENTIALS_DIRECTORY/secrets.env /run/vaultwarden/secrets.env";
|
2023-09-07 10:51:27 +03:00
|
|
|
serviceConfig = {
|
2024-07-29 15:39:54 +03:00
|
|
|
EnvironmentFile = [ "-/run/vaultwarden/secrets.env" ];
|
2023-09-07 13:04:38 +03:00
|
|
|
RuntimeDirectory = "vaultwarden";
|
2024-07-29 15:39:54 +03:00
|
|
|
LoadCredential = [ "secrets.env:${config.age.secrets.vaultwarden-secrets-env.path}" ];
|
2023-09-07 10:51:27 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-08-14 08:46:41 +03:00
|
|
|
cert-watcher = {
|
|
|
|
description = "Restart caddy when tls keys/certs change";
|
2024-07-29 15:39:54 +03:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
2023-08-14 08:46:41 +03:00
|
|
|
unitConfig = {
|
|
|
|
StartLimitIntervalSec = 10;
|
|
|
|
StartLimitBurst = 5;
|
|
|
|
};
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
ExecStart = "${pkgs.systemd}/bin/systemctl restart caddy.service";
|
|
|
|
};
|
|
|
|
};
|
2023-09-07 22:31:02 +03:00
|
|
|
|
|
|
|
minidlna = {
|
|
|
|
serviceConfig = {
|
|
|
|
ProtectSystem = "strict";
|
|
|
|
ProtectHome = "tmpfs";
|
2024-07-29 15:39:54 +03:00
|
|
|
BindReadOnlyPaths = [ "/home/motiejus/video" ];
|
2023-09-07 22:31:02 +03:00
|
|
|
};
|
|
|
|
};
|
2023-12-27 23:41:00 +02:00
|
|
|
|
2024-02-22 10:08:19 +02:00
|
|
|
syncthing-relay.restartIfChanged = false;
|
|
|
|
|
2023-08-14 08:46:41 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
systemd.paths = {
|
|
|
|
cert-watcher = {
|
2024-07-29 15:39:54 +03:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
2023-08-14 08:46:41 +03:00
|
|
|
pathConfig = {
|
|
|
|
PathChanged = [
|
2024-02-12 16:01:29 +02:00
|
|
|
config.mj.services.nsd-acme.zones."irc.jakstys.lt".certFile
|
2023-09-07 08:29:14 +03:00
|
|
|
config.mj.services.nsd-acme.zones."bitwarden.jakstys.lt".certFile
|
2023-08-14 08:46:41 +03:00
|
|
|
];
|
|
|
|
Unit = "cert-watcher.service";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|