From 03648b3d9f177227df40129bed22558f6924b91c Mon Sep 17 00:00:00 2001 From: spl3g Date: Wed, 18 Mar 2026 18:01:41 +0300 Subject: so.. v2 i guess --- modules/nixosModules/watcharr.nix | 74 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 modules/nixosModules/watcharr.nix (limited to 'modules/nixosModules/watcharr.nix') diff --git a/modules/nixosModules/watcharr.nix b/modules/nixosModules/watcharr.nix new file mode 100644 index 0000000..2263e4f --- /dev/null +++ b/modules/nixosModules/watcharr.nix @@ -0,0 +1,74 @@ +{ + inputs, + self, + ... +}: { + flake.nixosModules.watcharr = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.services.watcharr; + port = builtins.toString cfg.settings.port; + in { + options = { + services.watcharr = { + enable = mkEnableOption "Enable watcharr service"; + subdomain = mkOption { + type = types.str; + description = '' + Subdomain to use for nginx. + ''; + }; + settings = { + dataDir = mkOption { + type = types.path; + description = '' + Watcharr data directory. + ''; + default = "/var/lib/watcharr"; + }; + port = mkOption { + type = types.port; + default = 3080; + description = '' + Port to use. + ''; + }; + }; + }; + }; + + config = mkIf cfg.enable { + createPaths = { + "${cfg.settings.dataDir}" = { + owner = "root"; + group = "root"; + permissions = "0750"; + }; + }; + + nginxProxy = { + enable = true; + subdomains = { + "${cfg.subdomain}" = { + proxyPass = "http://127.0.0.1:${port}"; + proxyWebsockets = true; + }; + }; + }; + + virtualisation.oci-containers.containers.watcharr = { + image = "ghcr.io/sbondco/watcharr:latest"; + ports = [ + "127.0.0.1${port}:3080" + ]; + volumes = [ + "${cfg.settings.dataDir}:/data" + ]; + }; + }; + }; +} -- cgit v1.2.3