From 260cf209714402e076feed78168b14033ff2aee2 Mon Sep 17 00:00:00 2001 From: nyanloutre Date: Sun, 14 Jul 2024 16:14:45 +0200 Subject: [PATCH] LoutreOS: install watcharr --- flake.nix | 15 +++++++++++++++ pkgs/watcharr/default.nix | 11 ++++++----- systems/LoutreOS/web.nix | 1 + 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 7fc25dc..2a5a3c3 100644 --- a/flake.nix +++ b/flake.nix @@ -61,6 +61,21 @@ }; }; }; + systemd.services.watcharr = { + description = "Watcharr"; + after = [ "network.target" ]; + environment = { + PORT = "3005"; + WATCHARR_DATA = "/var/lib/watcharr"; + }; + serviceConfig = { + DynamicUser = true; + StateDirectory = "watcharr"; + ExecStart = "${self.packages.x86_64-linux.watcharr}/bin/Watcharr"; + PrivateTmp = true; + }; + wantedBy = [ "multi-user.target" ]; + }; } ./systems/LoutreOS/configuration.nix ]; diff --git a/pkgs/watcharr/default.nix b/pkgs/watcharr/default.nix index d58b28b..23422d7 100644 --- a/pkgs/watcharr/default.nix +++ b/pkgs/watcharr/default.nix @@ -11,18 +11,18 @@ }: let - version = "1.39.0"; + version = "1.41.0"; src = fetchFromGitHub { owner = "sbondCo"; repo = "Watcharr"; rev = "v${version}"; - sha256 = "sha256-40XLYc1ub2Qzf8r9g+Ay8Y8CAHYU+P9CI60heLAuQkE="; + hash = "sha256-ZvCxgfZZ9pbp+NvH+IhWphJWnAwgAH0x/REPd/XxJ70="; }; frontend = buildNpmPackage { pname = "watcharr-ui"; inherit version src; - npmDepsHash = "sha256-sigkeK1bLbZfOU8756yLt5avqnOJWC4t4TnV6EvFTPY="; + npmDepsHash = "sha256-73paI0y4QyzkEnU99f1HeLD/hW8GP3F9N8tGGQnloH8="; installPhase = '' cp -r build $out @@ -37,14 +37,15 @@ buildGoModule { src = src + "/server"; - vendorHash = "sha256-vmroCetQc1Ix65B2Br33lyWt0FwGeQXMoD5fLinQg28="; + vendorHash = "sha256-86pFpS8ZSj+c7vwn0QCwzXlvVYJIf3SBj4X81zlwBWQ="; # Inject frontend assets into go embed prePatch = '' # rm -rf ui # ln -s ${frontend} ui substituteInPlace watcharr.go \ - --replace-fail ui/index.js ${frontend}/index.js + --replace-fail ui/index.js ${frontend}/index.js \ + --replace-fail \"127.0.0.1:3000\" "\"127.0.0.1:\"+os.Getenv(\"PORT\")" ''; buildInputs = [ pkgs.makeWrapper ]; diff --git a/systems/LoutreOS/web.nix b/systems/LoutreOS/web.nix index 036a528..64dbdde 100644 --- a/systems/LoutreOS/web.nix +++ b/systems/LoutreOS/web.nix @@ -352,6 +352,7 @@ in forceSSL = true; enableACME = true; }; + "watcharr.nyanlout.re" = simpleReverse 3080; }; };