diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-06-07 14:15:00 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-06-07 14:15:00 +0200 |
commit | b4f96580f076068bec3ca58e8f824666a1da1620 (patch) | |
tree | 41908569c64c707500f1f23ef06417581cc14018 | |
parent | hosts/server2: Enable new `git-back` service (diff) | |
download | nixos-server-b4f96580f076068bec3ca58e8f824666a1da1620.zip |
pkgs/sharkey: Remove nixpkgs unstable wrapper
25.05 has hit.
-rw-r--r-- | pkgs/by-name/sh/sharkey/package.nix | 180 | ||||
-rw-r--r-- | pkgs/by-name/sh/sharkey/unstable_package.nix | 176 |
2 files changed, 176 insertions, 180 deletions
diff --git a/pkgs/by-name/sh/sharkey/package.nix b/pkgs/by-name/sh/sharkey/package.nix index 22261fa..a88b7df 100644 --- a/pkgs/by-name/sh/sharkey/package.nix +++ b/pkgs/by-name/sh/sharkey/package.nix @@ -1,4 +1,176 @@ -{pkgsUnstable}: -# NOTE(@bpeetz): The package was written for unstable, and I don't see a reason to migrate -# it back, considering that 25.05 is right around the corner. <2025-04-22> -pkgsUnstable.callPackage ./unstable_package.nix {} +# Source: https://github.com/sodiboo/system/blob/b63c7b27f49043e8701b3ff5e1441cd27d5a2fff/sharkey/package.nix +{ + lib, + stdenv, + fetchFromGitLab, + # Build time + makeWrapper, + copyDesktopItems, + jq, + moreutils, + cacert, + python3, + pkg-config, + # Run time + bash, + jemalloc, + ffmpeg-headless, + nodejs, + pnpm_9, + glib, + vips, + pixman, + pango, + cairo, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "sharkey"; + version = "2025.2.3"; + + src = fetchFromGitLab { + owner = "TransFem-org"; + repo = "Sharkey"; + domain = "activitypub.software"; + rev = finalAttrs.version; + hash = "sha256-VBfkJuoQzQ93sUmJNnr1JUjA2GQNgOIuX+j8nAz3bb4="; + fetchSubmodules = true; + }; + + pnpmDeps = stdenv.mkDerivation { + pname = "${finalAttrs.pname}-pnpm-deps"; + inherit (finalAttrs) src version; + + nativeBuildInputs = [ + jq + moreutils + pnpm_9 + cacert + ]; + + # https://github.com/NixOS/nixpkgs/blob/763e59ffedb5c25774387bf99bc725df5df82d10/pkgs/applications/misc/pot/default.nix#L56 + installPhase = '' + export HOME=$(mktemp --directory) + + pnpm config set store-dir $out + pnpm config set side-effects-cache false + pnpm install --force --frozen-lockfile --ignore-scripts + ''; + + fixupPhase = '' + rm --recursive --force $out/v3/tmp + for f in $(find $out -name "*.json"); do + sed --in-place --regexp-extended --expression='s/"checkedAt":[0-9]+,//g' "$f" + jq --sort-keys . "$f" | sponge "$f" + done + ''; + + dontBuild = true; + outputHashMode = "recursive"; + outputHash = "sha256-ALstAaN8dr5qSnc/ly0hv+oaeKrYFQ3GhObYXOv4E6I="; + }; + + nativeBuildInputs = [ + copyDesktopItems + pnpm_9 + nodejs + makeWrapper + python3 + pkg-config + ]; + + buildInputs = [ + glib + vips + + pixman + pango + cairo + ]; + + configurePhase = '' + runHook preConfigure + + export HOME=$(mktemp --directory) + export STORE_PATH=$(mktemp --directory) + + export npm_config_nodedir=${nodejs} + + cp --no-target-directory --recursive "$pnpmDeps" "$STORE_PATH" + chmod --recursive +w "$STORE_PATH" + + pnpm config set store-dir "$STORE_PATH" + pnpm install --offline --frozen-lockfile --ignore-scripts + + ( + cd node_modules/.pnpm/node_modules/v-code-diff + pnpm run postinstall + ) + ( + cd node_modules/.pnpm/node_modules/re2 + pnpm run rebuild + ) + ( + cd node_modules/.pnpm/node_modules/sharp + pnpm run install + ) + ( + cd node_modules/.pnpm/node_modules/canvas + pnpm run install + ) + + runHook postConfigure + ''; + + buildPhase = '' + runHook preBuild + + pnpm build + + runHook postBuild + ''; + + installPhase = let + libPath = lib.makeLibraryPath [ + jemalloc + ffmpeg-headless + stdenv.cc.cc.lib + ]; + + binPath = lib.makeBinPath [ + bash + pnpm_9 + nodejs + ]; + in + # bash + '' + runHook preInstall + + mkdir --parents $out/Sharkey + + ln --symbolic /var/lib/sharkey $out/Sharkey/files + ln --symbolic /run/sharkey $out/Sharkey/.config + cp --recursive * $out/Sharkey + + # We cannot `--set` the PATH, because sharkey runs shellscripts at start (and maybe + # at other times), which need these things. + makeWrapper ${lib.getExe pnpm_9} $out/bin/sharkey \ + --chdir $out/Sharkey \ + --prefix PATH : ${binPath} \ + --prefix LD_LIBRARY_PATH : ${libPath} + + runHook postInstall + ''; + + passthru = { + inherit (finalAttrs) pnpmDeps; + }; + + meta = { + description = "🌎 A Sharkish microblogging platform 🚀"; + homepage = "https://joinsharkey.org"; + license = lib.licenses.gpl3Only; + platforms = ["x86_64-linux" "aarch64-linux"]; + mainProgram = "sharkey"; + }; +}) diff --git a/pkgs/by-name/sh/sharkey/unstable_package.nix b/pkgs/by-name/sh/sharkey/unstable_package.nix deleted file mode 100644 index a88b7df..0000000 --- a/pkgs/by-name/sh/sharkey/unstable_package.nix +++ /dev/null @@ -1,176 +0,0 @@ -# Source: https://github.com/sodiboo/system/blob/b63c7b27f49043e8701b3ff5e1441cd27d5a2fff/sharkey/package.nix -{ - lib, - stdenv, - fetchFromGitLab, - # Build time - makeWrapper, - copyDesktopItems, - jq, - moreutils, - cacert, - python3, - pkg-config, - # Run time - bash, - jemalloc, - ffmpeg-headless, - nodejs, - pnpm_9, - glib, - vips, - pixman, - pango, - cairo, -}: -stdenv.mkDerivation (finalAttrs: { - pname = "sharkey"; - version = "2025.2.3"; - - src = fetchFromGitLab { - owner = "TransFem-org"; - repo = "Sharkey"; - domain = "activitypub.software"; - rev = finalAttrs.version; - hash = "sha256-VBfkJuoQzQ93sUmJNnr1JUjA2GQNgOIuX+j8nAz3bb4="; - fetchSubmodules = true; - }; - - pnpmDeps = stdenv.mkDerivation { - pname = "${finalAttrs.pname}-pnpm-deps"; - inherit (finalAttrs) src version; - - nativeBuildInputs = [ - jq - moreutils - pnpm_9 - cacert - ]; - - # https://github.com/NixOS/nixpkgs/blob/763e59ffedb5c25774387bf99bc725df5df82d10/pkgs/applications/misc/pot/default.nix#L56 - installPhase = '' - export HOME=$(mktemp --directory) - - pnpm config set store-dir $out - pnpm config set side-effects-cache false - pnpm install --force --frozen-lockfile --ignore-scripts - ''; - - fixupPhase = '' - rm --recursive --force $out/v3/tmp - for f in $(find $out -name "*.json"); do - sed --in-place --regexp-extended --expression='s/"checkedAt":[0-9]+,//g' "$f" - jq --sort-keys . "$f" | sponge "$f" - done - ''; - - dontBuild = true; - outputHashMode = "recursive"; - outputHash = "sha256-ALstAaN8dr5qSnc/ly0hv+oaeKrYFQ3GhObYXOv4E6I="; - }; - - nativeBuildInputs = [ - copyDesktopItems - pnpm_9 - nodejs - makeWrapper - python3 - pkg-config - ]; - - buildInputs = [ - glib - vips - - pixman - pango - cairo - ]; - - configurePhase = '' - runHook preConfigure - - export HOME=$(mktemp --directory) - export STORE_PATH=$(mktemp --directory) - - export npm_config_nodedir=${nodejs} - - cp --no-target-directory --recursive "$pnpmDeps" "$STORE_PATH" - chmod --recursive +w "$STORE_PATH" - - pnpm config set store-dir "$STORE_PATH" - pnpm install --offline --frozen-lockfile --ignore-scripts - - ( - cd node_modules/.pnpm/node_modules/v-code-diff - pnpm run postinstall - ) - ( - cd node_modules/.pnpm/node_modules/re2 - pnpm run rebuild - ) - ( - cd node_modules/.pnpm/node_modules/sharp - pnpm run install - ) - ( - cd node_modules/.pnpm/node_modules/canvas - pnpm run install - ) - - runHook postConfigure - ''; - - buildPhase = '' - runHook preBuild - - pnpm build - - runHook postBuild - ''; - - installPhase = let - libPath = lib.makeLibraryPath [ - jemalloc - ffmpeg-headless - stdenv.cc.cc.lib - ]; - - binPath = lib.makeBinPath [ - bash - pnpm_9 - nodejs - ]; - in - # bash - '' - runHook preInstall - - mkdir --parents $out/Sharkey - - ln --symbolic /var/lib/sharkey $out/Sharkey/files - ln --symbolic /run/sharkey $out/Sharkey/.config - cp --recursive * $out/Sharkey - - # We cannot `--set` the PATH, because sharkey runs shellscripts at start (and maybe - # at other times), which need these things. - makeWrapper ${lib.getExe pnpm_9} $out/bin/sharkey \ - --chdir $out/Sharkey \ - --prefix PATH : ${binPath} \ - --prefix LD_LIBRARY_PATH : ${libPath} - - runHook postInstall - ''; - - passthru = { - inherit (finalAttrs) pnpmDeps; - }; - - meta = { - description = "🌎 A Sharkish microblogging platform 🚀"; - homepage = "https://joinsharkey.org"; - license = lib.licenses.gpl3Only; - platforms = ["x86_64-linux" "aarch64-linux"]; - mainProgram = "sharkey"; - }; -}) |