2024-08-02 16:03:09 +03:00
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.mj.services.photoprism;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.mj.services.photoprism = with lib.types; {
|
|
|
|
enable = lib.mkEnableOption "enable photoprism";
|
|
|
|
uidgid = lib.mkOption { type = int; };
|
|
|
|
paths = lib.mkOption { type = attrsOf str; };
|
|
|
|
passwordFile = lib.mkOption { type = str; };
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
services.photoprism = {
|
|
|
|
enable = true;
|
2024-08-02 16:42:17 +03:00
|
|
|
originalsPath = "/var/cache/photoprism/userdata";
|
2024-08-02 16:03:09 +03:00
|
|
|
passwordFile = cfg.passwordFile;
|
|
|
|
};
|
|
|
|
|
2024-08-02 16:18:07 +03:00
|
|
|
systemd = {
|
2024-08-02 16:42:17 +03:00
|
|
|
tmpfiles.rules = [ "d /var/cache/photoprism/userdata 0700 photoprism photoprism -" ];
|
2024-08-02 16:18:07 +03:00
|
|
|
services.photoprism.serviceConfig = {
|
|
|
|
ProtectHome = lib.mkForce "tmpfs";
|
2024-08-02 16:42:17 +03:00
|
|
|
CacheDirectory = "photoprism";
|
2024-08-02 16:18:07 +03:00
|
|
|
BindPaths = lib.mapAttrsToList (
|
2024-08-02 16:42:17 +03:00
|
|
|
name: srcpath: "${srcpath}:/var/cache/photoprism/userdata/${name}"
|
2024-08-02 16:18:07 +03:00
|
|
|
) cfg.paths;
|
|
|
|
};
|
2024-08-02 16:03:09 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
users = {
|
|
|
|
groups.photoprism.gid = cfg.uidgid;
|
|
|
|
users.photoprism = {
|
|
|
|
group = "photoprism";
|
|
|
|
uid = cfg.uidgid;
|
|
|
|
};
|
|
|
|
};
|
2024-08-03 06:03:55 +03:00
|
|
|
|
2024-08-02 16:03:09 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|