From 9925eb833969fad0afc245699c6386effd54751b Mon Sep 17 00:00:00 2001 From: RatCornu Date: Sun, 16 Feb 2025 19:31:19 +0100 Subject: [PATCH] szurubooru: init at 2.5-unstable-2025-02-11 --- pkgs/servers/web-apps/szurubooru/client.nix | 36 +++++++++ pkgs/servers/web-apps/szurubooru/default.nix | 20 +++++ pkgs/servers/web-apps/szurubooru/server.nix | 82 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 4 files changed, 140 insertions(+) create mode 100644 pkgs/servers/web-apps/szurubooru/client.nix create mode 100644 pkgs/servers/web-apps/szurubooru/default.nix create mode 100644 pkgs/servers/web-apps/szurubooru/server.nix diff --git a/pkgs/servers/web-apps/szurubooru/client.nix b/pkgs/servers/web-apps/szurubooru/client.nix new file mode 100644 index 000000000000..9553390862d4 --- /dev/null +++ b/pkgs/servers/web-apps/szurubooru/client.nix @@ -0,0 +1,36 @@ +{ + src, + version, + lib, + buildNpmPackage, +}: + +buildNpmPackage { + pname = "szurubooru-client"; + inherit version; + + src = "${src}/client"; + + npmDepsHash = "sha256-HtcitZl2idgVleB6c0KCTSNLxh7hP8/G/RGdMaQG3iI="; + makeCacheWritable = true; + + npmBuildFlags = [ + "--gzip" + ]; + + installPhase = '' + runHook preInstall + + mkdir $out + mv ./public/* $out + + runHook postInstall + ''; + + meta = with lib; { + description = "Client of szurubooru, an image board engine for small and medium communities"; + homepage = "https://github.com/rr-/szurubooru"; + license = licenses.gpl3; + maintainers = with maintainers; [ ratcornu ]; + }; +} diff --git a/pkgs/servers/web-apps/szurubooru/default.nix b/pkgs/servers/web-apps/szurubooru/default.nix new file mode 100644 index 000000000000..67d7b57aa20f --- /dev/null +++ b/pkgs/servers/web-apps/szurubooru/default.nix @@ -0,0 +1,20 @@ +{ + callPackage, + fetchFromGitHub, + recurseIntoAttrs, +}: + +let + version = "2.5-unstable-2025-02-11"; + src = fetchFromGitHub { + owner = "rr-"; + repo = "szurubooru"; + rev = "376f687c386f65522b2f65e98b998b21af26ee29"; + hash = "sha256-4w1iOYp+CVg60dYxRilj08D4Hle6R9Y0v+Nd3fws1Zc="; + }; +in + +recurseIntoAttrs { + client = callPackage ./client.nix { inherit src version; }; + server = callPackage ./server.nix { inherit src version; }; +} diff --git a/pkgs/servers/web-apps/szurubooru/server.nix b/pkgs/servers/web-apps/szurubooru/server.nix new file mode 100644 index 000000000000..a85b749c7426 --- /dev/null +++ b/pkgs/servers/web-apps/szurubooru/server.nix @@ -0,0 +1,82 @@ +{ + src, + version, + lib, + fetchPypi, + python3, +}: + +let + overrides = [ + (self: super: { + alembic = super.alembic.overridePythonAttrs (oldAttrs: rec { + version = "1.14.1"; + src = fetchPypi { + pname = "alembic"; + inherit version; + sha256 = "sha256-SW6IgkWlOt8UmPyrMXE6Rpxlg2+N524BOZqhw+kN0hM="; + }; + doCheck = false; + }); + + pyheif = super.pyheif.overridePythonAttrs (oldAttrs: { + doCheck = false; + }); + + sqlalchemy = super.sqlalchemy.overridePythonAttrs (oldAttrs: rec { + version = "1.3.23"; + src = fetchPypi { + pname = "SQLAlchemy"; + inherit version; + sha256 = "sha256-b8ozZyV4Zm9lfBMVUsTviXnBYG5JT3jNUZl0LfsmkYs="; + }; + + doCheck = false; + }); + }) + ]; + + python = python3.override { + self = python; + packageOverrides = lib.composeManyExtensions overrides; + }; +in + +python.pkgs.buildPythonApplication { + pname = "szurubooru-server"; + inherit version; + pyproject = true; + + src = "${src}/server"; + + nativeBuildInputs = with python.pkgs; [ setuptools ]; + propagatedBuildInputs = with python.pkgs; [ + alembic + certifi + coloredlogs + heif-image-plugin + numpy + pillow-avif-plugin + pillow + psycopg2-binary + pyheif + pynacl + pyrfc3339 + pytz + pyyaml + sqlalchemy + yt-dlp + ]; + + postInstall = '' + mkdir $out/bin + install -m0755 $src/szuru-admin $out/bin/szuru-admin + ''; + + meta = with lib; { + description = "Server of szurubooru, an image board engine for small and medium communities"; + homepage = "https://github.com/rr-/szurubooru"; + license = licenses.gpl3; + maintainers = with maintainers; [ ratcornu ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 16748b632d83..94b5763734ed 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9676,6 +9676,8 @@ with pkgs; svxlink = libsForQt5.callPackage ../applications/radio/svxlink { }; + szurubooru = callPackage ../servers/web-apps/szurubooru { }; + tclap = tclap_1_2; tclap_1_2 = callPackage ../development/libraries/tclap/1.2.nix { };