feat(immich): add synology external library
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2025-01-14 12:45:43 -05:00
parent 6adb3eca18
commit a7d1d64472
2 changed files with 49 additions and 6 deletions

View file

@ -0,0 +1,2 @@
# upload script with secrets
upload.sh

View file

@ -1,28 +1,64 @@
{ {
config, config,
lib,
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) attrValues;
inherit (config.sops) secrets; inherit (config.sops) secrets;
inherit (config.khepri) rwDataDir; inherit (config.khepri) rwDataDir;
rwPath = rwDataDir + "/immich"; rwPath = rwDataDir + "/immich";
UPLOAD_LOCATION = "${rwPath}/data"; UPLOAD_LOCATION = "${rwPath}/data";
synologyPath = "/var/lib/synology-immich";
in { in {
# NFS client setup
services.rpcbind.enable = true;
boot.supportedFilesystems = ["nfs"];
environment.systemPackages = attrValues {
inherit
(pkgs)
nfs-utils
immich-go # for uploading google photos
;
};
systemd.mounts = let
host = "10.0.0.117";
in [
{
type = "nfs";
mountConfig = {
Options = "noatime";
};
what = "${host}:/volume1/Photo-Immich";
where = synologyPath;
requiredBy = ["docker-immich_immich_server.service"];
}
];
# Docker compose
khepri.compositions."immich" = { khepri.compositions."immich" = {
networks.proxy_net = {external = true;}; networks.proxy_net = {external = true;};
services = { services = {
"immich_server" = { "immich_server" = {
image = import ./images/server.nix pkgs; image = import ./images/server.nix pkgs;
restart = "always";
environmentFiles = [ environmentFiles = [
"${./env}" ./env
secrets.immich.path secrets.immich.path
]; ];
volumes = [ volumes = [
# "${synologyPath}:/usr/src/app/upload:rw"
"${UPLOAD_LOCATION}:/usr/src/app/upload:rw" "${UPLOAD_LOCATION}:/usr/src/app/upload:rw"
"${synologyPath}:${synologyPath}:rw"
]; ];
ports = [ ports = [
"2283:2283" "2283:2283"
@ -30,16 +66,17 @@ in {
networks = ["proxy_net"]; networks = ["proxy_net"];
dependsOn = ["immich_redis" "immich_postgres"]; dependsOn = ["immich_redis" "immich_postgres"];
restart = "always";
environment.NODE_ENV = "production"; environment.NODE_ENV = "production";
}; };
"immich_machine_learning" = { "immich_machine_learning" = {
image = import ./images/machine-learning.nix pkgs; image = import ./images/machine-learning.nix pkgs;
restart = "always"; restart = "always";
environmentFiles = [ environmentFiles = [
"${./env}" ./env
secrets.immich.path secrets.immich.path
]; ];
networks = ["proxy_net"]; networks = ["proxy_net"];
@ -51,20 +88,24 @@ in {
"immich_redis" = { "immich_redis" = {
image = import ./images/redis.nix pkgs; image = import ./images/redis.nix pkgs;
restart = "always"; restart = "always";
tmpfs = ["/data"];
environmentFiles = [ environmentFiles = [
"${./env}" ./env
secrets.immich.path secrets.immich.path
]; ];
networks = ["proxy_net"]; networks = ["proxy_net"];
tmpfs = ["/data"];
}; };
"immich_postgres" = { "immich_postgres" = {
image = import ./images/postgres.nix pkgs; image = import ./images/postgres.nix pkgs;
restart = "always"; restart = "always";
environmentFiles = [ environmentFiles = [
"${./env}" ./env
secrets.immich.path secrets.immich.path
]; ];
networks = ["proxy_net"]; networks = ["proxy_net"];