nix/modules/nixos/services/containerised/imgproxy/default.nix
Ameya Shenoy 4998e822a7 feat: init
Signed-off-by: Ameya Shenoy <shenoy.ameya@gmail.com>
2024-11-11 01:48:40 +05:30

36 lines
1.1 KiB
Nix

{ config, lib, ... }: {
options.snowflake.services.containerised.imgproxy = {
enable = lib.mkEnableOption "enable imgproxy";
domain = lib.mkOption {
type = lib.types.str;
description = "domain name to host imgproxy on";
};
version = lib.mkOption {
type = lib.types.str;
description = "imgproxy version to use";
};
};
config = lib.mkIf config.snowflake.services.containerised.imgproxy.enable {
virtualisation.oci-containers.containers.imgproxy = {
autoStart = true;
image =
"docker.io/darthsim/imgproxy:${config.snowflake.services.containerised.imgproxy.version}";
ports = [ "127.0.0.1:8080:8080" ];
environment = {
IMGPROXY_MAX_ANIMATION_FRAMES = "10";
IMGPROXY_USER_AGENT = "Mozilla/5.0";
};
};
services.nginx.virtualHosts."${config.snowflake.services.containerised.imgproxy.domain}" =
{
serverName = config.snowflake.services.containerised.imgproxy.domain;
enableACME = true;
forceSSL = true;
locations."/" = { proxyPass = "http://127.0.0.1:8080/"; };
};
};
}