aboutsummaryrefslogtreecommitdiff
path: root/modules/nixosModules/watcharr.nix
diff options
context:
space:
mode:
authorspl3g <notspl3g@duck.com>2026-03-18 18:01:41 +0300
committerspl3g <notspl3g@duck.com>2026-03-18 18:01:59 +0300
commit03648b3d9f177227df40129bed22558f6924b91c (patch)
tree8a22eda142beeafd9002a8d5901ba9428a77ad52 /modules/nixosModules/watcharr.nix
parentdc19a2b583b3ab50d8e36ff0a90ca633495f675f (diff)
so.. v2 i guess
Diffstat (limited to 'modules/nixosModules/watcharr.nix')
-rw-r--r--modules/nixosModules/watcharr.nix74
1 files changed, 74 insertions, 0 deletions
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"
+ ];
+ };
+ };
+ };
+}