diff --git a/nixos/viridian/configuration.nix b/nixos/viridian/configuration.nix index bb3286c..8d52e07 100644 --- a/nixos/viridian/configuration.nix +++ b/nixos/viridian/configuration.nix @@ -15,7 +15,9 @@ ./services/minecraft ./services/mpd ./services/paperless-ngx + ./services/postgresql ./services/traefik + ./services/wiki-js # Multimedia ./multimedia/jellyfin diff --git a/nixos/viridian/hardware-configuration.nix b/nixos/viridian/hardware-configuration.nix index e30e398..7fa9529 100644 --- a/nixos/viridian/hardware-configuration.nix +++ b/nixos/viridian/hardware-configuration.nix @@ -57,18 +57,12 @@ fsType = "ext4"; }; - fileSystems."/srv/containers" = { + fileSystems."/srv/multimedia/containers" = { device = "/dev/disk/by-label/data"; fsType = "btrfs"; options = ["subvol=containers" "compress=zstd"]; }; - fileSystems."/srv/services" = { - device = "/dev/disk/by-label/data"; - fsType = "btrfs"; - options = ["subvol=services" "compress=zstd"]; - }; - fileSystems."/srv/shares" = { device = "/dev/disk/by-label/data"; fsType = "btrfs"; diff --git a/nixos/viridian/multimedia/jellyfin/default.nix b/nixos/viridian/multimedia/jellyfin/default.nix index 5c73611..480e68c 100644 --- a/nixos/viridian/multimedia/jellyfin/default.nix +++ b/nixos/viridian/multimedia/jellyfin/default.nix @@ -16,8 +16,8 @@ in { # Media library "/srv/multimedia/library:/media:ro" # Container data - "/srv/containers/jellyfin/config:/config:rw" - "/srv/containers/jellyfin/cache:/cache:rw" + "/srv/multimedia/containers/jellyfin/config:/config:rw" + "/srv/multimedia/containers/jellyfin/cache:/cache:rw" ]; environment = { PUID = "1000"; diff --git a/nixos/viridian/multimedia/lidarr/default.nix b/nixos/viridian/multimedia/lidarr/default.nix index 12f4abf..e2f9820 100644 --- a/nixos/viridian/multimedia/lidarr/default.nix +++ b/nixos/viridian/multimedia/lidarr/default.nix @@ -13,7 +13,7 @@ in { # Media library "/srv/multimedia:/data:rw" # Container data - "/srv/containers/lidarr:/config:rw" + "/srv/multimedia/containers/lidarr:/config:rw" ]; environment = { PUID = "1000"; diff --git a/nixos/viridian/multimedia/prowlarr/default.nix b/nixos/viridian/multimedia/prowlarr/default.nix index 09e6c55..011713f 100644 --- a/nixos/viridian/multimedia/prowlarr/default.nix +++ b/nixos/viridian/multimedia/prowlarr/default.nix @@ -11,7 +11,7 @@ in { ]; volumes = [ # Container data - "/srv/containers/prowlarr:/config:rw" + "/srv/multimedia/containers/prowlarr:/config:rw" ]; environment = { PUID = "1000"; diff --git a/nixos/viridian/multimedia/qbittorrent/default.nix b/nixos/viridian/multimedia/qbittorrent/default.nix index f31b9af..5ad3fee 100644 --- a/nixos/viridian/multimedia/qbittorrent/default.nix +++ b/nixos/viridian/multimedia/qbittorrent/default.nix @@ -13,7 +13,7 @@ in { volumes = [ # Seedbox "/srv/multimedia/torrents:/data/torrents:rw" - "/srv/containers/qbittorrent:/config:rw" + "/srv/multimedia/containers/qbittorrent:/config:rw" ]; environment = { PUID = "1000"; diff --git a/nixos/viridian/multimedia/radarr/default.nix b/nixos/viridian/multimedia/radarr/default.nix index 26af091..95ac698 100644 --- a/nixos/viridian/multimedia/radarr/default.nix +++ b/nixos/viridian/multimedia/radarr/default.nix @@ -13,7 +13,7 @@ in { # Media library "/srv/multimedia:/data:rw" # Container data - "/srv/containers/radarr:/config:rw" + "/srv/multimedia/containers/radarr:/config:rw" ]; environment = { PUID = "1000"; diff --git a/nixos/viridian/multimedia/sonarr/default.nix b/nixos/viridian/multimedia/sonarr/default.nix index af1007f..be12dcd 100644 --- a/nixos/viridian/multimedia/sonarr/default.nix +++ b/nixos/viridian/multimedia/sonarr/default.nix @@ -13,7 +13,7 @@ in { # Media library "/srv/multimedia:/data:rw" # Container data - "/srv/containers/sonarr:/config:rw" + "/srv/multimedia/containers/sonarr:/config:rw" ]; environment = { PUID = "1000"; diff --git a/nixos/viridian/services/borgbackup/default.nix b/nixos/viridian/services/borgbackup/default.nix index 142feae..18f4f2f 100644 --- a/nixos/viridian/services/borgbackup/default.nix +++ b/nixos/viridian/services/borgbackup/default.nix @@ -5,20 +5,27 @@ services.borgbackup.jobs."borgbase" = { paths = [ - # Shares - "/srv/shares/sajenim" # Services - "/srv/services/forgejo" - "/srv/services/immich" - "/srv/services/minecraft" - "/srv/services/paperless-ngx" - # Containers - "/srv/containers/jellyfin" - "/srv/containers/lidarr" - "/srv/containers/prowlarr" - "/srv/containers/qbittorrent" - "/srv/containers/radarr" - "/srv/containers/sonarr" + "/srv/minecraft" + "/srv/shares/sajenim" + "/srv/www/sajenim.dev" + "/var/lib/crowdsec" + "/var/lib/forgejo" + "/var/lib/immich" + "/var/lib/paperless-ngx" + "/var/lib/postgresql" + "/var/lib/private/wiki-js" + "/var/lib/redis-immich" + "/var/lib/redis-paperless" + "/var/lib/traefik" + "/var/lib/wiki-js" + # Multimedia + "/srv/multimedia/containers/jellyfin" + "/srv/multimedia/containers/lidarr" + "/srv/multimedia/containers/prowlarr" + "/srv/multimedia/containers/qbittorrent" + "/srv/multimedia/containers/radarr" + "/srv/multimedia/containers/sonarr" ]; repo = "o93k24r6@o93k24r6.repo.borgbase.com:repo"; diff --git a/nixos/viridian/services/forgejo/default.nix b/nixos/viridian/services/forgejo/default.nix index 6890c4a..119d348 100644 --- a/nixos/viridian/services/forgejo/default.nix +++ b/nixos/viridian/services/forgejo/default.nix @@ -1,7 +1,7 @@ {config, ...}: { services.forgejo = { enable = true; - stateDir = "/srv/services/forgejo"; + stateDir = "/var/lib/forgejo"; settings = { server = { DOMAIN = "git.sajenim.dev"; @@ -35,4 +35,14 @@ {url = "http://127.0.0.1:${toString config.services.forgejo.settings.server.HTTP_PORT}";} ]; }; + + environment.persistence."/persist" = { + directories = [ + { + directory = "/var/lib/forgejo"; + user = "forgejo"; + group = "forgejo"; + } + ]; + }; } diff --git a/nixos/viridian/services/immich/default.nix b/nixos/viridian/services/immich/default.nix index 67dbea3..58f1884 100644 --- a/nixos/viridian/services/immich/default.nix +++ b/nixos/viridian/services/immich/default.nix @@ -20,7 +20,7 @@ port = 5489; host = "0.0.0.0"; openFirewall = true; - mediaLocation = "/srv/services/immich/library"; + mediaLocation = "/var/lib/immich"; secretsFile = config.age.secrets.immich.path; database = { enable = true; @@ -52,4 +52,19 @@ {url = "http://127.0.0.1:${toString config.services.immich.port}";} ]; }; + + environment.persistence."/persist" = { + directories = [ + { + directory = "/var/lib/immich"; + user = "immich"; + group = "immich"; + } + { + directory = "/var/lib/redis-immich"; + user = "immich"; + group = "immich"; + } + ]; + }; } diff --git a/nixos/viridian/services/lighttpd/default.nix b/nixos/viridian/services/lighttpd/default.nix index ec976b8..b5ef007 100644 --- a/nixos/viridian/services/lighttpd/default.nix +++ b/nixos/viridian/services/lighttpd/default.nix @@ -2,7 +2,7 @@ services.lighttpd = { enable = true; port = 5624; - document-root = "/srv/services/websites/sajenim.dev"; + document-root = "/srv/www/sajenim.dev"; }; services.traefik.dynamicConfigOptions.http.routers = { @@ -24,4 +24,14 @@ {url = "http://127.0.0.1:${toString config.services.lighttpd.port}";} ]; }; + + environment.persistence."/persist" = { + directories = [ + { + directory = "/srv/www"; + user = "lighttpd"; + group = "lighttpd"; + } + ]; + }; } diff --git a/nixos/viridian/services/minecraft/default.nix b/nixos/viridian/services/minecraft/default.nix index 3e9748e..1203bbb 100644 --- a/nixos/viridian/services/minecraft/default.nix +++ b/nixos/viridian/services/minecraft/default.nix @@ -70,7 +70,7 @@ in { }; # Each server will be under a subdirectory named after the server name. - dataDir = "/srv/services/minecraft"; + dataDir = "/srv/minecraft"; # Open firewall for all servers. openFirewall = true; @@ -97,4 +97,14 @@ in { {url = "http://127.0.0.1:${toString config.services.minecraft-servers.servers.kanto.serverProperties.server-port}";} ]; }; + + environment.persistence."/persist" = { + directories = [ + { + directory = "/srv/minecraft"; + user = "minecraft"; + group = "minecraft"; + } + ]; + }; } diff --git a/nixos/viridian/services/paperless-ngx/default.nix b/nixos/viridian/services/paperless-ngx/default.nix index 9a3826a..e04d79a 100644 --- a/nixos/viridian/services/paperless-ngx/default.nix +++ b/nixos/viridian/services/paperless-ngx/default.nix @@ -1,5 +1,5 @@ {config, ...}: let - dir = "/srv/services/paperless-ngx"; + dir = "/var/lib/paperless-ngx"; in { age.secrets.paperless-ngx = { rekeyFile = ./password.age; @@ -34,4 +34,19 @@ in { {url = "http://127.0.0.1:${toString config.services.paperless.port}";} ]; }; + + environment.persistence."/persist" = { + directories = [ + { + directory = "/var/lib/paperless-ngx"; + user = "paperless"; + group = "paperless"; + } + { + directory = "/var/lib/redis-paperless"; + user = "redis-paperless"; + group = "redis-paperless"; + } + ]; + }; } diff --git a/nixos/viridian/services/traefik/default.nix b/nixos/viridian/services/traefik/default.nix index 5466e9d..3bba7fc 100644 --- a/nixos/viridian/services/traefik/default.nix +++ b/nixos/viridian/services/traefik/default.nix @@ -98,6 +98,11 @@ main = "sajenim.dev"; sans = ["*.sajenim.dev"]; } + # Keyboards + { + main = "sajkbd.io"; + sans = ["*.sajkbd.io"]; + } ]; }; };