8 cfg = config.services.immich-public-proxy;
9 format = pkgs.formats.json { };
18 options.services.immich-public-proxy = {
19 enable = mkEnableOption "Immich Public Proxy";
20 package = lib.mkPackageOption pkgs "immich-public-proxy" { };
22 immichUrl = mkOption {
24 description = "URL of the Immich instance";
30 description = "The port that IPP will listen on.";
32 openFirewall = mkOption {
35 description = "Whether to open the IPP port in the firewall";
39 type = types.submodule {
40 freeformType = format.type;
44 Configuration for IPP. See <https://github.com/alangrainger/immich-public-proxy/blob/main/README.md#additional-configuration> for options and defaults.
49 config = mkIf cfg.enable {
50 systemd.services.immich-public-proxy = {
51 description = "Immich public proxy for sharing albums publicly without exposing your Immich instance";
52 after = [ "network.target" ];
53 wantedBy = [ "multi-user.target" ];
55 IMMICH_URL = cfg.immichUrl;
56 IPP_PORT = builtins.toString cfg.port;
57 IPP_CONFIG = "${format.generate "config.json" cfg.settings}";
60 ExecStart = lib.getExe cfg.package;
61 SyslogIdentifier = "ipp";
66 Restart = "on-failure";
70 CapabilityBoundingSet = "";
71 NoNewPrivileges = true;
74 PrivateDevices = true;
77 ProtectControlGroups = true;
79 ProtectHostname = true;
80 ProtectKernelLogs = true;
81 ProtectKernelModules = true;
82 ProtectKernelTunables = true;
83 RestrictAddressFamilies = [
88 RestrictNamespaces = true;
89 RestrictRealtime = true;
90 RestrictSUIDSGID = true;
94 networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.port ];
96 meta.maintainers = with lib.maintainers; [ jaculabilis ];