immich: +bindPaths wip

This commit is contained in:
Motiejus Jakštys 2024-09-27 20:04:41 +03:00
parent 26ca91301b
commit dc32165b5c
2 changed files with 15 additions and 12 deletions

View File

@ -443,7 +443,8 @@ in
immich = {
enable = true;
paths = {
bindAsUser = "motiejus";
bindPaths = {
"M-Camera" = "/home/motiejus/annex2/M-Active";
"Pictures" = "/home/motiejus/annex2/Pictures";
};

View File

@ -12,7 +12,8 @@ in
{
options.mj.services.immich = with lib.types; {
enable = lib.mkEnableOption "enable immich";
paths = lib.mkOption { type = attrsOf str; };
bindPaths = lib.mkOption { type = attrsOf str; };
bindAsUser = lib.mkOption { type = str; };
};
imports = [ "${nixpkgs-unstable}/nixos/modules/services/web-apps/immich.nix" ];
@ -29,16 +30,17 @@ in
reverse_proxy localhost:${toString myData.ports.immich-server}
'';
#systemd = {
# #tmpfiles.rules = [ "d /var/cache/immich/userdata 0700 immich immich -" ];
# services.immich-server.serviceConfig = {
# #ProtectHome = lib.mkForce "tmpfs";
# #CacheDirectory = "immich";
# #BindPaths = lib.mapAttrsToList (
# # name: srcpath: "${srcpath}:/var/cache/immich/userdata/${name}"
# #) cfg.paths;
# };
#};
systemd = {
tmpfiles.rules = [
"d /var/cache/immich/userdata 0700 immich immich -"
] ++ lib.mapAttrsToList (name: _: "/var/cache/immich/userdata/${name}") cfg.bindPaths;
services.immich-server.serviceConfig = {
ExecStartPre = lib.mapAttrsToList (
name: srcpath:
"+${pkgs.bindfs}/bin/bindfs -u ${cfg.bindAsUser} ${srcpath} /var/cache/immich/userdata/${name}"
) cfg.bindPaths;
};
};
};