54 lines
1.3 KiB
Nix
54 lines
1.3 KiB
Nix
{ config, containerCfg, pkgs, lib, builder, name,... }:
|
|
let
|
|
version = "v2";
|
|
serverCfg = config.syscfg.server;
|
|
|
|
in {
|
|
sops = true;
|
|
db = true;
|
|
|
|
paths = [{
|
|
path = "${serverCfg.configPath}/immich/cache";
|
|
mode = "0750";
|
|
}{
|
|
path = "${serverCfg.dataPath}/immich/";
|
|
mode = "0750";
|
|
}];
|
|
|
|
containers = {
|
|
server = builder.mkContainer {
|
|
subdomain = containerCfg.subdomain;
|
|
image = "ghcr.io/immich-app/immich-server:${version}";
|
|
port = 2283;
|
|
secret = name;
|
|
extraEnv = {
|
|
IMMICH_MACHINE_LEARNING_URL = "http://immich-ml:3003";
|
|
REDIS_HOSTNAME = builder.host;
|
|
};
|
|
overrides = {
|
|
volumes = [
|
|
"${serverCfg.dataPath}/immich:/usr/src/upload"
|
|
];
|
|
};
|
|
};
|
|
|
|
ml = builder.mkContainer {
|
|
image = "ghcr.io/immich-app/immich-machine-learning:${version}";
|
|
port = 3003;
|
|
overrides = {
|
|
volumes = [
|
|
"${serverCfg.configPath}/immich/cache:/cache"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
|
|
setup = {
|
|
trigger = "server";
|
|
script = pkgs.writeShellScript "setup" ''
|
|
PSQL="${pkgs.postgresql}/bin/psql -U postgres"
|
|
$PSQL -d "immich_db" -tAc "CREATE EXTENSION IF NOT EXISTS vchord CASCADE;"
|
|
$PSQL -d "immich_db" -tAc "CREATE EXTENSION IF NOT EXISTS earthdistance CASCADE;"
|
|
'';
|
|
};
|
|
} |