refactor: store port as integer

This commit is contained in:
wi11-holdsworth 2025-12-29 14:00:36 +11:00
parent 0f2801f823
commit 4502e197bf
19 changed files with 64 additions and 93 deletions

View file

@ -2,12 +2,11 @@
# keep-sorted start # keep-sorted start
config, config,
inputs, inputs,
lib,
# keep-sorted end # keep-sorted end
... ...
}: }:
let let
port = "5000"; port = 5000;
in in
{ {
imports = [ inputs.copyparty.nixosModules.default ]; imports = [ inputs.copyparty.nixosModules.default ];
@ -20,7 +19,7 @@ in
e2dsa = true; e2dsa = true;
e2ts = true; e2ts = true;
e2vu = true; e2vu = true;
p = lib.toInt port; p = port;
}; };
accounts.will.passwordFile = config.age.secrets.copyparty-will.path; accounts.will.passwordFile = config.age.secrets.copyparty-will.path;
@ -37,7 +36,7 @@ in
nginx.virtualHosts."copyparty.fi33.buzz" = { nginx.virtualHosts."copyparty.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };

View file

@ -1,9 +1,5 @@
{
lib,
...
}:
let let
port = "5984"; port = 5984;
in in
{ {
services = { services = {
@ -12,7 +8,7 @@ in
databaseDir = "/srv/couchdb"; databaseDir = "/srv/couchdb";
viewIndexDir = "/srv/couchdb"; viewIndexDir = "/srv/couchdb";
configFile = "/srv/couchdb"; configFile = "/srv/couchdb";
port = lib.toInt port; inherit port;
extraConfig = { extraConfig = {
chttpd = { chttpd = {
require_valid_user = true; require_valid_user = true;
@ -41,7 +37,7 @@ in
nginx.virtualHosts."couchdb.fi33.buzz" = { nginx.virtualHosts."couchdb.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };
} }

View file

@ -1,21 +1,17 @@
{
lib,
...
}:
let let
port = "5011"; port = 5011;
in in
{ {
services = { services = {
flaresolverr = { flaresolverr = {
enable = true; enable = true;
port = lib.toInt port; inherit port;
}; };
nginx.virtualHosts."flaresolverr.fi33.buzz" = { nginx.virtualHosts."flaresolverr.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };
} }

View file

@ -7,7 +7,7 @@
... ...
}: }:
let let
port = "5004"; port = 5004;
genSecrets = genSecrets =
secrets: secrets:
lib.genAttrs secrets (secret: { lib.genAttrs secrets (secret: {
@ -38,7 +38,7 @@ in
services = { services = {
homepage-dashboard = { homepage-dashboard = {
enable = true; enable = true;
listenPort = lib.toInt port; listenPort = port;
allowedHosts = "homepage-dashboard.fi33.buzz"; allowedHosts = "homepage-dashboard.fi33.buzz";
services = [ services = [
# keep-sorted start block=yes # keep-sorted start block=yes
@ -300,7 +300,7 @@ in
nginx.virtualHosts."homepage-dashboard.fi33.buzz" = { nginx.virtualHosts."homepage-dashboard.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };

View file

@ -1,15 +1,11 @@
{
lib,
...
}:
let let
port = "2283"; port = 2283;
in in
{ {
services = { services = {
immich = { immich = {
enable = true; enable = true;
port = lib.toInt "${port}"; inherit port;
mediaLocation = "/srv/immich"; mediaLocation = "/srv/immich";
}; };
@ -28,7 +24,7 @@ in
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/" = { locations."/" = {
proxyPass = "http://[::1]:${port}"; proxyPass = "http://[::1]:${toString port}";
proxyWebsockets = true; proxyWebsockets = true;
}; };
}; };

View file

@ -1,5 +1,5 @@
let let
port = "8096"; port = 8096;
in in
{ {
services = { services = {
@ -12,7 +12,7 @@ in
nginx.virtualHosts."jellyfin.fi33.buzz" = { nginx.virtualHosts."jellyfin.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };

View file

@ -1,12 +1,12 @@
let let
port = "5014"; port = 5014;
in in
{ {
services = { services = {
karakeep = { karakeep = {
enable = true; enable = true;
extraEnvironment = { extraEnvironment = {
PORT = port; PORT = toString port;
DISABLE_NEW_RELEASE_CHECK = "true"; DISABLE_NEW_RELEASE_CHECK = "true";
}; };
}; };
@ -14,7 +14,7 @@ in
nginx.virtualHosts."karakeep.fi33.buzz" = { nginx.virtualHosts."karakeep.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };
} }

View file

@ -1,23 +1,21 @@
{
lib,
...
}:
let let
port = "5012"; port = 5012;
in in
{ {
services = { services = {
lidarr = { lidarr = {
enable = true; enable = true;
dataDir = "/srv/lidarr"; dataDir = "/srv/lidarr";
settings.server.port = lib.toInt port; settings.server = {
inherit port;
};
group = "media"; group = "media";
}; };
nginx.virtualHosts."lidarr.fi33.buzz" = { nginx.virtualHosts."lidarr.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };
} }

View file

@ -3,7 +3,7 @@
... ...
}: }:
let let
port = "5010"; port = 5010;
in in
{ {
services = { services = {
@ -12,7 +12,7 @@ in
adminCredentialsFile = config.age.secrets.miniflux-creds.path; adminCredentialsFile = config.age.secrets.miniflux-creds.path;
config = { config = {
BASE_URL = "https://miniflux.fi33.buzz"; BASE_URL = "https://miniflux.fi33.buzz";
LISTEN_ADDR = "localhost:${port}"; LISTEN_ADDR = "localhost:${toString port}";
}; };
}; };
@ -28,7 +28,7 @@ in
nginx.virtualHosts."miniflux.fi33.buzz" = { nginx.virtualHosts."miniflux.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };

View file

@ -1,5 +1,5 @@
let let
port = "5002"; port = 5002;
in in
{ {
services = { services = {
@ -7,7 +7,7 @@ in
enable = true; enable = true;
settings = { settings = {
base-url = "https://ntfy-sh.fi33.buzz"; base-url = "https://ntfy-sh.fi33.buzz";
listen-http = ":${port}"; listen-http = ":${toString port}";
behind-proxy = true; behind-proxy = true;
}; };
}; };
@ -16,7 +16,7 @@ in
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/" = { locations."/" = {
proxyPass = "http://localhost:${port}"; proxyPass = "http://localhost:${toString port}";
proxyWebsockets = true; proxyWebsockets = true;
}; };
}; };

View file

@ -1,10 +1,9 @@
{ {
config, config,
lib,
... ...
}: }:
let let
port = "5013"; port = 5013;
in in
{ {
services = { services = {
@ -13,7 +12,7 @@ in
dataDir = "/srv/paperless"; dataDir = "/srv/paperless";
database.createLocally = true; database.createLocally = true;
passwordFile = config.age.secrets.paperless.path; passwordFile = config.age.secrets.paperless.path;
port = lib.toInt port; inherit port;
settings = { settings = {
PAPERLESS_URL = "https://paperless.fi33.buzz"; PAPERLESS_URL = "https://paperless.fi33.buzz";
}; };
@ -33,7 +32,7 @@ in
nginx.virtualHosts."paperless.fi33.buzz" = { nginx.virtualHosts."paperless.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };

View file

@ -1,26 +1,21 @@
{
lib,
...
}:
let let
port = "5009"; port = 5009;
in in
{ {
services = { services = {
prowlarr = { prowlarr = {
enable = true; enable = true;
dataDir = "/srv/prowlarr"; dataDir = "/srv/prowlarr";
settings.server.port = lib.toInt port; settings.server = {
inherit port;
};
}; };
nginx = { nginx = {
virtualHosts."prowlarr.fi33.buzz" = { virtualHosts."prowlarr.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/" = { locations."/".proxyPass = "http://localhost:${toString port}";
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
};
}; };
}; };
}; };

View file

@ -1,15 +1,11 @@
{
lib,
...
}:
let let
port = "5005"; port = 5005;
in in
{ {
services = { services = {
qbittorrent = { qbittorrent = {
enable = true; enable = true;
webuiPort = lib.toInt port; webuiPort = port;
profileDir = "/srv"; profileDir = "/srv";
group = "media"; group = "media";
extraArgs = [ extraArgs = [
@ -20,7 +16,7 @@ in
nginx.virtualHosts."qbittorrent.fi33.buzz" = { nginx.virtualHosts."qbittorrent.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };

View file

@ -1,23 +1,21 @@
{
lib,
...
}:
let let
port = "5007"; port = 5007;
in in
{ {
services = { services = {
radarr = { radarr = {
enable = true; enable = true;
dataDir = "/srv/radarr"; dataDir = "/srv/radarr";
settings.server.port = lib.toInt port; settings.server = {
inherit port;
};
group = "media"; group = "media";
}; };
nginx.virtualHosts."radarr.fi33.buzz" = { nginx.virtualHosts."radarr.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };
} }

View file

@ -3,7 +3,7 @@
... ...
}: }:
let let
port = "5003"; port = 5003;
in in
{ {
services = { services = {
@ -12,8 +12,8 @@ in
settings = { settings = {
server = { server = {
hosts = [ hosts = [
"0.0.0.0:${port}" "0.0.0.0:${toString port}"
"[::]:${port}" "[::]:${toString port}"
]; ];
}; };
auth = { auth = {
@ -30,7 +30,7 @@ in
nginx.virtualHosts."radicale.fi33.buzz" = { nginx.virtualHosts."radicale.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };

View file

@ -1,23 +1,21 @@
{
lib,
...
}:
let let
port = "5006"; port = 5006;
in in
{ {
services = { services = {
sonarr = { sonarr = {
enable = true; enable = true;
dataDir = "/srv/sonarr"; dataDir = "/srv/sonarr";
settings.server.port = lib.toInt port; settings.server = {
inherit port;
};
group = "media"; group = "media";
}; };
nginx.virtualHosts."sonarr.fi33.buzz" = { nginx.virtualHosts."sonarr.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };
} }

View file

@ -4,7 +4,7 @@
... ...
}: }:
let let
port = "5008"; port = 5008;
devicesList = [ devicesList = [
# keep-sorted start block=yes # keep-sorted start block=yes
{ {
@ -45,7 +45,7 @@ in
services = { services = {
syncthing = { syncthing = {
enable = true; enable = true;
guiAddress = "0.0.0.0:${port}"; guiAddress = "0.0.0.0:${toString port}";
openDefaultPorts = true; openDefaultPorts = true;
user = "${userName}"; user = "${userName}";
dataDir = "/home/${userName}"; dataDir = "/home/${userName}";
@ -69,7 +69,7 @@ in
nginx.virtualHosts."syncthing.fi33.buzz" = { nginx.virtualHosts."syncthing.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };
} }

View file

@ -3,7 +3,7 @@
... ...
}: }:
let let
port = "5001"; port = 5001;
in in
{ {
services = { services = {
@ -11,7 +11,7 @@ in
enable = true; enable = true;
backupDir = "/srv/vaultwarden"; backupDir = "/srv/vaultwarden";
config = { config = {
rocketPort = "${port}"; rocketPort = toString port;
domain = "https://vaultwarden.fi33.buzz"; domain = "https://vaultwarden.fi33.buzz";
signupsAllowed = false; signupsAllowed = false;
invitationsAllowed = false; invitationsAllowed = false;
@ -26,7 +26,7 @@ in
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/" = { locations."/" = {
proxyPass = "http://localhost:${port}"; proxyPass = "http://localhost:${toString port}";
proxyWebsockets = true; proxyWebsockets = true;
}; };
}; };

View file

@ -1,5 +1,5 @@
let let
port = "port"; port = 0000;
in in
{ {
services = { services = {
@ -12,7 +12,7 @@ in
nginx.virtualHosts."feature.fi33.buzz" = { nginx.virtualHosts."feature.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}"; locations."/".proxyPass = "http://localhost:${toString port}";
}; };
}; };
} }