Compare commits
9
Commits
65f278e02f
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32c756fde5 | ||
|
|
c92b90e406 | ||
|
|
c1d2e52bf8 | ||
|
|
5f231b86cb | ||
|
|
a459f9cc57 | ||
|
|
0bfdb35014 | ||
|
|
8a9638fbcc | ||
|
|
c6e58b7cb0 | ||
|
|
73ec97cf3a |
No files matched your search
@@ -6,22 +6,26 @@
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./docs-manager
|
||||
./gitea
|
||||
./homarr
|
||||
./immich
|
||||
./it-tools
|
||||
./jellyfin
|
||||
./mihomo
|
||||
./mirotalk
|
||||
./monitoring
|
||||
./netbird
|
||||
./omni-tools
|
||||
./pocket-id
|
||||
./seafile
|
||||
./stalwart
|
||||
./transmute
|
||||
./turn
|
||||
./vaultwarden
|
||||
./zapret2
|
||||
@@ -93,6 +97,25 @@ in
|
||||
gid = "1000";
|
||||
};
|
||||
};
|
||||
docs-manager = {
|
||||
enable = true;
|
||||
targetName = "docs-manager";
|
||||
paperless-ngx = {
|
||||
name = "paperless-ngx";
|
||||
subdomain = "docs";
|
||||
hostHttpPort = 6030;
|
||||
};
|
||||
postgres = {
|
||||
name = "paperless-ngx-db";
|
||||
};
|
||||
redis = {
|
||||
name = "paperless-ngx-redis";
|
||||
};
|
||||
tika = {
|
||||
name = "paperless-ngx-tika";
|
||||
gotenbergName = "paperless-ngx-gotenberg";
|
||||
};
|
||||
};
|
||||
jellyfin = {
|
||||
enable = false;
|
||||
targetName = "jellyfin";
|
||||
@@ -137,6 +160,12 @@ in
|
||||
user = "immich";
|
||||
};
|
||||
};
|
||||
it-tools = {
|
||||
enable = true;
|
||||
name = "it-tools";
|
||||
subdomain = "it-tools";
|
||||
hostHttpPort = 6040;
|
||||
};
|
||||
mihomo = {
|
||||
enable = false;
|
||||
targetName = "mihomo";
|
||||
@@ -212,6 +241,12 @@ in
|
||||
name = "monitor-node-exporter";
|
||||
};
|
||||
};
|
||||
omni-tools = {
|
||||
enable = true;
|
||||
name = "omni-tools";
|
||||
subdomain = "omni";
|
||||
hostHttpPort = 6050;
|
||||
};
|
||||
pocket-id = {
|
||||
enable = true;
|
||||
targetName = "pocket-id";
|
||||
@@ -253,12 +288,19 @@ in
|
||||
hostHttpPort = 5054;
|
||||
};
|
||||
};
|
||||
transmute = {
|
||||
enable = true;
|
||||
name = "transmute";
|
||||
subdomain = "convert";
|
||||
hostHttpPort = 6010;
|
||||
};
|
||||
mail = {
|
||||
enable = true;
|
||||
targetName = "mail";
|
||||
hostPorts =
|
||||
let
|
||||
cfg = config.selfhosted.mail.stalwart;
|
||||
moduleCfg = rootCfg.mail;
|
||||
cfg = moduleCfg.stalwart;
|
||||
in
|
||||
[
|
||||
cfg.hostImapsPort
|
||||
@@ -307,15 +349,15 @@ in
|
||||
};
|
||||
|
||||
virtualisation = lib.mkMerge [
|
||||
{ oci-containers.backend = config.selfhosted.common.backend; }
|
||||
{ oci-containers.backend = rootCfg.common.backend; }
|
||||
(
|
||||
if config.selfhosted.common.backend == "docker" then
|
||||
if rootCfg.common.backend == "docker" then
|
||||
{
|
||||
docker = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
else if config.selfhosted.common.backend == "podman" then
|
||||
else if rootCfg.common.backend == "podman" then
|
||||
{
|
||||
podman = {
|
||||
enable = true;
|
||||
@@ -345,7 +387,7 @@ in
|
||||
};
|
||||
|
||||
sops.templates."netbird-homelab.env".content = ''
|
||||
NB_MANAGEMENT_URL=https://${cfg.netbird.subdomain}.${config.sops.placeholder."domains/serv"}
|
||||
NB_MANAGEMENT_URL=https://${rootCfg.netbird.subdomain}.${config.sops.placeholder."domains/serv"}
|
||||
'';
|
||||
|
||||
systemd.services = {
|
||||
@@ -387,16 +429,16 @@ in
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
requires = [
|
||||
"${common.backend}-network-${common.network.name}.service" # wait for network creation
|
||||
"${common.backend}-${config.selfhosted.netbird.traefik.name}.service"
|
||||
"${common.backend}-${rootCfg.netbird.traefik.name}.service"
|
||||
];
|
||||
after = [
|
||||
"${common.backend}-network-${common.network.name}.service"
|
||||
"${common.backend}-${config.selfhosted.netbird.traefik.name}.service"
|
||||
"${common.backend}-${rootCfg.netbird.traefik.name}.service"
|
||||
];
|
||||
};
|
||||
|
||||
networking.firewall.interfaces = lib.mkMerge [
|
||||
(lib.mkIf (config.selfhosted.common.backend == "podman") (
|
||||
(lib.mkIf (rootCfg.common.backend == "podman") (
|
||||
let
|
||||
matchAll = if !config.networking.nftables.enable then "podman+" else "podman*";
|
||||
in
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.docs-manager;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./paperless-ngx
|
||||
./postgres
|
||||
./redis
|
||||
./tika
|
||||
];
|
||||
|
||||
options.selfhosted.docs-manager = {
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf moduleCfg.enable {
|
||||
systemd.targets."${common.backend}-${moduleCfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${moduleCfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
after = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.docs-manager;
|
||||
cfg = moduleCfg.paperless-ngx;
|
||||
domain = "${config.sops.placeholder."domains/serv"}";
|
||||
pocketIdSubdomain = rootCfg.pocket-id.subdomain;
|
||||
socialAccountProviders = builtins.toJSON {
|
||||
openid_connect = {
|
||||
OAUTH_PKCE_ENABLED = true;
|
||||
SCOPE = [
|
||||
"openid"
|
||||
"profile"
|
||||
"email"
|
||||
];
|
||||
APPS = [
|
||||
{
|
||||
provider_id = "paperless-ngx";
|
||||
name = "PocketID";
|
||||
client_id = "paperless-ngx";
|
||||
secret = config.sops.placeholder."paperless-ngx/client_secret";
|
||||
settings = {
|
||||
server_url = "https://${pocketIdSubdomain}.${domain}";
|
||||
token_auth_method = "client_secret_basic";
|
||||
fetch_userinfo = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"paperless-ngx/client_secret" = { };
|
||||
"paperless-ngx/secret_key" = { };
|
||||
};
|
||||
|
||||
sops.templates."paperless-ngx.env".content = ''
|
||||
USERMAP_UID=${common.user.uid}
|
||||
USERMAP_GID=${common.group.gid}
|
||||
PAPERLESS_URL=https://${cfg.subdomain}.${domain}
|
||||
PAPERLESS_SECRET_KEY=${config.sops.placeholder."paperless-ngx/secret_key"}
|
||||
PAPERLESS_TIME_ZONE=${config.time.timeZone}
|
||||
PAPERLESS_REDIS=redis://${moduleCfg.redis.name}:6379
|
||||
PAPERLESS_DBENGINE=postgresql
|
||||
PAPERLESS_DBHOST=${moduleCfg.postgres.name}
|
||||
PAPERLESS_DBPORT=5432
|
||||
PAPERLESS_DBNAME=paperless
|
||||
PAPERLESS_DBUSER=paperless
|
||||
PAPERLESS_DBPASS=${config.sops.placeholder."paperless-ngx/db_password"}
|
||||
PAPERLESS_APPS=allauth.socialaccount.providers.openid_connect
|
||||
PAPERLESS_SOCIAL_AUTO_SIGNUP=true
|
||||
PAPERLESS_SOCIAL_ACCOUNT_DEFAULT_GROUPS=users
|
||||
PAPERLESS_ACCOUNT_EMAIL_VERIFICATION=none
|
||||
PAPERLESS_SOCIALACCOUNT_PROVIDERS=${socialAccountProviders}
|
||||
PAPERLESS_OCR_LANGUAGE=eng+rus
|
||||
PAPERLESS_OCR_LANGUAGES=eng rus
|
||||
|
||||
PAPERLESS_TIKA_ENABLED=1
|
||||
PAPERLESS_TIKA_GOTENBERG_ENDPOINT=http://${moduleCfg.tika.gotenbergName}:3000
|
||||
PAPERLESS_TIKA_ENDPOINT=http://${moduleCfg.tika.name}:9998
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.docs-manager;
|
||||
cfg = moduleCfg.paperless-ngx;
|
||||
hostDataPath = "${common.dataDir}/${cfg.name}";
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
|
||||
options.selfhosted.docs-manager.paperless-ngx = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
subdomain = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
hostHttpPort = mkOption {
|
||||
type = types.port;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "ghcr.io/paperless-ngx/paperless-ngx:2.15.3";
|
||||
ports = [
|
||||
"0.0.0.0:${toString cfg.hostHttpPort}:8000"
|
||||
];
|
||||
environmentFiles = [
|
||||
config.sops.templates."paperless-ngx.env".path
|
||||
];
|
||||
volumes = [
|
||||
"${hostDataPath}/data:/usr/src/paperless/data"
|
||||
"${hostDataPath}/media:/usr/src/paperless/media"
|
||||
"${hostDataPath}/export:/usr/src/paperless/export"
|
||||
"${hostDataPath}/consume:/usr/src/paperless/consume"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network=${common.network.name}"
|
||||
"--health-cmd=curl -fsS http://127.0.0.1:8000/"
|
||||
"--health-interval=30s"
|
||||
"--health-timeout=10s"
|
||||
"--health-retries=5"
|
||||
"--health-start-period=90s"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${cfg.name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
after = [
|
||||
"${common.backend}-${moduleCfg.redis.name}.service"
|
||||
"${common.backend}-${moduleCfg.postgres.name}.service"
|
||||
"${common.backend}-${moduleCfg.tika.gotenbergName}.service"
|
||||
"${common.backend}-${moduleCfg.tika.name}.service"
|
||||
];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/data ${hostDataPath}/media ${hostDataPath}/export ${hostDataPath}/consume
|
||||
chown -R ${common.user.uid}:${common.group.gid} ${hostDataPath}/data ${hostDataPath}/media ${hostDataPath}/export ${hostDataPath}/consume
|
||||
chmod -R 0775 ${hostDataPath}/data ${hostDataPath}/media ${hostDataPath}/export ${hostDataPath}/consume
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
moduleCfg = config.selfhosted.docs-manager;
|
||||
in
|
||||
{
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"paperless-ngx/db_password" = { };
|
||||
};
|
||||
|
||||
sops.templates."paperless-ngx-db.env".content = ''
|
||||
POSTGRES_DB=paperless
|
||||
POSTGRES_USER=paperless
|
||||
POSTGRES_PASSWORD=${config.sops.placeholder."paperless-ngx/db_password"}
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.docs-manager;
|
||||
cfg = moduleCfg.postgres;
|
||||
hostDataPath = "${common.dataDir}/${moduleCfg.paperless-ngx.name}";
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
|
||||
options.selfhosted.docs-manager.postgres = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "docker.io/library/postgres:17.7";
|
||||
environmentFiles = [ config.sops.templates."paperless-ngx-db.env".path ];
|
||||
volumes = [
|
||||
"${hostDataPath}/db:/var/lib/postgresql/data"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network=${common.network.name}"
|
||||
"--health-cmd=pg_isready -U paperless"
|
||||
"--health-interval=30s"
|
||||
"--health-timeout=10s"
|
||||
"--health-retries=3"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${cfg.name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/db
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.docs-manager;
|
||||
cfg = moduleCfg.redis;
|
||||
hostDataPath = "${common.dataDir}/${moduleCfg.paperless-ngx.name}";
|
||||
in
|
||||
{
|
||||
options.selfhosted.docs-manager.redis = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "docker.io/library/redis:7.4.11";
|
||||
volumes = [
|
||||
"${hostDataPath}/redis:/data"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network=${common.network.name}"
|
||||
"--health-cmd=redis-cli ping"
|
||||
"--health-interval=30s"
|
||||
"--health-timeout=10s"
|
||||
"--health-retries=3"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${cfg.name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/redis
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.docs-manager;
|
||||
cfg = moduleCfg.tika;
|
||||
in
|
||||
{
|
||||
options.selfhosted.docs-manager.tika = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
gotenbergName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.gotenbergName}" = {
|
||||
image = "docker.io/gotenberg/gotenberg:8.19.0";
|
||||
cmd = [
|
||||
"gotenberg"
|
||||
"--chromium-disable-javascript=true"
|
||||
"--chromium-allow-list=file:///tmp/.*"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network=${common.network.name}"
|
||||
];
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "docker.io/apache/tika:3.3.1.0";
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network=${common.network.name}"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${cfg.gotenbergName}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${cfg.name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.gitea;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.gitea;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -11,22 +12,22 @@ in
|
||||
];
|
||||
|
||||
options.selfhosted.gitea = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName} root target";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"gitea/db_password" = { };
|
||||
"gitea/client_id" = { };
|
||||
"gitea/client_secret" = { };
|
||||
};
|
||||
|
||||
systemd.targets."${common.backend}-${cfg.targetName}" = {
|
||||
systemd.targets."${common.backend}-${moduleCfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${cfg.targetName}";
|
||||
Description = "Root target for ${moduleCfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.gitea;
|
||||
moduleCfg = config.selfhosted.gitea;
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."gitea-db.env".content = ''
|
||||
POSTGRES_DB=gitea
|
||||
POSTGRES_USER=gitea
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.gitea;
|
||||
cfg = rootCfg.postgresql;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.gitea;
|
||||
cfg = moduleCfg.postgresql;
|
||||
hostDataPath = "${common.dataDir}/gitea";
|
||||
in
|
||||
{
|
||||
@@ -15,7 +16,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "postgres:16";
|
||||
environmentFiles = [ config.sops.templates."gitea-db.env".path ];
|
||||
@@ -36,8 +37,8 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/dbData
|
||||
chown 70:70 ${hostDataPath}/dbData
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.gitea;
|
||||
cfg = rootCfg.server;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.gitea;
|
||||
cfg = moduleCfg.server;
|
||||
domain = "${config.sops.placeholder."domains/serv"}";
|
||||
giteaDomain = "${cfg.subdomain}.${domain}";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."gitea.env".content = ''
|
||||
USER_UID=${common.user.uid}
|
||||
USER_GID=${common.group.gid}
|
||||
|
||||
GITEA__database__DB_TYPE=postgres
|
||||
GITEA__database__HOST=${rootCfg.postgresql.name}:5432
|
||||
GITEA__database__HOST=${moduleCfg.postgresql.name}:5432
|
||||
GITEA__database__NAME=gitea
|
||||
GITEA__database__USER=gitea
|
||||
GITEA__database__PASSWD=${config.sops.placeholder."gitea/db_password"}
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.gitea;
|
||||
cfg = rootCfg.server;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.gitea;
|
||||
cfg = moduleCfg.server;
|
||||
hostDataPath = "${common.dataDir}/gitea";
|
||||
in
|
||||
{
|
||||
@@ -32,9 +33,9 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "gitea/gitea:1.27.2";
|
||||
image = "docker.io/gitea/gitea:28.2.0";
|
||||
ports = [
|
||||
"0.0.0.0:${toString cfg.hostWebPort}:3000"
|
||||
"0.0.0.0:${toString cfg.hostSshPort}:2222"
|
||||
@@ -53,10 +54,10 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${rootCfg.postgresql.name}.service" ];
|
||||
after = [ "${common.backend}-${rootCfg.postgresql.name}.service" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${moduleCfg.postgresql.name}.service" ];
|
||||
after = [ "${common.backend}-${moduleCfg.postgresql.name}.service" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/data
|
||||
chown -R ${common.user.uid}:${common.group.gid} ${hostDataPath}/data
|
||||
@@ -82,7 +83,7 @@ in
|
||||
if ${pkgs.curl}/bin/curl -sf http://127.0.0.1:${toString cfg.hostWebPort}/api/v1/version >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
echo "Waiting for Gitea to be ready... ($i/20)"
|
||||
echo "Waiting for Gitea to be ready... ($i/30)"
|
||||
sleep 5
|
||||
done
|
||||
|
||||
@@ -98,7 +99,7 @@ in
|
||||
--provider "openidConnect" \
|
||||
--key "$CLIENT_ID" \
|
||||
--secret "$CLIENT_SECRET" \
|
||||
--auto-discover-url "https://${config.selfhosted.pocket-id.subdomain}.$DOMAIN/.well-known/openid-configuration" \
|
||||
--auto-discover-url "https://${rootCfg.pocket-id.subdomain}.$DOMAIN/.well-known/openid-configuration" \
|
||||
--scopes "openid email profile" \
|
||||
--skip-local-2fa
|
||||
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.homarr;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.homarr;
|
||||
in
|
||||
{
|
||||
imports = [ ./server ];
|
||||
|
||||
options.selfhosted.homarr = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName} root target";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"homarr/enc_key" = { };
|
||||
"homarr/client_id" = { };
|
||||
@@ -22,9 +23,9 @@ in
|
||||
"homarr/nextauth_secret" = { };
|
||||
};
|
||||
|
||||
systemd.targets."${common.backend}-${cfg.targetName}" = {
|
||||
systemd.targets."${common.backend}-${moduleCfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${cfg.targetName}";
|
||||
Description = "Root target for ${moduleCfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.homarr;
|
||||
poCfg = config.selfhosted.pocket-id;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.homarr;
|
||||
poCfg = rootCfg.pocket-id;
|
||||
oidpDomain = "https://${poCfg.subdomain}.${config.sops.placeholder."domains/serv"}";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."homarr.env" = {
|
||||
content = ''
|
||||
SECRET_ENCRYPTION_KEY=${config.sops.placeholder."homarr/enc_key"}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.homarr;
|
||||
cfg = rootCfg.server;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.homarr;
|
||||
cfg = moduleCfg.server;
|
||||
hostDataPath = "${common.dataDir}/homarr";
|
||||
in
|
||||
{
|
||||
@@ -21,7 +22,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "ghcr.io/homarr-labs/homarr:latest";
|
||||
ports = [
|
||||
@@ -42,8 +43,8 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/data
|
||||
'';
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.immich;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.immich;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -13,7 +14,7 @@ in
|
||||
];
|
||||
|
||||
options.selfhosted.immich = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName} root target";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
@@ -22,16 +23,16 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"immich/db_password" = { };
|
||||
"immich/client_id" = { };
|
||||
"immich/client_secret" = { };
|
||||
};
|
||||
|
||||
systemd.targets."${common.backend}-${cfg.targetName}" = {
|
||||
systemd.targets."${common.backend}-${moduleCfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${cfg.targetName}";
|
||||
Description = "Root target for ${moduleCfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.immich;
|
||||
moduleCfg = config.selfhosted.immich;
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."immich-db.env".content = ''
|
||||
POSTGRES_PASSWORD=${config.sops.placeholder."immich/db_password"}
|
||||
'';
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.immich;
|
||||
cfg = rootCfg.ml;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.immich;
|
||||
cfg = moduleCfg.ml;
|
||||
hostDataPath = "${common.dataDir}/immich";
|
||||
version = "v3.1.0";
|
||||
version = "v3.3.5";
|
||||
in
|
||||
{
|
||||
options.selfhosted.immich.ml = {
|
||||
@@ -14,7 +15,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "ghcr.io/immich-app/immich-machine-learning:${version}";
|
||||
environment = {
|
||||
@@ -25,6 +26,7 @@ in
|
||||
];
|
||||
extraOptions = [
|
||||
"--network=${common.network.name}"
|
||||
"--network-alias=${cfg.name}"
|
||||
];
|
||||
};
|
||||
|
||||
@@ -32,10 +34,10 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${rootCfg.server.name}.service" ];
|
||||
after = [ "${common.backend}-${rootCfg.server.name}.service" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${moduleCfg.server.name}.service" ];
|
||||
after = [ "${common.backend}-${moduleCfg.server.name}.service" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/cache
|
||||
'';
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.immich;
|
||||
moduleCfg = config.selfhosted.immich;
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."immich-db.env".content = ''
|
||||
POSTGRES_PASSWORD=${config.sops.placeholder."immich/db_password"}
|
||||
'';
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.immich;
|
||||
cfg = rootCfg.postgresql;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.immich;
|
||||
cfg = moduleCfg.postgresql;
|
||||
hostDataPath = "${common.dataDir}/immich";
|
||||
in
|
||||
{
|
||||
@@ -21,7 +22,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:bcf63357191b76a916ae5eb93464d65c07511da41e3bf7a8416db519b40b1c23";
|
||||
environmentFiles = [ config.sops.templates."immich-db.env".path ];
|
||||
@@ -44,8 +45,8 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/db
|
||||
'';
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.immich;
|
||||
cfg = rootCfg.redis;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.immich;
|
||||
cfg = moduleCfg.redis;
|
||||
in
|
||||
{
|
||||
options.selfhosted.immich.redis = {
|
||||
@@ -12,7 +13,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "docker.io/valkey/valkey:9@sha256:4963247afc4cd33c7d3b2d2816b9f7f8eeebab148d29056c2ca4d7cbc966f2d9";
|
||||
log-driver = "journald";
|
||||
@@ -26,8 +27,8 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,12 +1,92 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.immich;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.immich;
|
||||
cfg = moduleCfg.ml;
|
||||
domain = config.sops.placeholder."domains/serv";
|
||||
mailDomain = "${rootCfg.mail.stalwart.subdomain}.${domain}";
|
||||
pocketIdDomain = "${rootCfg.pocket-id.subdomain}.${domain}";
|
||||
smtpUser = "noreply@${domain}";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."immich.env".content = ''
|
||||
DB_PASSWORD=${config.sops.placeholder."immich/db_password"}
|
||||
IMMICH_CONFIG_FILE=/app/immich-config.json
|
||||
'';
|
||||
|
||||
sops.templates."immich-config.json".content = ''
|
||||
{
|
||||
"backup": {
|
||||
"database": {
|
||||
"cronExpression": "0 */4 * * *",
|
||||
"enabled": true,
|
||||
"keepLastAmount": 4
|
||||
}
|
||||
},
|
||||
"notifications": {
|
||||
"smtp": {
|
||||
"enabled": true,
|
||||
"from": "${smtpUser}",
|
||||
"replyTo": "",
|
||||
"transport": {
|
||||
"host": "${mailDomain}",
|
||||
"ignoreCert": false,
|
||||
"username": "${smtpUser}",
|
||||
"password": "${config.sops.placeholder."vaultwarden/smtp_password"}",
|
||||
"secure": true,
|
||||
"port": 465
|
||||
}
|
||||
}
|
||||
},
|
||||
"oauth": {
|
||||
"enabled": true,
|
||||
"clientId": "immich",
|
||||
"clientSecret": "${config.sops.placeholder."immich/client_secret"}",
|
||||
"autoLaunch": true,
|
||||
"autoRegister": true,
|
||||
"buttonText": "Login with Pocket-ID",
|
||||
"defaultStorageQuota": 1,
|
||||
"issuerUrl": "https://${pocketIdDomain}",
|
||||
"roleClaim": "immich_role",
|
||||
"storageQuotaClaim": "immich_quota"
|
||||
},
|
||||
"passwordLogin": {
|
||||
"enabled": true
|
||||
},
|
||||
"machineLearning": {
|
||||
"enabled": true,
|
||||
"availabilityChecks": {
|
||||
"enabled": true,
|
||||
"interval": 30000,
|
||||
"timeout": 2000
|
||||
},
|
||||
"clip": {
|
||||
"enabled": true,
|
||||
"modelName": "ViT-B-32__openai"
|
||||
},
|
||||
"duplicateDetection": {
|
||||
"enabled": true,
|
||||
"maxDistance": 0.01
|
||||
},
|
||||
"facialRecognition": {
|
||||
"enabled": true,
|
||||
"modelName": "buffalo_l",
|
||||
"maxDistance": 0.5,
|
||||
"minFaces": 3,
|
||||
"minScore": 0.7
|
||||
},
|
||||
"ocr": {
|
||||
"enabled": true,
|
||||
"modelName": "ESLAV__PP-OCRv5_mobile",
|
||||
"maxResolution": 736,
|
||||
"minDetectionScore": 0.5,
|
||||
"minRecognitionScore": 0.8
|
||||
},
|
||||
"urls": ["http://${cfg.name}:3003"]
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.immich;
|
||||
cfg = rootCfg.server;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.immich;
|
||||
cfg = moduleCfg.server;
|
||||
hostDataPath = "${common.dataDir}/immich";
|
||||
version = "v3.1.0";
|
||||
version = "v3.3.5";
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
@@ -19,7 +20,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "ghcr.io/immich-app/immich-server:${version}";
|
||||
ports = [
|
||||
@@ -28,14 +29,15 @@ in
|
||||
environmentFiles = [ config.sops.templates."immich.env".path ];
|
||||
environment = {
|
||||
IMMICH_VERSION = version;
|
||||
DB_HOSTNAME = rootCfg.postgresql.name;
|
||||
DB_DATABASE_NAME = rootCfg.postgresql.db;
|
||||
DB_USERNAME = rootCfg.postgresql.user;
|
||||
REDIS_HOSTNAME = rootCfg.redis.name;
|
||||
DB_HOSTNAME = moduleCfg.postgresql.name;
|
||||
DB_DATABASE_NAME = moduleCfg.postgresql.db;
|
||||
DB_USERNAME = moduleCfg.postgresql.user;
|
||||
REDIS_HOSTNAME = moduleCfg.redis.name;
|
||||
};
|
||||
volumes = [
|
||||
"${hostDataPath}/data:/data"
|
||||
"/etc/localtime:/etc/localtime:ro"
|
||||
"${config.sops.templates."immich-config.json".path}:/app/immich-config.json/"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
@@ -47,15 +49,15 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [
|
||||
"${common.backend}-${rootCfg.postgresql.name}.service"
|
||||
"${common.backend}-${rootCfg.redis.name}.service"
|
||||
"${common.backend}-${moduleCfg.postgresql.name}.service"
|
||||
"${common.backend}-${moduleCfg.redis.name}.service"
|
||||
];
|
||||
after = [
|
||||
"${common.backend}-${rootCfg.postgresql.name}.service"
|
||||
"${common.backend}-${rootCfg.redis.name}.service"
|
||||
"${common.backend}-${moduleCfg.postgresql.name}.service"
|
||||
"${common.backend}-${moduleCfg.redis.name}.service"
|
||||
];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/data
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.it-tools;
|
||||
in
|
||||
{
|
||||
options.selfhosted.it-tools = {
|
||||
enable = mkEnableOption "Enable ${moduleCfg.name}";
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
subdomain = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
hostHttpPort = mkOption {
|
||||
type = types.port;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${moduleCfg.name}" = {
|
||||
image = "docker.io/sharevb/it-tools:2026.10.25";
|
||||
ports = [
|
||||
"0.0.0.0:${toString moduleCfg.hostHttpPort}:8080"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network=${common.network.name}"
|
||||
"--health-cmd=wget -q -O /dev/null --tries=1 http://127.0.0.1:8080/"
|
||||
"--health-interval=30s"
|
||||
"--health-timeout=10s"
|
||||
"--health-retries=3"
|
||||
"--health-start-period=20s"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${moduleCfg.name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,26 +1,27 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.jellyfin;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.jellyfin;
|
||||
in
|
||||
{
|
||||
imports = [ ./server ];
|
||||
|
||||
options.selfhosted.jellyfin = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName} root target";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
};
|
||||
|
||||
systemd.targets."${common.backend}-${cfg.targetName}" = {
|
||||
systemd.targets."${common.backend}-${moduleCfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${cfg.targetName}";
|
||||
Description = "Root target for ${moduleCfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.jellyfin;
|
||||
cfg = rootCfg.server;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.jellyfin;
|
||||
cfg = moduleCfg.server;
|
||||
hostDataPath = "${common.dataDir}/jellyfin";
|
||||
in
|
||||
{
|
||||
@@ -24,7 +25,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/jellyfin/jellyfin:10.11.11";
|
||||
ports = [
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.mihomo;
|
||||
moduleCfg = config.selfhosted.mihomo;
|
||||
subUrl = config.sops.placeholder."mihomo/subscription_url";
|
||||
secret = config.sops.placeholder."mihomo/secret";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."mihomo.yaml".content = ''
|
||||
mixed-port: 7890
|
||||
allow-lan: true
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.mihomo;
|
||||
cfg = rootCfg.core;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.mihomo;
|
||||
cfg = moduleCfg.core;
|
||||
hostDataPath = "${common.dataDir}/mihomo";
|
||||
in
|
||||
{
|
||||
@@ -21,7 +22,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/metacubex/mihomo:v1.19.30";
|
||||
ports = [
|
||||
@@ -41,8 +42,8 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/providers
|
||||
cp -f ${config.sops.templates."mihomo.yaml".path} ${hostDataPath}/config.yaml
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.mihomo;
|
||||
cfg = rootCfg.dashboard;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.mihomo;
|
||||
cfg = moduleCfg.dashboard;
|
||||
in
|
||||
{
|
||||
options.selfhosted.mihomo.dashboard = {
|
||||
@@ -18,7 +19,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "ghcr.io/zephyruso/zashboard:v3.19.0";
|
||||
ports = [
|
||||
@@ -34,10 +35,10 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${rootCfg.core.name}.service" ];
|
||||
after = [ "${common.backend}-${rootCfg.core.name}.service" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${moduleCfg.core.name}.service" ];
|
||||
after = [ "${common.backend}-${moduleCfg.core.name}.service" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -5,8 +5,9 @@
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.mihomo;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.mihomo;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -15,21 +16,21 @@ in
|
||||
];
|
||||
|
||||
options.selfhosted.mihomo = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName} root target";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"mihomo/subscription_url" = { };
|
||||
"mihomo/secret" = { };
|
||||
};
|
||||
|
||||
systemd.targets."${common.backend}-${cfg.targetName}" = {
|
||||
systemd.targets."${common.backend}-${moduleCfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${cfg.targetName}";
|
||||
Description = "Root target for ${moduleCfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
@@ -39,8 +40,8 @@ in
|
||||
# set proxy for build time
|
||||
systemd.services.nix-daemon =
|
||||
let
|
||||
mihomoService = "${common.backend}-${cfg.core.name}.service";
|
||||
socksPort = "${toString cfg.core.hostMixedPort}";
|
||||
mihomoService = "${common.backend}-${moduleCfg.core.name}.service";
|
||||
socksPort = "${toString moduleCfg.core.hostMixedPort}";
|
||||
in
|
||||
{
|
||||
after = [ "${mihomoService}" ];
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.mirotalk;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.mirotalk;
|
||||
in
|
||||
{
|
||||
imports = [ ./server ];
|
||||
|
||||
options.selfhosted.mirotalk = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName} root target";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"mirotalk/client_secret" = { };
|
||||
"mirotalk/session_secret" = { };
|
||||
@@ -22,9 +23,9 @@ in
|
||||
"mirotalk/jwt_secret" = { };
|
||||
};
|
||||
|
||||
systemd.targets."${common.backend}-${cfg.targetName}" = {
|
||||
systemd.targets."${common.backend}-${moduleCfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${cfg.targetName}";
|
||||
Description = "Root target for ${moduleCfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.mirotalk;
|
||||
cfg = rootCfg.server;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.mirotalk;
|
||||
cfg = moduleCfg.server;
|
||||
domain = "${config.sops.placeholder."domains/serv"}";
|
||||
pocketIdSubdomain = config.selfhosted.pocket-id.subdomain;
|
||||
pocketIdSubdomain = rootCfg.pocket-id.subdomain;
|
||||
publicUrl = "https://${cfg.subdomain}.${domain}";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."mirotalk.env".content = ''
|
||||
NODE_ENV=production
|
||||
TZ=${config.time.timeZone}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.mirotalk;
|
||||
cfg = rootCfg.server;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.mirotalk;
|
||||
cfg = moduleCfg.server;
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
@@ -26,7 +27,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "docker.io/mirotalk/sfu@sha256:0e2bba6dde0be9c6b2138b9ff988aa46ec23c7421a6313551c13735355081a17"; # 2.6.79 (2026-10-23)
|
||||
ports = [
|
||||
@@ -49,8 +50,8 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.monitoring;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.monitoring;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -12,21 +13,21 @@ in
|
||||
];
|
||||
|
||||
options.selfhosted.monitoring = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName} root target";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"grafana/admin_password" = { };
|
||||
"grafana/client_secret" = { };
|
||||
};
|
||||
|
||||
systemd.targets."${common.backend}-${cfg.targetName}" = {
|
||||
systemd.targets."${common.backend}-${moduleCfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${cfg.targetName}";
|
||||
Description = "Root target for ${moduleCfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.monitoring;
|
||||
cfg = rootCfg.grafana;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.monitoring;
|
||||
cfg = moduleCfg.grafana;
|
||||
domain = config.sops.placeholder."domains/serv";
|
||||
grafanaDomain = "${cfg.subdomain}.${domain}";
|
||||
oidpDomain = "https://${config.selfhosted.pocket-id.subdomain}.${domain}";
|
||||
oidpDomain = "https://${rootCfg.pocket-id.subdomain}.${domain}";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."grafana.env".content = ''
|
||||
GF_SERVER_DOMAIN=${grafanaDomain}
|
||||
GF_SERVER_ROOT_URL=https://${grafanaDomain}/
|
||||
@@ -51,7 +52,7 @@ in
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://${rootCfg.prometheus.name}:9090
|
||||
url: http://${moduleCfg.prometheus.name}:9090
|
||||
isDefault: true
|
||||
editable: true
|
||||
'';
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.monitoring;
|
||||
cfg = rootCfg.grafana;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.monitoring;
|
||||
cfg = moduleCfg.grafana;
|
||||
hostDataPath = "${common.dataDir}/grafana";
|
||||
in
|
||||
{
|
||||
@@ -21,7 +22,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "docker.io/grafana/grafana:13.2.3";
|
||||
ports = [
|
||||
@@ -42,10 +43,10 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${rootCfg.prometheus.name}.service" ];
|
||||
after = [ "${common.backend}-${rootCfg.prometheus.name}.service" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${moduleCfg.prometheus.name}.service" ];
|
||||
after = [ "${common.backend}-${moduleCfg.prometheus.name}.service" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/data ${hostDataPath}/monitoring/datasources
|
||||
cp -f ${config.sops.templates."grafana-datasources.yaml".path} ${hostDataPath}/monitoring/datasources/datasources.yaml
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.monitoring;
|
||||
cfg = rootCfg.nodeExporter;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.monitoring;
|
||||
cfg = moduleCfg.nodeExporter;
|
||||
in
|
||||
{
|
||||
options.selfhosted.monitoring.nodeExporter = {
|
||||
@@ -12,7 +13,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "docker.io/prom/node-exporter:v1.12.1";
|
||||
cmd = [ "--path.rootfs=/host" ];
|
||||
@@ -30,8 +31,8 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.monitoring;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.monitoring;
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
sops.templates."prometheus.yml".restartUnits = [ "${common.backend}-${rootCfg.prometheus.name}.service" ];
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."prometheus.yml".restartUnits = [ "${common.backend}-${moduleCfg.prometheus.name}.service" ];
|
||||
sops.templates."prometheus.yml".content = ''
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
@@ -19,7 +20,7 @@ in
|
||||
- job_name: node
|
||||
static_configs:
|
||||
- targets:
|
||||
- ${rootCfg.nodeExporter.name}:9100
|
||||
- ${moduleCfg.nodeExporter.name}:9100
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.monitoring;
|
||||
cfg = rootCfg.prometheus;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.monitoring;
|
||||
cfg = moduleCfg.prometheus;
|
||||
hostDataPath = "${common.dataDir}/prometheus";
|
||||
in
|
||||
{
|
||||
@@ -15,7 +16,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "docker.io/prom/prometheus:v3.15.0";
|
||||
volumes = [
|
||||
@@ -32,9 +33,9 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
after = [ "${common.backend}-${rootCfg.nodeExporter.name}.service" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
after = [ "${common.backend}-${moduleCfg.nodeExporter.name}.service" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/data ${hostDataPath}/monitoring
|
||||
cp -f ${config.sops.templates."prometheus.yml".path} ${hostDataPath}/monitoring/prometheus.yml
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.netbird;
|
||||
fullDomain = "${rootCfg.subdomain}.${config.sops.placeholder."domains/serv"}";
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.netbird;
|
||||
fullDomain = "${moduleCfg.subdomain}.${config.sops.placeholder."domains/serv"}";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."nb-dashboard.env".content = ''
|
||||
NETBIRD_MGMT_API_ENDPOINT=https://${fullDomain}
|
||||
NETBIRD_MGMT_GRPC_API_ENDPOINT=https://${fullDomain}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.netbird;
|
||||
cfg = rootCfg.dashboard;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.netbird;
|
||||
cfg = moduleCfg.dashboard;
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
@@ -14,7 +15,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/netbirdio/dashboard:v2.95.0";
|
||||
environmentFiles = [ config.sops.templates."nb-dashboard.env".path ];
|
||||
@@ -29,10 +30,9 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${rootCfg.server.name}.service" ];
|
||||
after = [ "${common.backend}-${rootCfg.server.name}.service" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${moduleCfg.server.name}.service" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.netbird;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.netbird;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -13,7 +14,7 @@ in
|
||||
];
|
||||
|
||||
options.selfhosted.netbird = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName} root target";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
@@ -22,7 +23,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"domains/serv" = { };
|
||||
"letsEncrypt/email" = { };
|
||||
@@ -31,9 +32,9 @@ in
|
||||
"netbird/server/enc_key" = { };
|
||||
};
|
||||
|
||||
systemd.targets."${common.backend}-${cfg.targetName}" = {
|
||||
systemd.targets."${common.backend}-${moduleCfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${cfg.targetName}";
|
||||
Description = "Root target for ${moduleCfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.netbird;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.netbird;
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."nb-proxy.env".content = ''
|
||||
NB_PROXY_DEBUG_LOGS=false
|
||||
NB_PROXY_PROXY_PROTOCOL=true
|
||||
NB_PROXY_MANAGEMENT_ADDRESS=http://${rootCfg.server.name}:80
|
||||
NB_PROXY_MANAGEMENT_ADDRESS=http://${moduleCfg.server.name}:80
|
||||
NB_PROXY_ALLOW_INSECURE=true
|
||||
NB_PROXY_DOMAIN=${rootCfg.subdomain}.${config.sops.placeholder."domains/serv"}
|
||||
NB_PROXY_DOMAIN=${moduleCfg.subdomain}.${config.sops.placeholder."domains/serv"}
|
||||
NB_PROXY_ADDRESS=:8443
|
||||
NB_PROXY_TOKEN=${config.sops.placeholder."netbird/proxy/token"}
|
||||
NB_PROXY_FORWARDED_PROTO=https
|
||||
NB_PROXY_CERTIFICATE_DIRECTORY=/certs
|
||||
NB_PROXY_ACME_CERTIFICATES=true
|
||||
NB_PROXY_ACME_CHALLENGE_TYPE=tls-alpn-01
|
||||
NB_PROXY_TRUSTED_PROXIES=${rootCfg.traefik.ip}
|
||||
NB_PROXY_TRUSTED_PROXIES=${moduleCfg.traefik.ip}
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.netbird;
|
||||
cfg = config.selfhosted.netbird.proxy;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.netbird;
|
||||
cfg = moduleCfg.proxy;
|
||||
hostDataPath = "${common.dataDir}/netbird/proxy";
|
||||
in
|
||||
{
|
||||
@@ -15,7 +16,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/netbirdio/reverse-proxy:0.81.3";
|
||||
environmentFiles = [ config.sops.templates."nb-proxy.env".path ];
|
||||
@@ -28,7 +29,7 @@ in
|
||||
"0.0.0.0:51820:51820/udp" # netbird stunt
|
||||
# "0.0.0.0:9090:9090/tcp" # mihomo controller
|
||||
];
|
||||
dependsOn = [ rootCfg.server.name ];
|
||||
dependsOn = [ moduleCfg.server.name ];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network-alias=${cfg.name}"
|
||||
@@ -40,10 +41,10 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${rootCfg.server.name}.service" ];
|
||||
after = [ "${common.backend}-${rootCfg.server.name}.service" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${moduleCfg.server.name}.service" ];
|
||||
after = [ "${common.backend}-${moduleCfg.server.name}.service" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/certs
|
||||
chown -R ${common.user.uid}:${common.group.gid} ${hostDataPath}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.netbird;
|
||||
nbDomain = "${config.selfhosted.netbird.subdomain}.${config.sops.placeholder."domains/serv"}";
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.netbird;
|
||||
nbDomain = "${moduleCfg.subdomain}.${config.sops.placeholder."domains/serv"}";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."nb-server.yaml".content = ''
|
||||
server:
|
||||
listenAddress: ":80"
|
||||
@@ -34,9 +35,9 @@ in
|
||||
|
||||
reverseProxy:
|
||||
trustedHTTPProxies:
|
||||
- "${rootCfg.traefik.ip}/32"
|
||||
- "${moduleCfg.traefik.ip}/32"
|
||||
trustedPeers:
|
||||
- "${rootCfg.traefik.ip}/32"
|
||||
- "${moduleCfg.traefik.ip}/32"
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.netbird;
|
||||
cfg = rootCfg.server;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.netbird;
|
||||
cfg = moduleCfg.server;
|
||||
hostDataPath = "${common.dataDir}/netbird/server";
|
||||
in
|
||||
{
|
||||
@@ -15,7 +16,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/netbirdio/netbird-server:0.81.3";
|
||||
volumes = [
|
||||
@@ -40,10 +41,10 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${rootCfg.traefik.name}.service" ];
|
||||
after = [ "${common.backend}-${rootCfg.traefik.name}.service" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${moduleCfg.traefik.name}.service" ];
|
||||
after = [ "${common.backend}-${moduleCfg.traefik.name}.service" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/data
|
||||
chown -R ${common.user.uid}:${common.group.gid} ${hostDataPath}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.netbird;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.netbird;
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."traefik.env".content = ''
|
||||
TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_EMAIL=${config.sops.placeholder."letsEncrypt/email"}
|
||||
'';
|
||||
@@ -57,7 +58,7 @@ in
|
||||
netbird-dashboard:
|
||||
entryPoints:
|
||||
- websecure
|
||||
rule: "Host(`${rootCfg.subdomain}.${config.sops.placeholder."domains/serv"}`)"
|
||||
rule: "Host(`${moduleCfg.subdomain}.${config.sops.placeholder."domains/serv"}`)"
|
||||
service: dashboard
|
||||
priority: 1
|
||||
tls:
|
||||
@@ -66,7 +67,7 @@ in
|
||||
netbird-backend:
|
||||
entryPoints:
|
||||
- websecure
|
||||
rule: "Host(`${rootCfg.subdomain}.${
|
||||
rule: "Host(`${moduleCfg.subdomain}.${
|
||||
config.sops.placeholder."domains/serv"
|
||||
}`) && (PathPrefix(`/relay`) || PathPrefix(`/ws-proxy/`) || PathPrefix(`/api`) || PathPrefix(`/oauth2`))"
|
||||
service: netbird-server
|
||||
@@ -77,7 +78,7 @@ in
|
||||
netbird-grpc:
|
||||
entryPoints:
|
||||
- websecure
|
||||
rule: "Host(`${rootCfg.subdomain}.${
|
||||
rule: "Host(`${moduleCfg.subdomain}.${
|
||||
config.sops.placeholder."domains/serv"
|
||||
}`) && (PathPrefix(`/signalexchange.SignalExchange/`) || PathPrefix(`/management.ManagementService/`))"
|
||||
service: netbird-server-h2c
|
||||
@@ -89,15 +90,15 @@ in
|
||||
dashboard:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://${rootCfg.dashboard.name}:80"
|
||||
- url: "http://${moduleCfg.dashboard.name}:80"
|
||||
netbird-server:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://${rootCfg.server.name}:80"
|
||||
- url: "http://${moduleCfg.server.name}:80"
|
||||
netbird-server-h2c:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "h2c://${rootCfg.server.name}:80"
|
||||
- url: "h2c://${moduleCfg.server.name}:80"
|
||||
tcp:
|
||||
serversTransports:
|
||||
pp-v2:
|
||||
@@ -119,7 +120,7 @@ in
|
||||
loadBalancer:
|
||||
serversTransport: pp-v2@file
|
||||
servers:
|
||||
- address: "${rootCfg.proxy.name}:8443"
|
||||
- address: "${moduleCfg.proxy.name}:8443"
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.netbird;
|
||||
cfg = rootCfg.traefik;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.netbird;
|
||||
cfg = moduleCfg.traefik;
|
||||
hostDataPath = "${common.dataDir}/traefik";
|
||||
in
|
||||
{
|
||||
@@ -18,7 +19,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/traefik:v3.7.14";
|
||||
environmentFiles = [ config.sops.templates."traefik.env".path ];
|
||||
@@ -49,8 +50,8 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/letsencrypt
|
||||
chown -R ${common.user.uid}:${common.group.gid} ${hostDataPath}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.omni-tools;
|
||||
in
|
||||
{
|
||||
options.selfhosted.omni-tools = {
|
||||
enable = mkEnableOption "Enable ${moduleCfg.name}";
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
subdomain = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
hostHttpPort = mkOption {
|
||||
type = types.port;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${moduleCfg.name}" = {
|
||||
image = "docker.io/iib0011/omni-tools:0.7.0";
|
||||
ports = [
|
||||
"0.0.0.0:${toString moduleCfg.hostHttpPort}:80"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network=${common.network.name}"
|
||||
"--health-cmd=wget -q -O /dev/null --tries=1 http://127.0.0.1/"
|
||||
"--health-interval=30s"
|
||||
"--health-timeout=10s"
|
||||
"--health-retries=3"
|
||||
"--health-start-period=20s"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${moduleCfg.name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.pocket-id;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.pocket-id;
|
||||
in
|
||||
{
|
||||
imports = [ ./server ];
|
||||
|
||||
options.selfhosted.pocket-id = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName} root target";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
@@ -17,18 +18,22 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"pocket_id/enc_key" = { };
|
||||
};
|
||||
|
||||
systemd.targets."${common.backend}-${cfg.targetName}" = {
|
||||
systemd.targets."${common.backend}-${moduleCfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${cfg.targetName}";
|
||||
Description = "Root target for ${moduleCfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
after = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
requires = [ "${common.backend}-${moduleCfg.server.name}.service" ];
|
||||
after = [
|
||||
"${common.backend}-${common.rootTarget.name}.target"
|
||||
"${common.backend}-${moduleCfg.server.name}.service"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.pocket-id;
|
||||
moduleCfg = config.selfhosted.pocket-id;
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."pocket-id.env".content = ''
|
||||
APP_URL=https://${rootCfg.subdomain}.${config.sops.placeholder."domains/serv"}
|
||||
APP_URL=https://${moduleCfg.subdomain}.${config.sops.placeholder."domains/serv"}
|
||||
ENCRYPTION_KEY=${config.sops.placeholder."pocket_id/enc_key"}
|
||||
TRUST_PROXY=true
|
||||
ANALYTICS_DISABLED=true
|
||||
|
||||
@@ -1,10 +1,28 @@
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.pocket-id;
|
||||
cfg = rootCfg.server;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.pocket-id;
|
||||
cfg = moduleCfg.server;
|
||||
hostDataPath = "${common.dataDir}/pocket-id";
|
||||
ready = pkgs.writeShellScript "pocket-id-ready" ''
|
||||
set -euo pipefail
|
||||
url="http://127.0.0.1:${toString cfg.hostHttpPort}/.well-known/openid-configuration"
|
||||
for i in $(seq 1 90); do
|
||||
if ${lib.getExe pkgs.curl} -fsS -o /dev/null --max-time 2 "$url"; then
|
||||
exit 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "Pocket ID did not serve $url" >&2
|
||||
exit 1
|
||||
'';
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
@@ -18,7 +36,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "ghcr.io/pocket-id/pocket-id:v2.14.0";
|
||||
ports = [
|
||||
@@ -38,9 +56,11 @@ in
|
||||
systemd.services."${common.backend}-${cfg.name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
ExecStartPost = ready;
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
before = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/letsencrypt
|
||||
chown -R ${common.user.uid}:${common.group.gid} ${hostDataPath}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
cfg = rootCfg.collabora;
|
||||
moduleCfg = config.selfhosted.seafile;
|
||||
cfg = moduleCfg.collabora;
|
||||
domain = config.sops.placeholder."domains/serv";
|
||||
seafileUrl = "https://${rootCfg.server.subdomain}.${domain}";
|
||||
seafileUrl = "https://${moduleCfg.server.subdomain}.${domain}";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."collabora.env".content = ''
|
||||
TZ=${config.time.timeZone}
|
||||
DONT_GEN_SSL_CERT=true
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
cfg = rootCfg.collabora;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.seafile;
|
||||
cfg = moduleCfg.collabora;
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
@@ -20,7 +21,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/collabora/code:26.04.3.1.1";
|
||||
ports = [
|
||||
@@ -38,10 +39,10 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
after = [ "${common.backend}-${rootCfg.server.name}.service" ];
|
||||
requires = [ "${common.backend}-${rootCfg.server.name}.service" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
after = [ "${common.backend}-${moduleCfg.server.name}.service" ];
|
||||
requires = [ "${common.backend}-${moduleCfg.server.name}.service" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.seafile;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.seafile;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -16,13 +17,13 @@ in
|
||||
];
|
||||
|
||||
options.selfhosted.seafile = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName} root target";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"seafile/admin_email" = { };
|
||||
"seafile/admin_password" = { };
|
||||
@@ -33,9 +34,9 @@ in
|
||||
"seafile/redis_password" = { };
|
||||
};
|
||||
|
||||
systemd.targets."${common.backend}-${cfg.targetName}" = {
|
||||
systemd.targets."${common.backend}-${moduleCfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${cfg.targetName}";
|
||||
Description = "Root target for ${moduleCfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
moduleCfg = config.selfhosted.seafile;
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."seafile-db.env".content = ''
|
||||
MYSQL_ROOT_PASSWORD=${config.sops.placeholder."seafile/mysql_password"}
|
||||
MYSQL_LOG_CONSOLE=true
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
cfg = rootCfg.mariadb;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.seafile;
|
||||
cfg = moduleCfg.mariadb;
|
||||
hostDataPath = "${common.dataDir}/seafile";
|
||||
in
|
||||
{
|
||||
@@ -15,7 +16,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/mariadb:10.11";
|
||||
environmentFiles = [ config.sops.templates."seafile-db.env".path ];
|
||||
@@ -37,8 +38,8 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/mysql
|
||||
'';
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
moduleCfg = config.selfhosted.seafile;
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."seafile-notification.env".content = ''
|
||||
SEAFILE_MYSQL_DB_HOST=${rootCfg.mariadb.name}
|
||||
SEAFILE_MYSQL_DB_HOST=${moduleCfg.mariadb.name}
|
||||
SEAFILE_MYSQL_DB_PORT=3306
|
||||
SEAFILE_MYSQL_DB_USER=seafile
|
||||
SEAFILE_MYSQL_DB_PASSWORD=${config.sops.placeholder."seafile/mysql_password"}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
cfg = rootCfg.notification;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.seafile;
|
||||
cfg = moduleCfg.notification;
|
||||
hostDataPath = "${common.dataDir}/seafile";
|
||||
in
|
||||
{
|
||||
@@ -18,7 +19,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/seafileltd/notification-server:13.0-latest";
|
||||
ports = [
|
||||
@@ -38,21 +39,21 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [
|
||||
"${common.backend}-${rootCfg.mariadb.name}.service"
|
||||
"${common.backend}-${rootCfg.server.name}.service"
|
||||
"${common.backend}-${moduleCfg.mariadb.name}.service"
|
||||
"${common.backend}-${moduleCfg.server.name}.service"
|
||||
];
|
||||
after = [
|
||||
"${common.backend}-${rootCfg.mariadb.name}.service"
|
||||
"${common.backend}-${rootCfg.server.name}.service"
|
||||
"${common.backend}-${moduleCfg.mariadb.name}.service"
|
||||
"${common.backend}-${moduleCfg.server.name}.service"
|
||||
];
|
||||
path = with pkgs; [ curl gawk ];
|
||||
preStart = ''
|
||||
echo "Waiting for Seafile server to be ready..."
|
||||
for i in {1..60}; do
|
||||
status=$(curl -sI --max-time 5 "http://localhost:${toString rootCfg.server.hostHttpPort}" | head -1 | awk '{print $2}')
|
||||
status=$(curl -sI --max-time 5 "http://localhost:${toString moduleCfg.server.hostHttpPort}" | head -1 | awk '{print $2}')
|
||||
|
||||
if [[ "$status" =~ ^(200|301|302)$ ]]; then
|
||||
echo "Seafile server is up (HTTP $status, attempt $i)"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
moduleCfg = config.selfhosted.seafile;
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."seafile-redis.env".content = ''
|
||||
REDIS_PASSWORD=${config.sops.placeholder."seafile/redis_password"}
|
||||
'';
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
cfg = rootCfg.redis;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.seafile;
|
||||
cfg = moduleCfg.redis;
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
@@ -14,7 +15,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/redis:7";
|
||||
environmentFiles = [ config.sops.templates."seafile-redis.env".path ];
|
||||
@@ -29,8 +30,8 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
moduleCfg = config.selfhosted.seafile;
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."seadoc.env".content = ''
|
||||
DB_HOST=${rootCfg.mariadb.name}
|
||||
DB_HOST=${moduleCfg.mariadb.name}
|
||||
DB_PORT=3306
|
||||
DB_USER=seafile
|
||||
DB_PASSWORD=${config.sops.placeholder."seafile/mysql_password"}
|
||||
@@ -14,7 +14,7 @@ in
|
||||
TIME_ZONE=${config.time.timeZone}
|
||||
JWT_PRIVATE_KEY=${config.sops.placeholder."seafile/jwt_private_key"}
|
||||
NON_ROOT=false
|
||||
SEAHUB_SERVICE_URL=http://${rootCfg.server.name}
|
||||
SEAHUB_SERVICE_URL=http://${moduleCfg.server.name}
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
cfg = rootCfg.seadoc;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.seafile;
|
||||
cfg = moduleCfg.seadoc;
|
||||
hostDataPath = "${common.dataDir}/seafile";
|
||||
in
|
||||
{
|
||||
@@ -18,7 +19,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/seafileltd/sdoc-server:2.0-latest";
|
||||
ports = [
|
||||
@@ -38,10 +39,10 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${rootCfg.mariadb.name}.service" ];
|
||||
after = [ "${common.backend}-${rootCfg.mariadb.name}.service" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${moduleCfg.mariadb.name}.service" ];
|
||||
after = [ "${common.backend}-${moduleCfg.mariadb.name}.service" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/seadoc/shared
|
||||
'';
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
poCfg = config.selfhosted.pocket-id;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.seafile;
|
||||
poCfg = rootCfg.pocket-id;
|
||||
domain = config.sops.placeholder."domains/serv";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."seafile.env".content = ''
|
||||
SEAFILE_MYSQL_DB_HOST=${rootCfg.mariadb.name}
|
||||
SEAFILE_MYSQL_DB_HOST=${moduleCfg.mariadb.name}
|
||||
SEAFILE_MYSQL_DB_PORT=3306
|
||||
SEAFILE_MYSQL_DB_USER=seafile
|
||||
SEAFILE_MYSQL_DB_PASSWORD=${config.sops.placeholder."seafile/mysql_password"}
|
||||
@@ -19,7 +20,7 @@ in
|
||||
INIT_SEAFILE_MYSQL_ROOT_PASSWORD=${config.sops.placeholder."seafile/mysql_password"}
|
||||
INIT_SEAFILE_ADMIN_EMAIL=${config.sops.placeholder."seafile/admin_email"}
|
||||
INIT_SEAFILE_ADMIN_PASSWORD=${config.sops.placeholder."seafile/admin_password"}
|
||||
SEAFILE_SERVER_HOSTNAME=${rootCfg.server.subdomain}.${domain}
|
||||
SEAFILE_SERVER_HOSTNAME=${moduleCfg.server.subdomain}.${domain}
|
||||
SEAFILE_SERVER_PROTOCOL=https
|
||||
SEAFILE_SERVER_LETSENCRYPT=false
|
||||
SITE_ROOT=/
|
||||
@@ -28,27 +29,27 @@ in
|
||||
SEAFILE_LOG_TO_STDOUT=false
|
||||
ENABLE_GO_FILESERVER=true
|
||||
CACHE_PROVIDER=redis
|
||||
REDIS_HOST=${rootCfg.redis.name}
|
||||
REDIS_HOST=${moduleCfg.redis.name}
|
||||
REDIS_PORT=6379
|
||||
REDIS_PASSWORD=${config.sops.placeholder."seafile/redis_password"}
|
||||
ENABLE_NOTIFICATION_SERVER=true
|
||||
INNER_NOTIFICATION_SERVER_URL=http://${rootCfg.notification.name}:8083
|
||||
NOTIFICATION_SERVER_URL=https://${rootCfg.server.subdomain}.${domain}/notification
|
||||
INNER_NOTIFICATION_SERVER_URL=http://${moduleCfg.notification.name}:8083
|
||||
NOTIFICATION_SERVER_URL=https://${moduleCfg.server.subdomain}.${domain}/notification
|
||||
ENABLE_SEAFILE_AI=false
|
||||
MD_FILE_COUNT_LIMIT=100000
|
||||
'';
|
||||
|
||||
sops.templates."seahub_settings.py".content = ''
|
||||
ENABLE_VIDEO_THUMBNAIL = True
|
||||
SERVICE_URL = "https://${rootCfg.server.subdomain}.${domain}"
|
||||
FILE_SERVER_ROOT = "https://${rootCfg.server.subdomain}.${domain}/seafhttp"
|
||||
SERVICE_URL = "https://${moduleCfg.server.subdomain}.${domain}"
|
||||
FILE_SERVER_ROOT = "https://${moduleCfg.server.subdomain}.${domain}/seafhttp"
|
||||
ENABLE_OAUTH = True
|
||||
OAUTH_CREATE_UNKNOWN_USER = True
|
||||
OAUTH_ACTIVATE_USER_AFTER_CREATION = True
|
||||
OAUTH_ENABLE_INSECURE_TRANSPORT = False
|
||||
OAUTH_CLIENT_ID = "${config.sops.placeholder."seafile/client_id"}"
|
||||
OAUTH_CLIENT_SECRET = "${config.sops.placeholder."seafile/client_secret"}"
|
||||
OAUTH_REDIRECT_URL = "https://${rootCfg.server.subdomain}.${domain}/oauth/callback"
|
||||
OAUTH_REDIRECT_URL = "https://${moduleCfg.server.subdomain}.${domain}/oauth/callback"
|
||||
OAUTH_PROVIDER = "pocket-id"
|
||||
OAUTH_PROVIDER_DOMAIN = "pocket-id"
|
||||
OAUTH_AUTHORIZATION_URL = "https://${poCfg.subdomain}.${domain}/authorize"
|
||||
@@ -67,11 +68,11 @@ in
|
||||
CLIENT_SSO_VIA_LOCAL_BROWSER = True
|
||||
|
||||
ENABLE_SEADOC = True
|
||||
SEADOC_SERVER_URL = "https://${rootCfg.server.subdomain}.${domain}/sdoc-server"
|
||||
SEADOC_SERVER_URL = "https://${moduleCfg.server.subdomain}.${domain}/sdoc-server"
|
||||
|
||||
OFFICE_SERVER_TYPE = "CollaboraOffice"
|
||||
ENABLE_OFFICE_WEB_APP = True
|
||||
OFFICE_WEB_APP_BASE_URL = "http://${rootCfg.collabora.name}:9980/hosting/discovery"
|
||||
OFFICE_WEB_APP_BASE_URL = "http://${moduleCfg.collabora.name}:9980/hosting/discovery"
|
||||
WOPI_ACCESS_TOKEN_EXPIRATION = 10 * 60 * 60
|
||||
OFFICE_WEB_APP_FILE_EXTENSION = (
|
||||
"odp", "ods", "odt",
|
||||
@@ -95,12 +96,12 @@ in
|
||||
".${domain}" ,
|
||||
"127.0.0.1",
|
||||
"localhost",
|
||||
"${rootCfg.server.name}",
|
||||
"${moduleCfg.server.name}",
|
||||
]
|
||||
CSRF_COOKIE_SECURE = True
|
||||
CSRF_COOKIE_SAMESITE = "Lax"
|
||||
CSRF_TRUSTED_ORIGINS = [
|
||||
"https://${rootCfg.server.subdomain}.${domain}"
|
||||
"https://${moduleCfg.server.subdomain}.${domain}"
|
||||
]
|
||||
'';
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
cfg = rootCfg.server;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.seafile;
|
||||
cfg = moduleCfg.server;
|
||||
hostDataPath = "${common.dataDir}/seafile";
|
||||
in
|
||||
{
|
||||
@@ -21,7 +22,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/seafileltd/seafile-mc:13.0-latest";
|
||||
ports = [
|
||||
@@ -41,15 +42,15 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [
|
||||
"${common.backend}-${rootCfg.mariadb.name}.service"
|
||||
"${common.backend}-${rootCfg.redis.name}.service"
|
||||
"${common.backend}-${moduleCfg.mariadb.name}.service"
|
||||
"${common.backend}-${moduleCfg.redis.name}.service"
|
||||
];
|
||||
after = [
|
||||
"${common.backend}-${rootCfg.mariadb.name}.service"
|
||||
"${common.backend}-${rootCfg.redis.name}.service"
|
||||
"${common.backend}-${moduleCfg.mariadb.name}.service"
|
||||
"${common.backend}-${moduleCfg.redis.name}.service"
|
||||
];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/server/shared/seafile/conf
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
moduleCfg = config.selfhosted.seafile;
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."seafile-thumbnail.env".content = ''
|
||||
TIME_ZONE=${config.time.timeZone}
|
||||
SEAFILE_MYSQL_DB_HOST=${rootCfg.mariadb.name}
|
||||
SEAFILE_MYSQL_DB_HOST=${moduleCfg.mariadb.name}
|
||||
SEAFILE_MYSQL_DB_PORT=3306
|
||||
SEAFILE_MYSQL_DB_USER=seafile
|
||||
SEAFILE_MYSQL_DB_PASSWORD=${config.sops.placeholder."seafile/mysql_password"}
|
||||
@@ -17,7 +17,7 @@ in
|
||||
JWT_PRIVATE_KEY=${config.sops.placeholder."seafile/jwt_private_key"}
|
||||
SEAFILE_LOG_TO_STDOUT=false
|
||||
SITE_ROOT=/
|
||||
INNER_SEAHUB_SERVICE_URL=http://${rootCfg.server.name}
|
||||
INNER_SEAHUB_SERVICE_URL=http://${moduleCfg.server.name}
|
||||
THUMBNAIL_IMAGE_ORIGINAL_SIZE_LIMIT=256
|
||||
SEAF_SERVER_STORAGE_TYPE=disk
|
||||
'';
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
cfg = rootCfg.thumbnail;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.seafile;
|
||||
cfg = moduleCfg.thumbnail;
|
||||
hostDataPath = "${common.dataDir}/seafile";
|
||||
in
|
||||
{
|
||||
@@ -18,7 +19,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/seafileltd/thumbnail-server:13.0.20";
|
||||
ports = [
|
||||
@@ -38,15 +39,15 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [
|
||||
"${common.backend}-${rootCfg.mariadb.name}.service"
|
||||
"${common.backend}-${rootCfg.server.name}.service"
|
||||
"${common.backend}-${moduleCfg.mariadb.name}.service"
|
||||
"${common.backend}-${moduleCfg.server.name}.service"
|
||||
];
|
||||
after = [
|
||||
"${common.backend}-${rootCfg.mariadb.name}.service"
|
||||
"${common.backend}-${rootCfg.server.name}.service"
|
||||
"${common.backend}-${moduleCfg.mariadb.name}.service"
|
||||
"${common.backend}-${moduleCfg.server.name}.service"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.mail;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.mail;
|
||||
domain = config.sops.placeholder."domains/serv";
|
||||
sessionSecret = config.sops.placeholder."bulwark/session_secret";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."bulwark.env".content = ''
|
||||
HOSTNAME=0.0.0.0
|
||||
PORT=3000
|
||||
@@ -15,17 +16,17 @@ in
|
||||
STALWART_FEATURES=true
|
||||
BULWARK_TELEMETRY=off
|
||||
SETTINGS_SYNC_ENABLED=true
|
||||
JMAP_SERVER_URL=https://${rootCfg.stalwart.subdomain}.${domain}
|
||||
JMAP_SERVER_URL=https://${moduleCfg.stalwart.subdomain}.${domain}
|
||||
ADMIN_PASSWORD=${config.sops.placeholder."bulwark/admin_password"}
|
||||
SESSION_SECRET=${sessionSecret}
|
||||
COOKIE_SAME_SITE=none
|
||||
ALLOWED_FRAME_ANCESTORS=https://${rootCfg.stalwart.subdomain}.${domain}
|
||||
NEXT_PUBLIC_PARENT_ORIGIN=https://${rootCfg.stalwart.subdomain}.${domain}
|
||||
ALLOWED_FRAME_ANCESTORS=https://${moduleCfg.stalwart.subdomain}.${domain}
|
||||
NEXT_PUBLIC_PARENT_ORIGIN=https://${moduleCfg.stalwart.subdomain}.${domain}
|
||||
|
||||
OAUTH_ENABLED=true
|
||||
OAUTH_ONLY=true
|
||||
AUTO_SSO_ENABLED=true
|
||||
OAUTH_ISSUER_URL=https://${config.selfhosted.pocket-id.subdomain}.${domain}
|
||||
OAUTH_ISSUER_URL=https://${rootCfg.pocket-id.subdomain}.${domain}
|
||||
OAUTH_CLIENT_ID=bulwark
|
||||
OAUTH_SCOPES=openid email profile
|
||||
OAUTH_ALLOW_PRIVATE_ENDPOINTS=true
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.mail;
|
||||
cfg = config.selfhosted.mail.bulwark;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.mail;
|
||||
cfg = moduleCfg.bulwark;
|
||||
hostDataPath = "${common.dataDir}/bulwark";
|
||||
in
|
||||
{
|
||||
@@ -21,7 +22,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "ghcr.io/bulwarkmail/webmail-beta:sha-62e0760";
|
||||
ports = [
|
||||
@@ -48,10 +49,10 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${rootCfg.stalwart.name}.service" ];
|
||||
after = [ "${common.backend}-${rootCfg.stalwart.name}.service" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${moduleCfg.stalwart.name}.service" ];
|
||||
after = [ "${common.backend}-${moduleCfg.stalwart.name}.service" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/{settings,admin,admin-state}
|
||||
chown -R 1001:65533 ${hostDataPath}/{settings,admin,admin-state}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.mail;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.mail;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -11,7 +12,7 @@ in
|
||||
];
|
||||
|
||||
options.selfhosted.mail = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName} root target";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
@@ -21,7 +22,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"bulwark/admin_password" = { };
|
||||
"bulwark/session_secret" = { };
|
||||
@@ -32,9 +33,9 @@ in
|
||||
"stalwart/admin_password" = { };
|
||||
};
|
||||
|
||||
systemd.targets."${common.backend}-${cfg.targetName}" = {
|
||||
systemd.targets."${common.backend}-${moduleCfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${cfg.targetName}";
|
||||
Description = "Root target for ${moduleCfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.mail;
|
||||
cfg = rootCfg.stalwart;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.mail;
|
||||
cfg = moduleCfg.stalwart;
|
||||
domain = config.sops.placeholder."domains/serv";
|
||||
pocketIdSubdomain = config.selfhosted.pocket-id.subdomain;
|
||||
pocketIdSubdomain = rootCfg.pocket-id.subdomain;
|
||||
adminPassword = config.sops.placeholder."stalwart/admin_password";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."stalwart.env".content = ''
|
||||
STALWART_PUBLIC_URL=https://${cfg.subdomain}.${domain}
|
||||
STALWART_RECOVERY_MODE=0
|
||||
@@ -78,7 +79,7 @@ in
|
||||
"issuerUrl": "https://${pocketIdSubdomain}.${domain}",
|
||||
"requireAudience": null,
|
||||
"requireScopes": {},
|
||||
"claimUsername": "preferred_username",
|
||||
"claimUsername": "email",
|
||||
"usernameDomain": "${domain}",
|
||||
"claimName": "name",
|
||||
"claimGroups": null
|
||||
|
||||
@@ -1,12 +1,25 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.mail;
|
||||
cfg = rootCfg.stalwart;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.mail;
|
||||
cfg = moduleCfg.stalwart;
|
||||
planPath = config.sops.templates."stalwart-oidc-plan.json".path;
|
||||
cliEnvPath = config.sops.templates."stalwart-cli.env".path;
|
||||
hostDataPath = "${common.dataDir}/stalwart";
|
||||
pocketIdReady = pkgs.writeShellScript "stalwart-wait-pocket-id" ''
|
||||
set -euo pipefail
|
||||
url="${"http://127.0.0.1:${toString rootCfg.pocket-id.server.hostHttpPort}/.well-known/openid-configuration"}"
|
||||
for i in $(seq 1 90); do
|
||||
if ${lib.getExe pkgs.curl} -fsS -o /dev/null --max-time 2 "$url"; then
|
||||
exit 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "Pocket ID did not serve $url" >&2
|
||||
exit 1
|
||||
'';
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
@@ -38,7 +51,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "docker.io/stalwartlabs/stalwart:v0.16";
|
||||
ports = [
|
||||
@@ -73,9 +86,11 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
preStart = ''
|
||||
${pocketIdReady}
|
||||
|
||||
mkdir -p ${hostDataPath}/{config,data}
|
||||
chown -R 2000:2000 ${hostDataPath} 2>/dev/null || chmod 775 ${hostDataPath}
|
||||
chmod 775 ${hostDataPath}/{config,data}
|
||||
@@ -91,8 +106,8 @@ in
|
||||
RemainAfterExit = true;
|
||||
EnvironmentFile = cliEnvPath;
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${cfg.name}.service" ];
|
||||
after = [ "${common.backend}-${cfg.name}.service" ];
|
||||
restartTriggers = [
|
||||
@@ -138,6 +153,8 @@ in
|
||||
"$cli_image" \
|
||||
apply --stdin
|
||||
|
||||
${pocketIdReady}
|
||||
|
||||
${common.backend} restart ${cfg.name}
|
||||
|
||||
ok=0
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.transmute;
|
||||
domain = "${config.sops.placeholder."domains/serv"}";
|
||||
pocketIdSubdomain = rootCfg.pocket-id.subdomain;
|
||||
in
|
||||
{
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"transmute/client_secret" = { };
|
||||
};
|
||||
|
||||
sops.templates."transmute.env".content = ''
|
||||
APP_URL=https://${moduleCfg.subdomain}.${domain}
|
||||
OIDC_AUTO_LAUNCH=false
|
||||
OIDC_ISSUER_URL=https://${pocketIdSubdomain}.${domain}
|
||||
OIDC_CLIENT_ID=transmute
|
||||
OIDC_CLIENT_SECRET=${config.sops.placeholder."transmute/client_secret"}
|
||||
OIDC_DISPLAY_NAME=PocketID
|
||||
OIDC_USERNAME_CLAIM=preferred_username
|
||||
OIDC_AUTO_CREATE_USERS=true
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.transmute;
|
||||
hostDataPath = "${common.dataDir}/transmute";
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
|
||||
options.selfhosted.transmute = {
|
||||
enable = mkEnableOption "Enable ${moduleCfg.name}";
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
subdomain = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
hostHttpPort = mkOption {
|
||||
type = types.port;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${moduleCfg.name}" = {
|
||||
image = "ghcr.io/transmute-app/transmute:v2.1.1";
|
||||
ports = [
|
||||
"0.0.0.0:${toString moduleCfg.hostHttpPort}:3313"
|
||||
];
|
||||
environmentFiles = [ config.sops.templates."transmute.env".path ];
|
||||
volumes = [
|
||||
"${hostDataPath}/data:/app/data"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network=${common.network.name}"
|
||||
"--health-cmd=wget -q -O /dev/null --tries=1 http://localhost:3313/api/health/ready"
|
||||
"--health-interval=30s"
|
||||
"--health-timeout=10s"
|
||||
"--health-retries=3"
|
||||
"--health-start-period=40s"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${moduleCfg.name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/data
|
||||
chown -R ${common.user.uid}:${common.group.gid} ${hostDataPath}
|
||||
chmod -R 0775 ${hostDataPath}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.selfhosted.turn;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.turn;
|
||||
domain = "${config.sops.placeholder."domains/serv"}";
|
||||
realm = "${config.selfhosted.netbird.subdomain}.${domain}";
|
||||
realm = "${rootCfg.netbird.subdomain}.${domain}";
|
||||
in
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"turn/password" = { };
|
||||
"turn/public-ip" = { };
|
||||
@@ -18,16 +19,16 @@ in
|
||||
mode = "0400";
|
||||
restartUnits = [ "docker-turn-server.service" ];
|
||||
content = ''
|
||||
listening-port=${toString cfg.listenPort}
|
||||
listening-ip=${cfg.listenIP}
|
||||
listening-port=${toString moduleCfg.listenPort}
|
||||
listening-ip=${moduleCfg.listenIP}
|
||||
fingerprint
|
||||
lt-cred-mech
|
||||
realm=${realm}
|
||||
user=turn:${config.sops.placeholder."turn/password"}
|
||||
min-port=${toString cfg.minPort}
|
||||
max-port=${toString cfg.maxPort}
|
||||
relay-ip=${cfg.listenIP}
|
||||
external-ip=${config.sops.placeholder."turn/public-ip"}/${cfg.listenIP}
|
||||
min-port=${toString moduleCfg.minPort}
|
||||
max-port=${toString moduleCfg.maxPort}
|
||||
relay-ip=${moduleCfg.listenIP}
|
||||
external-ip=${config.sops.placeholder."turn/public-ip"}/${moduleCfg.listenIP}
|
||||
log-file=stdout
|
||||
no-cli
|
||||
no-tls
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.turn;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.turn;
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
@@ -26,14 +27,14 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${moduleCfg.name} = {
|
||||
image = "docker.io/coturn/coturn:4.6.3";
|
||||
cmd = [ "-c" "/etc/turnserver.conf" ];
|
||||
ports = [
|
||||
"0.0.0.0:${toString cfg.listenPort}:${toString cfg.listenPort}/udp"
|
||||
"0.0.0.0:${toString moduleCfg.listenPort}:${toString moduleCfg.listenPort}/udp"
|
||||
]
|
||||
++ map (port: "0.0.0.0:${toString port}:${toString port}/udp") (range cfg.minPort cfg.maxPort);
|
||||
++ map (port: "0.0.0.0:${toString port}:${toString port}/udp") (range moduleCfg.minPort moduleCfg.maxPort);
|
||||
volumes = [ "${config.sops.templates."turnserver.conf".path}:/etc/turnserver.conf:ro" ];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
@@ -42,7 +43,7 @@ in
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${cfg.name}" = {
|
||||
systemd.services."${common.backend}-${moduleCfg.name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.vaultwarden;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.vaultwarden;
|
||||
in
|
||||
{
|
||||
imports = [ ./server ];
|
||||
|
||||
options.selfhosted.vaultwarden = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName} root target";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName} root target";
|
||||
targetName = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"vaultwarden/admin_token" = { };
|
||||
"vaultwarden/client_id" = { };
|
||||
@@ -22,9 +23,9 @@ in
|
||||
"vaultwarden/smtp_password" = { };
|
||||
};
|
||||
|
||||
systemd.targets."${common.backend}-${cfg.targetName}" = {
|
||||
systemd.targets."${common.backend}-${moduleCfg.targetName}" = {
|
||||
unitConfig = {
|
||||
Description = "Root target for ${cfg.targetName}";
|
||||
Description = "Root target for ${moduleCfg.targetName}";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.vaultwarden;
|
||||
cfg = rootCfg.server;
|
||||
mailCfg = config.selfhosted.mail.stalwart;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.vaultwarden;
|
||||
cfg = moduleCfg.server;
|
||||
mailCfg = rootCfg.mail.stalwart;
|
||||
domain = "${config.sops.placeholder."domains/serv"}";
|
||||
pocketIdSubdomain = config.selfhosted.pocket-id.subdomain;
|
||||
pocketIdSubdomain = rootCfg.pocket-id.subdomain;
|
||||
smtpUser = "noreply@${domain}";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."vaultwarden.env".content = ''
|
||||
DOMAIN=https://${cfg.subdomain}.${domain}
|
||||
SIGNUPS_ALLOWED=false
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.vaultwarden;
|
||||
cfg = rootCfg.server;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.vaultwarden;
|
||||
cfg = moduleCfg.server;
|
||||
hostDataPath = "${common.dataDir}/vaultwarden";
|
||||
in
|
||||
{
|
||||
@@ -21,7 +22,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "docker.io/vaultwarden/server:1.37.1";
|
||||
ports = [
|
||||
@@ -42,8 +43,8 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/data
|
||||
chown -R ${common.user.uid}:${common.group.gid} ${hostDataPath}
|
||||
|
||||
@@ -6,15 +6,16 @@
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.zapret2;
|
||||
socksPort = "${toString cfg.socksPort}";
|
||||
ssPort = "${toString cfg.ssPort}";
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.zapret2;
|
||||
socksPort = "${toString moduleCfg.socksPort}";
|
||||
ssPort = "${toString moduleCfg.ssPort}";
|
||||
configFiles = import ./config.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
options.selfhosted.zapret2 = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName}";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName}";
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
@@ -26,8 +27,8 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${moduleCfg.name} = {
|
||||
image = "docker.io/vernette/ss-zapret2:v0.9.5";
|
||||
volumes = [
|
||||
"${configFiles.config}:/opt/zapret2/config"
|
||||
@@ -49,7 +50,7 @@ in
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${cfg.name}" = {
|
||||
systemd.services."${common.backend}-${moduleCfg.name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.selfhosted.zerobyte;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.zerobyte;
|
||||
domain = "${config.sops.placeholder."domains/serv"}";
|
||||
zerobyteDomain = "${cfg.subdomain}.${domain}";
|
||||
zerobyteDomain = "${moduleCfg.subdomain}.${domain}";
|
||||
trustedOrigins = [
|
||||
"https://${zerobyteDomain}"
|
||||
"https://${config.selfhosted.pocket-id.subdomain}.${domain}"
|
||||
"https://${rootCfg.pocket-id.subdomain}.${domain}"
|
||||
];
|
||||
in
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.secrets = {
|
||||
"zerobyte/app_secret" = { };
|
||||
};
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.zerobyte;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.zerobyte;
|
||||
hostDataPath = "${common.dataDir}/zerobyte";
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
|
||||
options.selfhosted.zerobyte = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName}";
|
||||
enable = mkEnableOption "Enable ${moduleCfg.targetName}";
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
@@ -21,12 +22,12 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${moduleCfg.name} = {
|
||||
image = "ghcr.io/nicotsx/zerobyte:v0.41";
|
||||
environmentFiles = [ config.sops.templates."zerobyte.env".path ];
|
||||
ports = [
|
||||
"0.0.0.0:${toString cfg.hostHttpPort}:4096"
|
||||
"0.0.0.0:${toString moduleCfg.hostHttpPort}:4096"
|
||||
];
|
||||
volumes = [
|
||||
"/etc/localtime:/etc/localtime:ro"
|
||||
@@ -35,7 +36,7 @@ in
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${cfg.name}" = {
|
||||
systemd.services."${common.backend}-${moduleCfg.name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user