2024-07-22 21:59:59 +03:00
|
|
|
{
|
|
|
|
pkgs,
|
2024-07-23 22:01:40 +03:00
|
|
|
config,
|
2024-08-02 14:01:04 +03:00
|
|
|
myData,
|
2024-07-22 21:59:59 +03:00
|
|
|
...
|
2024-07-29 15:39:54 +03:00
|
|
|
}:
|
|
|
|
let
|
2024-07-16 05:40:40 +03:00
|
|
|
nvme = "/dev/disk/by-id/nvme-Samsung_SSD_970_EVO_Plus_2TB_S6P1NS0TA01331A_1";
|
2024-07-29 15:39:54 +03:00
|
|
|
in
|
|
|
|
{
|
2024-04-12 22:13:34 +03:00
|
|
|
imports = [
|
2024-07-16 05:40:40 +03:00
|
|
|
../../modules
|
|
|
|
../../modules/profiles/btrfs
|
2024-04-12 22:13:34 +03:00
|
|
|
];
|
|
|
|
|
2024-08-27 08:50:57 +03:00
|
|
|
age.secrets = {
|
2024-08-27 08:57:17 +03:00
|
|
|
motiejus-server-passwd-hash.file = ../../secrets/motiejus_server_passwd_hash.age;
|
|
|
|
root-server-passwd-hash.file = ../../secrets/root_server_passwd_hash.age;
|
|
|
|
sasl-passwd.file = ../../secrets/postfix_sasl_passwd.age;
|
|
|
|
headscale-client-oidc.file = ../../secrets/headscale/oidc_client_secret2.age;
|
|
|
|
borgbackup-password.file = ../../secrets/fwminex/borgbackup-password.age;
|
|
|
|
grafana-oidc.file = ../../secrets/grafana.jakstys.lt/oidc.age;
|
|
|
|
letsencrypt-account-key.file = ../../secrets/letsencrypt/account.key.age;
|
|
|
|
vaultwarden-secrets-env.file = ../../secrets/vaultwarden/secrets.env.age;
|
|
|
|
photoprism-admin-passwd.file = ../../secrets/photoprism/admin_password.age;
|
|
|
|
synapse-jakstys-signing-key.file = ../../secrets/synapse/jakstys_lt_signing_key.age;
|
|
|
|
synapse-registration-shared-secret.file = ../../secrets/synapse/registration_shared_secret.age;
|
|
|
|
synapse-macaroon-secret-key.file = ../../secrets/synapse/macaroon_secret_key.age;
|
|
|
|
syncthing-key.file = ../../secrets/fwminex/syncthing/key.pem.age;
|
|
|
|
syncthing-cert.file = ../../secrets/fwminex/syncthing/cert.pem.age;
|
2024-08-27 08:50:57 +03:00
|
|
|
|
|
|
|
ssh8022-server = {
|
|
|
|
file = ../../secrets/ssh8022.age;
|
|
|
|
owner = "spiped";
|
|
|
|
path = "/var/lib/spiped/ssh8022.key";
|
|
|
|
};
|
2024-08-25 11:07:35 +03:00
|
|
|
};
|
|
|
|
|
2023-11-28 22:57:58 +02:00
|
|
|
boot = {
|
2024-07-29 15:39:54 +03:00
|
|
|
kernelModules = [ "kvm-intel" ];
|
2023-11-28 22:57:58 +02:00
|
|
|
loader.systemd-boot.enable = true;
|
2024-07-16 05:40:40 +03:00
|
|
|
initrd = {
|
2024-08-28 08:09:36 +03:00
|
|
|
systemd.enable = true;
|
2024-07-29 15:39:54 +03:00
|
|
|
kernelModules = [ "usb_storage" ];
|
|
|
|
availableKernelModules = [
|
|
|
|
"xhci_pci"
|
|
|
|
"thunderbolt"
|
|
|
|
"nvme"
|
|
|
|
"usbhid"
|
|
|
|
"tpm_tis"
|
|
|
|
];
|
2024-07-16 05:40:40 +03:00
|
|
|
luks.devices = {
|
|
|
|
luksroot = {
|
|
|
|
device = "${nvme}-part3";
|
|
|
|
allowDiscards = true;
|
|
|
|
};
|
|
|
|
};
|
2023-11-28 22:57:58 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-07-16 05:40:40 +03:00
|
|
|
swapDevices = [
|
|
|
|
{
|
|
|
|
device = "${nvme}-part2";
|
|
|
|
randomEncryption.enable = true;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2023-11-28 22:57:58 +02:00
|
|
|
fileSystems = {
|
|
|
|
"/" = {
|
2024-07-16 05:40:40 +03:00
|
|
|
device = "/dev/mapper/luksroot";
|
|
|
|
fsType = "btrfs";
|
2024-07-29 15:39:54 +03:00
|
|
|
options = [ "compress=zstd" ];
|
2023-11-28 22:57:58 +02:00
|
|
|
};
|
|
|
|
"/boot" = {
|
2024-07-16 05:40:40 +03:00
|
|
|
device = "${nvme}-part1";
|
2023-11-28 22:57:58 +02:00
|
|
|
fsType = "vfat";
|
|
|
|
};
|
2023-09-13 12:17:43 +03:00
|
|
|
};
|
|
|
|
|
2023-09-14 12:40:16 +03:00
|
|
|
hardware.cpu.intel.updateMicrocode = true;
|
|
|
|
nixpkgs.hostPlatform = "x86_64-linux";
|
|
|
|
|
2024-08-03 13:30:10 +03:00
|
|
|
systemd = {
|
|
|
|
tmpfiles.rules = [ "d /var/www 0755 motiejus users -" ];
|
|
|
|
|
|
|
|
services = {
|
2024-09-13 16:29:02 +03:00
|
|
|
weather-exporter = {
|
|
|
|
description = "Weather exporter for Vilnius";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
after = [ "network.target.target" ];
|
|
|
|
path = with pkgs; [
|
|
|
|
coreutils
|
|
|
|
jq
|
|
|
|
curl
|
|
|
|
bash
|
|
|
|
];
|
|
|
|
serviceConfig = {
|
2024-09-15 07:36:17 +03:00
|
|
|
type = "simple";
|
2024-09-15 07:47:47 +03:00
|
|
|
ExecStart = "${pkgs.weather}/bin/weather -l 127.0.0.1:${toString myData.ports.exporters.weather}";
|
2024-09-15 08:26:49 +03:00
|
|
|
DynamicUser = true;
|
2024-09-13 16:29:02 +03:00
|
|
|
};
|
|
|
|
};
|
2024-08-03 13:30:10 +03:00
|
|
|
caddy =
|
|
|
|
let
|
|
|
|
irc = config.mj.services.nsd-acme.zones."irc.jakstys.lt";
|
|
|
|
grafana = config.mj.services.nsd-acme.zones."grafana.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}"
|
|
|
|
"grafana.jakstys.lt-cert.pem:${grafana.certFile}"
|
|
|
|
"grafana.jakstys.lt-key.pem:${grafana.keyFile}"
|
|
|
|
"bitwarden.jakstys.lt-cert.pem:${bitwarden.certFile}"
|
|
|
|
"bitwarden.jakstys.lt-key.pem:${bitwarden.keyFile}"
|
|
|
|
];
|
|
|
|
after = [
|
|
|
|
"nsd-acme-irc.jakstys.lt.service"
|
|
|
|
"nsd-acme-grafana.jakstys.lt.service"
|
|
|
|
"nsd-acme-bitwarden.jakstys.lt.service"
|
|
|
|
];
|
|
|
|
requires = [
|
|
|
|
"nsd-acme-irc.jakstys.lt.service"
|
|
|
|
"nsd-acme-grafana.jakstys.lt.service"
|
|
|
|
"nsd-acme-bitwarden.jakstys.lt.service"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-08-03 13:54:29 +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" ];
|
|
|
|
};
|
2024-08-03 13:30:10 +03:00
|
|
|
|
|
|
|
cert-watcher = {
|
|
|
|
description = "Restart caddy when tls keys/certs change";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
unitConfig = {
|
|
|
|
StartLimitIntervalSec = 10;
|
|
|
|
StartLimitBurst = 5;
|
|
|
|
};
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
ExecStart = "${pkgs.systemd}/bin/systemctl restart caddy.service";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
paths = {
|
|
|
|
cert-watcher = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
pathConfig = {
|
|
|
|
PathChanged = [
|
|
|
|
config.mj.services.nsd-acme.zones."irc.jakstys.lt".certFile
|
|
|
|
config.mj.services.nsd-acme.zones."grafana.jakstys.lt".certFile
|
|
|
|
config.mj.services.nsd-acme.zones."bitwarden.jakstys.lt".certFile
|
|
|
|
];
|
|
|
|
Unit = "cert-watcher.service";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-09-14 15:26:16 +03:00
|
|
|
|
2024-07-22 21:59:59 +03:00
|
|
|
services = {
|
|
|
|
pcscd.enable = true;
|
|
|
|
acpid.enable = true;
|
|
|
|
fwupd.enable = true;
|
2024-07-23 22:04:08 +03:00
|
|
|
logind = {
|
|
|
|
lidSwitch = "ignore";
|
|
|
|
powerKey = "suspend";
|
|
|
|
powerKeyLongPress = "poweroff";
|
|
|
|
};
|
2024-08-02 14:31:24 +03:00
|
|
|
|
2024-08-03 13:54:29 +03:00
|
|
|
soju = {
|
|
|
|
enable = true;
|
|
|
|
listen = [
|
|
|
|
":${toString myData.ports.soju}"
|
|
|
|
"wss://:${toString myData.ports.soju-ws}"
|
|
|
|
];
|
|
|
|
tlsCertificate = "/run/soju/cert.pem";
|
|
|
|
tlsCertificateKey = "/run/soju/key.pem";
|
|
|
|
hostName = "irc.jakstys.lt";
|
|
|
|
httpOrigins = [ "*" ];
|
|
|
|
extraConfig = ''
|
|
|
|
message-store fs /var/lib/soju
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-08-02 14:31:24 +03:00
|
|
|
caddy = {
|
|
|
|
enable = true;
|
2024-08-03 13:30:10 +03:00
|
|
|
email = "motiejus+acme@jakstys.lt";
|
2024-08-02 14:31:24 +03:00
|
|
|
globalConfig = ''
|
2024-08-03 06:14:17 +03:00
|
|
|
servers {
|
|
|
|
metrics
|
|
|
|
}
|
2024-08-02 14:31:24 +03:00
|
|
|
'';
|
2024-08-03 18:00:16 +03:00
|
|
|
virtualHosts = {
|
|
|
|
"www.11sync.net".extraConfig = "redir https://jakstys.lt/2024/11sync-shutdown/";
|
|
|
|
"11sync.net".extraConfig = "redir https://jakstys.lt/2024/11sync-shutdown/";
|
|
|
|
"vpn.jakstys.lt".extraConfig = ''reverse_proxy 127.0.0.1:${toString myData.ports.headscale}'';
|
|
|
|
"hass.jakstys.lt:80".extraConfig = ''
|
|
|
|
@denied not remote_ip ${myData.subnets.tailscale.cidr}
|
|
|
|
abort @denied
|
|
|
|
reverse_proxy 127.0.0.1:${toString myData.ports.hass}
|
|
|
|
'';
|
|
|
|
"grafana.jakstys.lt".extraConfig = ''
|
2024-08-03 13:30:10 +03:00
|
|
|
@denied not remote_ip ${myData.subnets.tailscale.cidr}
|
|
|
|
abort @denied
|
2024-08-03 18:00:16 +03:00
|
|
|
reverse_proxy 127.0.0.1:${toString myData.ports.grafana}
|
|
|
|
tls {$CREDENTIALS_DIRECTORY}/grafana.jakstys.lt-cert.pem {$CREDENTIALS_DIRECTORY}/grafana.jakstys.lt-key.pem
|
|
|
|
'';
|
|
|
|
"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
|
2024-08-03 13:30:10 +03:00
|
|
|
|
2024-08-03 18:00:16 +03:00
|
|
|
# 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"
|
|
|
|
}
|
2024-08-03 13:30:10 +03:00
|
|
|
|
2024-08-03 18:00:16 +03:00
|
|
|
reverse_proxy 127.0.0.1:${toString myData.ports.vaultwarden} {
|
|
|
|
header_up X-Real-IP {remote_host}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
"www.jakstys.lt".extraConfig = ''
|
|
|
|
redir https://jakstys.lt
|
|
|
|
'';
|
|
|
|
"irc.jakstys.lt".extraConfig =
|
|
|
|
let
|
2024-08-22 13:08:53 +03:00
|
|
|
gamja = pkgs.pkgs-unstable.compressDrvWeb (pkgs.gamja.override {
|
2024-08-03 18:00:16 +03:00
|
|
|
gamjaConfig = {
|
|
|
|
server = {
|
|
|
|
url = "irc.jakstys.lt:6698";
|
|
|
|
nick = "motiejus";
|
2024-08-03 13:30:10 +03:00
|
|
|
};
|
2024-08-03 18:00:16 +03:00
|
|
|
};
|
|
|
|
}) { };
|
|
|
|
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
|
2024-08-03 13:30:10 +03:00
|
|
|
|
2024-08-03 18:00:16 +03:00
|
|
|
root * ${gamja}
|
2024-08-03 13:30:10 +03:00
|
|
|
file_server browse {
|
2024-08-24 18:45:51 +03:00
|
|
|
precompressed zstd br gzip
|
2024-08-03 13:30:10 +03:00
|
|
|
}
|
|
|
|
'';
|
2024-08-03 18:00:16 +03:00
|
|
|
"dl.jakstys.lt".extraConfig = ''
|
|
|
|
root * /var/www/dl
|
|
|
|
file_server browse {
|
|
|
|
hide .stfolder
|
|
|
|
}
|
|
|
|
encode gzip
|
|
|
|
'';
|
|
|
|
"jakstys.lt".extraConfig = ''
|
2024-08-24 16:27:29 +03:00
|
|
|
header {
|
2024-08-24 17:10:23 +03:00
|
|
|
Strict-Transport-Security "max-age=15768000"
|
2024-08-24 16:27:29 +03:00
|
|
|
Content-Security-Policy "default-src 'self'"
|
|
|
|
X-Content-Type-Options "nosniff"
|
|
|
|
X-Frame-Options "DENY"
|
2024-08-03 13:30:10 +03:00
|
|
|
|
2024-08-24 16:27:29 +03:00
|
|
|
/_/* Cache-Control "public, max-age=31536000, immutable"
|
|
|
|
}
|
2024-08-03 13:30:10 +03:00
|
|
|
|
2024-08-03 18:00:16 +03:00
|
|
|
root * /var/www/jakstys.lt
|
|
|
|
file_server {
|
2024-08-24 18:45:51 +03:00
|
|
|
precompressed zstd br gzip
|
2024-08-03 18:00:16 +03:00
|
|
|
}
|
2024-08-03 13:30:10 +03:00
|
|
|
|
2024-08-03 18:00:16 +03:00
|
|
|
handle /.well-known/carddav {
|
|
|
|
redir https://cdav.migadu.com/
|
|
|
|
}
|
|
|
|
handle /.well-known/caldav {
|
|
|
|
redir https://cdav.migadu.com/
|
|
|
|
}
|
2024-08-03 18:57:29 +03:00
|
|
|
|
|
|
|
@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}
|
|
|
|
}
|
2024-08-03 18:00:16 +03:00
|
|
|
'';
|
|
|
|
};
|
2024-08-02 14:31:24 +03:00
|
|
|
};
|
2024-08-02 22:33:44 +03:00
|
|
|
|
2024-08-03 06:18:52 +03:00
|
|
|
nsd = {
|
|
|
|
enable = true;
|
|
|
|
interfaces = [
|
|
|
|
"0.0.0.0"
|
|
|
|
"::"
|
|
|
|
];
|
|
|
|
zones = {
|
|
|
|
"jakstys.lt.".data = myData.jakstysLTZone;
|
|
|
|
"11sync.net.".data = myData.e11syncZone;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-08-02 22:33:44 +03:00
|
|
|
prometheus = {
|
2024-08-03 05:43:54 +03:00
|
|
|
enable = true;
|
2024-08-02 22:33:44 +03:00
|
|
|
port = myData.ports.prometheus;
|
2024-09-13 09:09:02 +03:00
|
|
|
retentionTime = "2y";
|
2024-08-02 22:33:44 +03:00
|
|
|
|
|
|
|
globalConfig = {
|
2024-08-03 05:44:59 +03:00
|
|
|
scrape_interval = "10s";
|
2024-08-02 22:33:44 +03:00
|
|
|
evaluation_interval = "1m";
|
|
|
|
};
|
|
|
|
|
|
|
|
scrapeConfigs =
|
|
|
|
[
|
2024-09-16 15:10:54 +03:00
|
|
|
(
|
|
|
|
let
|
|
|
|
port = toString config.services.prometheus.exporters.ping.port;
|
|
|
|
hosts = [
|
|
|
|
"fwminex.servers.jakst"
|
|
|
|
"fra1-b.servers.jakst"
|
2024-09-17 11:40:34 +03:00
|
|
|
"vno3-rp3b.servers.jakst"
|
2024-09-16 15:10:54 +03:00
|
|
|
"vno1-gdrx.motiejus.jakst"
|
|
|
|
];
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
job_name = "ping";
|
|
|
|
relabel_configs = map (hostname: {
|
|
|
|
source_labels = [ "__address__" ];
|
|
|
|
regex = "${myData.hosts.${hostname}.jakstIP}:${port}";
|
|
|
|
replacement = "${hostname}:${port}";
|
2024-09-16 15:26:01 +03:00
|
|
|
target_label = "instance";
|
2024-09-16 15:10:54 +03:00
|
|
|
}) hosts;
|
2024-09-16 15:30:22 +03:00
|
|
|
static_configs = [ { targets = map (host: "${myData.hosts.${host}.jakstIP}:${port}") hosts; } ];
|
2024-09-16 15:10:54 +03:00
|
|
|
}
|
|
|
|
)
|
2024-08-02 22:33:44 +03:00
|
|
|
{
|
|
|
|
job_name = "prometheus";
|
|
|
|
static_configs = [ { targets = [ "127.0.0.1:${toString myData.ports.prometheus}" ]; } ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
job_name = "caddy";
|
|
|
|
static_configs = [ { targets = [ "127.0.0.1:${toString myData.ports.exporters.caddy}" ]; } ];
|
|
|
|
}
|
2024-09-12 17:11:48 +03:00
|
|
|
{
|
|
|
|
job_name = "hass_p7_50";
|
2024-09-13 09:09:02 +03:00
|
|
|
scrape_interval = "1m";
|
2024-09-12 17:11:48 +03:00
|
|
|
metrics_path = "/api/prometheus";
|
|
|
|
static_configs = [ { targets = [ "127.0.0.1:${toString myData.ports.hass}" ]; } ];
|
|
|
|
}
|
2024-09-13 16:32:21 +03:00
|
|
|
{
|
|
|
|
job_name = "weather";
|
2024-09-15 08:14:58 +03:00
|
|
|
scrape_interval = "10m";
|
2024-09-13 16:32:21 +03:00
|
|
|
static_configs = [ { targets = [ "127.0.0.1:${toString myData.ports.exporters.weather}" ]; } ];
|
|
|
|
}
|
2024-08-02 22:33:44 +03:00
|
|
|
{
|
|
|
|
job_name = "vno1-vinc.vincentas.jakst";
|
|
|
|
static_configs = [ { targets = [ "${myData.hosts."vno1-vinc.vincentas.jakst".jakstIP}:9100" ]; } ];
|
|
|
|
}
|
2024-08-03 18:11:44 +03:00
|
|
|
]
|
2024-09-16 14:49:07 +03:00
|
|
|
++ map
|
|
|
|
(
|
|
|
|
let
|
|
|
|
port = builtins.toString myData.ports.exporters.node;
|
|
|
|
in
|
|
|
|
s: {
|
2024-08-03 18:11:44 +03:00
|
|
|
job_name = s;
|
|
|
|
static_configs = [ { targets = [ "${myData.hosts.${s}.jakstIP}:${port}" ]; } ];
|
2024-09-16 14:49:07 +03:00
|
|
|
}
|
|
|
|
)
|
|
|
|
[
|
|
|
|
"fra1-b.servers.jakst"
|
|
|
|
"fwminex.servers.jakst"
|
|
|
|
"mtworx.motiejus.jakst"
|
|
|
|
"vno3-rp3b.servers.jakst"
|
|
|
|
"vno1-gdrx.motiejus.jakst"
|
|
|
|
];
|
2024-08-02 22:33:44 +03:00
|
|
|
};
|
2024-08-03 05:57:15 +03:00
|
|
|
|
2024-07-22 21:59:59 +03:00
|
|
|
};
|
|
|
|
|
2023-09-13 12:17:43 +03:00
|
|
|
mj = {
|
2024-07-16 05:40:40 +03:00
|
|
|
stateVersion = "24.05";
|
2023-09-13 12:17:43 +03:00
|
|
|
timeZone = "Europe/Vilnius";
|
2024-03-06 10:33:48 +02:00
|
|
|
username = "motiejus";
|
2023-09-13 12:17:43 +03:00
|
|
|
|
2024-07-31 09:40:05 +03:00
|
|
|
base = {
|
|
|
|
users = {
|
|
|
|
enable = true;
|
|
|
|
root.hashedPasswordFile = config.age.secrets.root-server-passwd-hash.path;
|
|
|
|
user.hashedPasswordFile = config.age.secrets.motiejus-server-passwd-hash.path;
|
|
|
|
};
|
|
|
|
|
|
|
|
unitstatus = {
|
|
|
|
enable = true;
|
|
|
|
email = "motiejus+alerts@jakstys.lt";
|
|
|
|
};
|
2023-09-13 12:17:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
services = {
|
2024-08-02 14:31:24 +03:00
|
|
|
gitea.enable = true;
|
2024-08-03 06:33:09 +03:00
|
|
|
hass.enable = true;
|
2024-08-03 18:11:44 +03:00
|
|
|
syncthing-relay.enable = true;
|
2024-08-25 11:37:56 +03:00
|
|
|
|
2024-09-16 14:49:07 +03:00
|
|
|
ping_exporter.enable = true;
|
|
|
|
|
|
|
|
node_exporter = {
|
|
|
|
enable = true;
|
|
|
|
extraSubnets = [ myData.subnets.vno1.cidr ];
|
|
|
|
};
|
|
|
|
|
2024-08-25 11:07:35 +03:00
|
|
|
ssh8022.server = {
|
|
|
|
enable = true;
|
|
|
|
keyfile = config.age.secrets.ssh8022-server.path;
|
|
|
|
};
|
2024-08-03 07:03:15 +03:00
|
|
|
|
2024-08-03 06:53:37 +03:00
|
|
|
vaultwarden = {
|
|
|
|
enable = true;
|
|
|
|
port = myData.ports.vaultwarden;
|
|
|
|
secretsEnvFile = config.age.secrets.vaultwarden-secrets-env.path;
|
|
|
|
};
|
2024-08-02 14:31:24 +03:00
|
|
|
|
2024-08-03 07:03:15 +03:00
|
|
|
minidlna = {
|
|
|
|
enable = true;
|
|
|
|
paths = [ "/home/motiejus/video" ];
|
|
|
|
};
|
|
|
|
|
2024-08-03 05:57:15 +03:00
|
|
|
grafana = {
|
|
|
|
enable = true;
|
|
|
|
port = myData.ports.grafana;
|
|
|
|
oidcSecretFile = config.age.secrets.grafana-oidc.path;
|
|
|
|
};
|
|
|
|
|
2023-11-15 00:29:22 +02:00
|
|
|
tailscale = {
|
|
|
|
enable = true;
|
2024-07-16 05:40:40 +03:00
|
|
|
verboseLogs = false;
|
2023-11-15 00:29:22 +02:00
|
|
|
};
|
2023-09-20 21:28:15 +03:00
|
|
|
|
2024-08-02 14:01:04 +03:00
|
|
|
headscale = {
|
|
|
|
enable = true;
|
|
|
|
clientOidcPath = config.age.secrets.headscale-client-oidc.path;
|
|
|
|
subnetCIDR = myData.subnets.tailscale.cidr;
|
|
|
|
};
|
|
|
|
|
2024-08-02 16:03:09 +03:00
|
|
|
photoprism = {
|
|
|
|
enable = true;
|
|
|
|
uidgid = myData.uidgid.photoprism;
|
2024-08-02 16:36:45 +03:00
|
|
|
paths = {
|
|
|
|
"M-Camera" = "/home/motiejus/annex2/M-Active";
|
|
|
|
"Pictures" = "/home/motiejus/annex2/Pictures";
|
|
|
|
};
|
2024-08-02 16:03:09 +03:00
|
|
|
passwordFile = config.age.secrets.photoprism-admin-passwd.path;
|
|
|
|
};
|
|
|
|
|
2024-08-03 13:30:10 +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;
|
|
|
|
"bitwarden.jakstys.lt".accountKey = accountKey;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-07-31 09:40:05 +03:00
|
|
|
btrfsborg = {
|
|
|
|
enable = true;
|
|
|
|
passwordPath = config.age.secrets.borgbackup-password.path;
|
|
|
|
sshKeyPath = "/etc/ssh/ssh_host_ed25519_key";
|
2024-07-31 11:25:28 +03:00
|
|
|
dirs =
|
|
|
|
builtins.concatMap
|
2024-07-31 11:27:41 +03:00
|
|
|
(
|
|
|
|
host:
|
|
|
|
let
|
|
|
|
prefix = "${host}:${config.networking.hostName}.${config.networking.domain}";
|
|
|
|
in
|
|
|
|
[
|
2024-08-02 14:17:03 +03:00
|
|
|
{
|
|
|
|
subvolume = "/var/lib";
|
|
|
|
repo = "${prefix}-var_lib";
|
2024-08-02 15:00:09 +03:00
|
|
|
paths = [
|
2024-08-03 06:33:09 +03:00
|
|
|
"hass"
|
2024-08-02 15:00:09 +03:00
|
|
|
"gitea"
|
2024-08-03 13:30:10 +03:00
|
|
|
"caddy"
|
2024-08-03 06:33:09 +03:00
|
|
|
"grafana"
|
|
|
|
"headscale"
|
2024-08-03 06:53:37 +03:00
|
|
|
"bitwarden_rs"
|
2024-08-03 19:09:23 +03:00
|
|
|
"matrix-synapse"
|
2024-08-03 13:54:29 +03:00
|
|
|
"private/soju"
|
2024-08-02 16:20:46 +03:00
|
|
|
"private/photoprism"
|
2024-08-02 15:00:09 +03:00
|
|
|
];
|
|
|
|
patterns = [ "- gitea/data/repo-archive/" ];
|
2024-08-02 14:17:03 +03:00
|
|
|
backup_at = "*-*-* 01:00:01 UTC";
|
|
|
|
}
|
2024-07-31 11:27:41 +03:00
|
|
|
{
|
|
|
|
subvolume = "/home";
|
|
|
|
repo = "${prefix}-home-motiejus-annex2";
|
|
|
|
paths = [ "motiejus/annex2" ];
|
|
|
|
backup_at = "*-*-* 02:30:01 UTC";
|
|
|
|
}
|
|
|
|
]
|
|
|
|
)
|
2024-07-31 11:25:28 +03:00
|
|
|
[
|
|
|
|
"zh2769@zh2769.rsync.net"
|
|
|
|
"borgstor@${myData.hosts."vno3-rp3b.servers.jakst".jakstIP}"
|
|
|
|
];
|
2024-07-31 09:40:05 +03:00
|
|
|
};
|
|
|
|
|
2024-07-29 16:44:35 +03:00
|
|
|
btrfssnapshot = {
|
|
|
|
enable = true;
|
|
|
|
subvolumes = [
|
2024-07-29 17:00:55 +03:00
|
|
|
{
|
|
|
|
subvolume = "/home";
|
|
|
|
label = "hourly";
|
|
|
|
keep = 24;
|
|
|
|
refreshInterval = "*:00:00";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
subvolume = "/home";
|
|
|
|
label = "nightly";
|
|
|
|
keep = 7;
|
|
|
|
refreshInterval = "daily UTC";
|
|
|
|
}
|
2024-07-29 16:44:35 +03:00
|
|
|
{
|
|
|
|
subvolume = "/var/lib";
|
|
|
|
label = "hourly";
|
|
|
|
keep = 24;
|
|
|
|
refreshInterval = "*:00:00";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
subvolume = "/var/lib";
|
|
|
|
label = "nightly";
|
|
|
|
keep = 7;
|
2024-07-29 16:54:48 +03:00
|
|
|
refreshInterval = "daily UTC";
|
2024-07-29 16:44:35 +03:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-07-30 22:46:29 +03:00
|
|
|
syncthing = {
|
|
|
|
enable = true;
|
|
|
|
dataDir = "/home/motiejus/";
|
|
|
|
user = "motiejus";
|
|
|
|
group = "users";
|
|
|
|
};
|
|
|
|
|
2024-08-03 18:57:29 +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 00:23:44 +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";
|
|
|
|
};
|
2024-07-16 05:40:40 +03:00
|
|
|
|
2023-09-13 12:17:43 +03:00
|
|
|
deployerbot = {
|
2024-07-28 22:35:34 +03:00
|
|
|
main = {
|
|
|
|
enable = true;
|
|
|
|
uidgid = myData.uidgid.updaterbot-deployer;
|
|
|
|
repo = "git@git.jakstys.lt:motiejus/config";
|
|
|
|
deployDerivations = [
|
2024-07-28 22:46:51 +03:00
|
|
|
".#fwminex"
|
2024-07-31 00:23:44 +03:00
|
|
|
".#fra1-b"
|
2024-07-28 22:46:51 +03:00
|
|
|
".#vno3-rp3b"
|
2024-07-28 22:35:34 +03:00
|
|
|
];
|
|
|
|
deployIfPresent = [
|
|
|
|
{
|
|
|
|
derivationTarget = ".#mtworx";
|
|
|
|
pingTarget = myData.hosts."mtworx.motiejus.jakst".jakstIP;
|
|
|
|
}
|
2024-08-05 16:41:24 +03:00
|
|
|
{
|
|
|
|
derivationTarget = ".#vno1-gdrx";
|
|
|
|
pingTarget = myData.hosts."vno1-gdrx.motiejus.jakst".jakstIP;
|
|
|
|
}
|
2024-07-28 22:35:34 +03:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-09-13 12:17:43 +03:00
|
|
|
follower = {
|
2024-07-31 09:19:13 +03:00
|
|
|
publicKeys = [ myData.hosts."fwminex.servers.jakst".publicKey ];
|
2023-10-01 23:14:05 +03:00
|
|
|
|
2023-09-13 12:17:43 +03:00
|
|
|
enable = true;
|
|
|
|
uidgid = myData.uidgid.updaterbot-deployee;
|
2024-07-29 15:39:54 +03:00
|
|
|
sshAllowSubnets = with myData.subnets; [ tailscale.sshPattern ];
|
2023-09-13 12:17:43 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-07-23 22:01:40 +03:00
|
|
|
postfix = {
|
|
|
|
enable = true;
|
|
|
|
saslPasswdPath = config.age.secrets.sasl-passwd.path;
|
|
|
|
};
|
2024-08-02 22:33:44 +03:00
|
|
|
|
|
|
|
friendlyport.ports = [
|
|
|
|
{
|
|
|
|
subnets = [ myData.subnets.tailscale.cidr ];
|
|
|
|
tcp = with myData.ports; [
|
|
|
|
80
|
|
|
|
443
|
2024-08-03 13:54:29 +03:00
|
|
|
soju
|
|
|
|
soju-ws
|
2024-08-02 22:33:44 +03:00
|
|
|
prometheus
|
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
2023-09-13 12:17:43 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-07-22 21:59:59 +03:00
|
|
|
environment = {
|
|
|
|
systemPackages = with pkgs; [
|
2024-07-28 21:43:19 +03:00
|
|
|
acpi
|
2024-08-03 06:18:52 +03:00
|
|
|
yt-dlp
|
|
|
|
ffmpeg
|
|
|
|
imapsync
|
2024-08-07 17:30:19 +03:00
|
|
|
rtorrent
|
2024-07-22 21:59:59 +03:00
|
|
|
age-plugin-yubikey
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-09-13 12:17:43 +03:00
|
|
|
networking = {
|
2024-07-16 05:40:40 +03:00
|
|
|
hostId = "a6b19da0";
|
2023-09-13 12:17:43 +03:00
|
|
|
hostName = "fwminex";
|
2024-07-31 11:29:08 +03:00
|
|
|
domain = "servers.jakst";
|
2024-08-02 14:47:01 +03:00
|
|
|
firewall = {
|
|
|
|
rejectPackets = true;
|
|
|
|
allowedUDPPorts = [
|
|
|
|
53
|
|
|
|
80
|
|
|
|
443
|
|
|
|
];
|
|
|
|
allowedTCPPorts = [
|
|
|
|
53
|
|
|
|
80
|
|
|
|
443
|
|
|
|
];
|
|
|
|
};
|
2023-09-13 12:17:43 +03:00
|
|
|
};
|
|
|
|
}
|