From 52d73755bfba2f71a72c6170d9c49cf9417f8e5b Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Wed, 18 Dec 2024 22:36:25 +0100 Subject: [PATCH] jellyseerr --- flake.lock | 85 ++++++------------------------------- flake.nix | 3 +- images/jellyseerr-2.1.0.nix | 82 +++++++++++++++++++++++++++++++++++ images/jellyseerr.nix | 21 +++++++++ modules/media.nix | 4 +- 5 files changed, 122 insertions(+), 73 deletions(-) create mode 100644 images/jellyseerr-2.1.0.nix create mode 100644 images/jellyseerr.nix diff --git a/flake.lock b/flake.lock index 0bf506f..9f4d188 100644 --- a/flake.lock +++ b/flake.lock @@ -28,7 +28,7 @@ "deploy-rs": { "inputs": { "flake-compat": "flake-compat_3", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_2", "utils": "utils" }, "locked": { @@ -588,28 +588,6 @@ } }, "nixng": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ], - "treefmt-nix": "treefmt-nix_2" - }, - "locked": { - "lastModified": 1734470616, - "narHash": "sha256-8pQ2ar2NVU3ehf1o9DHcn3rlsl440eOWcEv7bQfiOec=", - "owner": "pizzapim", - "repo": "NixNG", - "rev": "fd29c877186dbb06d5593d734952baec199a5261", - "type": "github" - }, - "original": { - "owner": "pizzapim", - "ref": "radicale", - "repo": "NixNG", - "type": "github" - } - }, - "nixng_2": { "inputs": { "nixpkgs": [ "servers", @@ -664,16 +642,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1726871744, - "narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=", + "lastModified": 1733581040, + "narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2", + "rev": "22c3f2cf41a0e70184334a958e6b124fb0ce3e01", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -743,22 +721,6 @@ } }, "nixpkgs_2": { - "locked": { - "lastModified": 1733581040, - "narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "22c3f2cf41a0e70184334a958e6b124fb0ce3e01", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1702272962, "narHash": "sha256-D+zHwkwPc6oYQ4G3A1HuadopqRwUY/JkMwHz1YF7j4Q=", @@ -774,7 +736,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_3": { "locked": { "lastModified": 1726871744, "narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=", @@ -790,7 +752,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_4": { "locked": { "lastModified": 1733097829, "narHash": "sha256-9hbb1rqGelllb4kVUCZ307G2k3/UhmA8PPGBoyuWaSw=", @@ -839,10 +801,9 @@ "git-hooks": "git-hooks", "kubenix": "kubenix", "nixhelm": "nixhelm", - "nixng": "nixng", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs", "servers": "servers", - "treefmt-nix": "treefmt-nix_4" + "treefmt-nix": "treefmt-nix_3" } }, "servers": { @@ -854,7 +815,7 @@ "git-hooks": "git-hooks_2", "kubenix": "kubenix_2", "nix-snapshotter": "nix-snapshotter", - "nixng": "nixng_2", + "nixng": "nixng", "nixos-facter-modules": "nixos-facter-modules", "nixos-hardware": "nixos-hardware", "nixpkgs": [ @@ -862,7 +823,7 @@ ], "nixpkgs-unstable": "nixpkgs-unstable", "sops-nix": "sops-nix", - "treefmt-nix": "treefmt-nix_3" + "treefmt-nix": "treefmt-nix_2" }, "locked": { "lastModified": 1733068232, @@ -1062,25 +1023,7 @@ }, "treefmt-nix_2": { "inputs": { - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1727984844, - "narHash": "sha256-xpRqITAoD8rHlXQafYZOLvUXCF6cnZkPfoq67ThN0Hc=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "4446c7a6fc0775df028c5a3f6727945ba8400e64", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, - "treefmt-nix_3": { - "inputs": { - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1730025913, @@ -1096,9 +1039,9 @@ "type": "github" } }, - "treefmt-nix_4": { + "treefmt-nix_3": { "inputs": { - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_4" }, "locked": { "lastModified": 1733662930, diff --git a/flake.nix b/flake.nix index ad58734..00bca57 100644 --- a/flake.nix +++ b/flake.nix @@ -41,7 +41,8 @@ }; nixng = { - url = "github:pizzapim/NixNG/radicale"; + # url = "github:pizzapim/NixNG/jellyseerr"; + url = "git+file:///home/pim/git/forks/NixNG"; inputs.nixpkgs.follows = "nixpkgs"; }; }; diff --git a/images/jellyseerr-2.1.0.nix b/images/jellyseerr-2.1.0.nix new file mode 100644 index 0000000..02afde9 --- /dev/null +++ b/images/jellyseerr-2.1.0.nix @@ -0,0 +1,82 @@ +{ + lib, + pnpm_9, + fetchFromGitHub, + stdenv, + makeWrapper, + nodejs, + python3, + sqlite, + nix-update-script, +}: +stdenv.mkDerivation rec { + pname = "jellyseerr"; + version = "2.1.0"; + + src = fetchFromGitHub { + owner = "Fallenbagel"; + repo = "jellyseerr"; + rev = "v${version}"; + hash = "sha256-5kaeqhjUy9Lgx4/uFcGRlAo+ROEOdTWc2m49rq8R8Hs="; + }; + + pnpmDeps = pnpm_9.fetchDeps { + inherit pname version src; + hash = "sha256-xu6DeaBArQmnqEnIgjc1DTZujQebSkjuai9tMHeQWCk="; + }; + + buildInputs = [sqlite]; + + nativeBuildInputs = [ + python3 + nodejs + makeWrapper + pnpm_9.configHook + ]; + + preBuild = '' + export npm_config_nodedir=${nodejs} + pushd node_modules + pnpm rebuild bcrypt sqlite3 + popd + ''; + + buildPhase = '' + runHook preBuild + pnpm build + pnpm prune --prod --ignore-scripts + rm -rf .next/cache + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + mkdir -p $out/share + cp -r -t $out/share .next node_modules dist config package.json overseerr-api.yml + runHook postInstall + ''; + + postInstall = '' + mkdir -p $out/bin + makeWrapper '${nodejs}/bin/node' "$out/bin/jellyseerr" \ + --add-flags "$out/share/dist/index.js" \ + --chdir "$out/share" \ + --set NODE_ENV production + ''; + + passthru.updateScript = nix-update-script {}; + + meta = with lib; { + description = "Fork of overseerr for jellyfin support"; + homepage = "https://github.com/Fallenbagel/jellyseerr"; + longDescription = '' + Jellyseerr is a free and open source software application for managing + requests for your media library. It is a a fork of Overseerr built to + bring support for Jellyfin & Emby media servers! + ''; + license = licenses.mit; + maintainers = with maintainers; [camillemndn]; + platforms = platforms.linux; + mainProgram = "jellyseerr"; + }; +} diff --git a/images/jellyseerr.nix b/images/jellyseerr.nix new file mode 100644 index 0000000..afd5664 --- /dev/null +++ b/images/jellyseerr.nix @@ -0,0 +1,21 @@ +{ + nglib, + nixpkgs, + ... +}: +nglib.makeSystem { + inherit nixpkgs; + system = "x86_64-linux"; + name = "nixng-jellyseerr"; + + config = {pkgs, ...}: { + dinit.enable = true; + init.services.jellyseerr.shutdownOnExit = true; + + services.jellyseerr = { + enable = true; + package = pkgs.callPackage ./jellyseerr-2.1.0.nix {}; + configDir = "/app/config"; + }; + }; +} diff --git a/modules/media.nix b/modules/media.nix index 3ed17d3..1166b5c 100644 --- a/modules/media.nix +++ b/modules/media.nix @@ -1,7 +1,9 @@ { + self, globals, config, lib, + utils, ... }: { options.media.enable = lib.mkEnableOption "media"; @@ -167,7 +169,7 @@ volumes.config.persistentVolumeClaim.claimName = "jellyseerr"; containers.jellyseerr = { - image = globals.images.jellyseerr; + image = utils.nixSnapshotterRef (utils.mkNixNGImage "jellyseerr" "${self}/images/jellyseerr.nix"); ports.web.containerPort = 5055; imagePullPolicy = "IfNotPresent";