Add selfhosted services
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
sops.templates."immich-db.env".content = ''
|
||||
POSTGRES_PASSWORD=${config.sops.placeholder."immich/db_password"}
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.immich;
|
||||
hostDataPath = "${common.dataDir}/immich";
|
||||
in
|
||||
{
|
||||
options.selfhosted.immich.ml = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
virtualisation.oci-containers.containers."${cfg.ml.name}" = {
|
||||
image = "ghcr.io/immich-app/immich-machine-learning:${cfg.version}";
|
||||
environment = {
|
||||
IMMICH_VERSION = cfg.version;
|
||||
};
|
||||
volumes = [
|
||||
"${hostDataPath}/cache:/cache"
|
||||
];
|
||||
extraOptions = [
|
||||
"--network=${common.network.name}"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${cfg.ml.name}" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
after = [ "${common.backend}-network-${common.network.name}.service" ];
|
||||
requires = [ "${common.backend}-network-${common.network.name}.service" ];
|
||||
partOf = [ "${common.backend}-${cfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${cfg.targetName}.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/cache
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user