55 lines
1.4 KiB
Nix
Raw Permalink 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;
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;
settings.server.externalDomain = "https://${config.hostnames.photos}";
environment = {
IMMICH_ENV = "production";
IMMICH_LOG_LEVEL = "log";
NO_COLOR = "false";
IMMICH_TRUSTED_PROXIES = "127.0.0.1";
};
};
caddy.routes = [
{
match = [ { host = [ config.hostnames.photos ]; } ];
handle = [
{
handler = "reverse_proxy";
upstreams = [ { dial = "localhost:${builtins.toString config.services.immich.port}"; } ];
}
];
}
];
# Configure Cloudflare DNS to point to this machine
services.cloudflare-dyndns.domains = [ config.hostnames.photos ];
2024-12-07 00:20:12 +00:00
# Point localhost to the local domain
networking.hosts."127.0.0.1" = [ config.hostnames.photos ];
2024-12-12 15:11:35 +00:00
# Backups
services.restic.backups.default.paths = [ "/data/images" ];
2024-12-05 21:58:46 +00:00
};
}