Update mastodon to 4.3.0

Yarn v2 hacks mostly stolen from d7eb0c761a
This commit is contained in:
Agatha Lovelace 2024-01-30 23:20:45 +01:00
parent c0f6d1ea7e
commit ff11eaead4
Signed by: sorceress
GPG Key ID: 01D0B3AB10CED4F8
5 changed files with 503 additions and 423 deletions

View File

@ -1,6 +1,5 @@
{ lib, stdenv, nodejs-slim, bundlerEnv, nixosTests, yarn, callPackage
, imagemagick, ffmpeg, file, ruby, writeShellScript, fetchYarnDeps
, fixup_yarn_lock, brotli
{ lib, stdenv, nodejs-slim, bundlerEnv, nixosTests, yarn-berry, callPackage
, imagemagick, ffmpeg, file, ruby, writeShellScript, brotli
# Allow building a fork or custom version of Mastodon:
, pname ? "mastodon", version ? srcOverride.version, patches ? [ ]
# src is a package
@ -34,19 +33,13 @@ stdenv.mkDerivation rec {
pname = "${pname}-modules";
inherit src version;
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
yarnOfflineCache = callPackage ./yarn.nix {
src = srcOverride;
hash = yarnHash;
};
nativeBuildInputs = [
fixup_yarn_lock
nodejs-slim
yarn
mastodonGems
mastodonGems.wrappedRuby
brotli
];
nativeBuildInputs =
[ nodejs-slim yarn-berry mastodonGems mastodonGems.wrappedRuby brotli ];
RAILS_ENV = "production";
NODE_ENV = "production";
@ -58,9 +51,12 @@ stdenv.mkDerivation rec {
# This option is needed for openssl-3 compatibility
# Otherwise we encounter this upstream issue: https://github.com/mastodon/mastodon/issues/17924
export NODE_OPTIONS=--openssl-legacy-provider
fixup_yarn_lock ~/yarn.lock
yarn config --offline set yarn-offline-mirror $yarnOfflineCache
yarn install --offline --frozen-lockfile --ignore-engines --ignore-scripts --no-progress
export YARN_ENABLE_TELEMETRY=0
mkdir -p ~/.yarn/berry
ln -sf $yarnOfflineCache ~/.yarn/berry/cache
yarn install --immutable --immutable-cache
patchShebangs ~/bin
patchShebangs ~/node_modules
@ -70,7 +66,7 @@ stdenv.mkDerivation rec {
OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder \
rails assets:precompile
yarn cache clean --offline
yarn cache clean
rm -rf ~/node_modules/.cache
# Create missing static gzip and brotli files

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,15 @@
# This file was generated by pkgs.mastodon.updateScript.
{ fetchFromGitHub, applyPatches, patches ? [ ] }:
let
version = "8fbaf6711d6d33de2fcc62888a7109993a5c8f24";
in
(
applyPatches {
let version = "4615ff9a14d80753ebbae8eb6174d43f553241ad";
in (applyPatches {
src = fetchFromGitHub {
owner = "AgathaSorceress";
repo = "mastodon";
rev = "${version}";
hash = "sha256-AVlugSNe55feq3RUiFITU0MWcIr9rNAa1iqPFV3aVPg=";
sha256 = "bTjyeZbxdkAtLb63jBgNUKhlnXY0KIpGAN0YCglcT5E=";
};
patches = patches ++ [];
patches = patches ++ [ ./yarn-typescript.patch ];
}) // {
inherit version;
yarnHash = "sha256-WsPNqV1PC2YjL37qnWfRTj8LaIBUI7+C0cWTfFd7HGo=";
yarnHash = "sha256-qE1TBqa3BSEu1MC3Qw/k3h7QEicWd3AwJdA+U1v8924=";
}

View File

@ -0,0 +1,15 @@
--- a/yarn.lock
+++ b/yarn.lock
@@ -16483,11 +16483,11 @@
"typescript@patch:typescript@npm%3A5#optional!builtin<compat/typescript>, typescript@patch:typescript@npm%3A^5.0.4#optional!builtin<compat/typescript>":
version: 5.3.3
- resolution: "typescript@patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7"
+ resolution: "typescript@patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=29ae49"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
- checksum: 1d0a5f4ce496c42caa9a30e659c467c5686eae15d54b027ee7866744952547f1be1262f2d40de911618c242b510029d51d43ff605dba8fb740ec85ca2d3f9500
+ checksum: e22df47df9b2b2f2617b8bf511a29aea3d177f9f7a0756818230a76b01cbd7da988bf55f9463aaa1a4c1ff90b80f8dc5676460d4e9dfc010572cbba59b822b0c
languageName: node
linkType: hard

View File

@ -0,0 +1,32 @@
{ stdenvNoCC, yarn-berry, cacert, src, hash }:
stdenvNoCC.mkDerivation {
pname = "yarn-deps";
version = hash;
nativeBuildInputs = [ yarn-berry cacert ];
inherit src;
dontInstall = true;
NODE_EXTRA_CA_CERTS = "${cacert}/etc/ssl/certs/ca-bundle.crt";
buildPhase = ''
mkdir -p $out
export HOME=$(mktemp -d)
echo $HOME
export YARN_ENABLE_TELEMETRY=0
export YARN_COMPRESSION_LEVEL=0
cache="$(yarn config get cacheFolder)"
yarn install --immutable --mode skip-build
cp -r $cache/* $out/
'';
outputHashAlgo = "sha256";
outputHash = hash;
outputHashMode = "recursive";
}