56 lines
1.4 KiB
Nix
Raw Normal View History

2024-12-05 21:58:46 +00:00
{ config, lib, ... }:
2025-01-20 22:35:40 -05:00
let
cfg = config.nmasur.presets.services.immich;
2025-02-08 12:58:06 -05:00
hostnames = config.nmasur.settings.hostnames;
2025-01-20 22:35:40 -05:00
in
2024-12-05 21:58:46 +00:00
{
2025-01-20 22:35:40 -05:00
options.nmasur.presets.services.immich.enable = lib.mkEnableOption "Immich photo manager";
config = lib.mkIf cfg.enable {
2024-12-05 21:58:46 +00:00
services.immich = {
2025-01-20 22:35:40 -05:00
enable = true;
2024-12-05 21:58:46 +00:00
port = 2283;
2025-01-20 22:35:40 -05:00
group = lib.mkIf config.nmasur.profiles.shared-media.enable "shared";
2024-12-05 21:58:46 +00:00
database.enable = true;
redis.enable = true;
machine-learning.enable = true;
machine-learning.environment = { };
mediaLocation = "/data/images";
secretsFile = null;
2025-02-08 12:58:06 -05:00
settings.server.externalDomain = "https://${hostnames.photos}";
2024-12-05 21:58:46 +00:00
environment = {
IMMICH_ENV = "production";
IMMICH_LOG_LEVEL = "log";
NO_COLOR = "false";
IMMICH_TRUSTED_PROXIES = "127.0.0.1";
};
};
caddy.routes = [
{
2025-02-08 12:58:06 -05:00
match = [ { host = [ hostnames.photos ]; } ];
2024-12-05 21:58:46 +00:00
handle = [
{
handler = "reverse_proxy";
upstreams = [ { dial = "localhost:${builtins.toString config.services.immich.port}"; } ];
}
];
}
];
# Configure Cloudflare DNS to point to this machine
2025-02-08 12:58:06 -05:00
services.cloudflare-dyndns.domains = [ hostnames.photos ];
2024-12-05 21:58:46 +00:00
2024-12-07 00:20:12 +00:00
# Point localhost to the local domain
2025-02-08 12:58:06 -05:00
networking.hosts."127.0.0.1" = [ hostnames.photos ];
2024-12-07 00:20:12 +00:00
2024-12-12 15:11:35 +00:00
# Backups
services.restic.backups.default.paths = [ "/data/images" ];
2024-12-05 21:58:46 +00:00
};
}