Small modules config restructure
Changed variables names in every module
This commit is contained in:
1 parent
c1d2e52bf8
commit
c92b90e406
83 files changed
+616
-523
No files matched your search
@@ -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,9 +1,10 @@
|
||||
{ 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.3.5";
|
||||
in
|
||||
@@ -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 = {
|
||||
@@ -33,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,15 +1,16 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.immich;
|
||||
cfg = rootCfg.ml;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.immich;
|
||||
cfg = moduleCfg.ml;
|
||||
domain = config.sops.placeholder."domains/serv";
|
||||
mailDomain = "${config.selfhosted.mail.stalwart.subdomain}.${domain}";
|
||||
pocketIdDomain = "${config.selfhosted.pocket-id.subdomain}.${domain}";
|
||||
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
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ 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.3.5";
|
||||
in
|
||||
@@ -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,10 +29,10 @@ 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"
|
||||
@@ -48,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
|
||||
|
||||
Reference in new issue
Block a user