Skip to content

Instantly share code, notes, and snippets.

@John-Gee
Last active January 3, 2026 09:15
Show Gist options
  • Select an option

  • Save John-Gee/c4792dc33976464c7428983d59ab03aa to your computer and use it in GitHub Desktop.

Select an option

Save John-Gee/c4792dc33976464c7428983d59ab03aa to your computer and use it in GitHub Desktop.
trim seerr
# Maintainer: txtsd <aur.archlinux@ihavea.quest>
# Maintainer: Donald Webster <fryfrog@gmail.com>
# Contributor: jab416171 <jab416171@gmail.com>
# Contributor: Martins Mozeiko <martins.mozeiko@gmail.com>
pkgname=seerr
pkgver=2.7.3
pkgrel=3
pkgdesc='Request management and media discovery tool for the Plex ecosystem'
arch=(x86_64 aarch64)
url='https://github.com/seerr-team/seerr'
license=('MIT')
depends=(
bash
gcc-libs
glibc
nodejs
)
optdepends=(
'jellyfin-server: The Free Software Media System'
'plex-media-server: Plex Media Server'
'emby-server: The open media solution'
'sonarr: Smart PVR for newsgroup and torrent users'
'radarr: Movie organizer/manager for usenet and torrent users'
)
makedepends=(pnpm)
backup=(
etc/conf.d/seerr
usr/lib/seerr/config/settings.json
)
options=(!strip !debug)
install=seerr.install
source=(
"${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz"
# "arch.patch::${url}/compare/develop...pnpm-10-for-arch-folks.patch"
arch.patch
seerr.sysusers
seerr.tmpfiles
seerr.service
seerr.conf.d
)
sha256sums=('d0444cecd385452e452954b13b8a0e2b9b299fbef0cecc70c44ad089d8d84b78'
'ac808d77ca9144040c5f72b05744e941aa0aa3eb90a9daccc4184d9054071a05'
'1a4a8daf655c530ebf24d89d036458aa75d7ae2de21a99a2b10eb02c2df1ac81'
'8e137d571603af4ad83dd55a79d743bf1360de84af2db05dfb9289ccf649973d'
'34f139015c3537ced763080832f691f3fca012ee4c126c7c66d8e120085d5290'
'517a51fac3bbbd0149434f06f3be272c922299b1414396d4e3d66fe6b1082277')
prepare() {
cd "${pkgname}-${pkgver}"
patch -Np1 -i "../arch.patch"
sed -i 's/husky install//' package.json
echo "{\"commitTag\": \"${pkgver}\"}" > committag.json
export NEXT_TELEMETRY_DISABLED=1
pnpm update jwa
pnpm install
}
build() {
cd "${pkgname}-${pkgver}"
export NEXT_TELEMETRY_DISABLED=1
export CYPRESS_INSTALL_BINARY=0
# See: https://aur.archlinux.org/packages/jellyseerr#comment-998270
export SHARP_IGNORE_GLOBAL_LIBVIPS=1
pnpm build
pnpm prune --prod --ignore-scripts
}
package() {
cd "${pkgname}-${pkgver}"
install -dm755 "${pkgdir}/usr/lib/seerr"
# Copy seerr
cp -dr --no-preserve='ownership' ./{.next,dist,public,node_modules} "${pkgdir}/usr/lib/seerr"
cp -d --no-preserve='ownership' ./{package.json,jellyseerr-api.yml,next.config.js} "${pkgdir}/usr/lib/seerr"
# Remove cache
rm -rf "${pkgdir}/usr/lib/seerr/.next/cache"
# -----------------------------------------------------------
# SAFE CLEANUP: Remove Build Caches (~600MB reduction)
# -----------------------------------------------------------
echo "Removing build caches..."
# Delete Webpack/Terser caches in node_modules
rm -rf "${pkgdir}/usr/lib/seerr/node_modules/.cache"
# Prune text files (Optional, requires node-prune)
if command -v node-prune &> /dev/null; then
node-prune "${pkgdir}/usr/lib/seerr/node_modules" || true
fi
# -----------------------------------------------------------
# POST-INSTALL CLEANUP (~400MB+ Reduction)
# -----------------------------------------------------------
echo "Performing safe cleanup..."
pushd "${pkgdir}/usr/lib/seerr" > /dev/null
# Remove Source Maps (Pure debugging files, 100% safe)
find . -name "*.map" -type f -delete
# Remove Foreign Architectures (Binaries for other OSs)
# - Remove Alpine Linux (musl) binaries (Arch uses glibc)
find node_modules -type d -name "*-musl*" -exec rm -rf {} +
find node_modules -type d -name "*linuxmusl*" -exec rm -rf {} +
# - Remove Android/Mobile artifacts (Web app only)
find node_modules -type d -name "*android*" -exec rm -rf {} +
find node_modules -type d -name "react-native" ! -path "*/typeorm/*" -exec rm -rf {} +
# - Remove macOS/Windows binaries (If they exist)
find node_modules -type f \( -name "*.dylib" -o -name "*.dll" -o -name "*.exe" \) -delete
# Remove TypeScript Compiler (Production runs compiled JS)
find node_modules -type d -name "typescript" -exec rm -rf {} +
# Remove Development Definitions & Sources (Safe for production)
find node_modules -type f \( -name "*.d.ts" -o -name "*.flow" \) -delete
find node_modules -type f \( -name "*.cc" -o -name "*.h" -o -name "*.c" -o -name "*.cpp" \) -delete
# Remove SWC Binaries (Build-time only, ~175MB)
find node_modules -type d -name "@next+swc-linux-x64-gnu*" -exec rm -rf {} +
find node_modules -type d -name "@swc+core-linux-x64-gnu*" -exec rm -rf {} +
find node_modules -type d -name "swc-linux-x64-gnu" -exec rm -rf {} +
find node_modules -type d -name "core-linux-x64-gnu" -exec rm -rf {} +
# Remove Ace Builds Source (Keep minified, ~30MB)
find node_modules -type d -name "ace-builds" -exec sh -c 'rm -rf "$1/src" "$1/src-noconflict"' _ {} \;
# Remove React Devtools (~18MB)
find node_modules -type d -name "react-devtools-core" -exec rm -rf {} +
# Remove Documentation & Tests (Text file bloat)
find node_modules -type f \( -name "*.md" -o -name "*.markdown" -o -name "LICENSE" \) -delete
find node_modules -type d -name "test" -exec rm -rf {} +
find node_modules -type d -name "__tests__" -exec rm -rf {} +
popd > /dev/null
# Fix paths
find "${pkgdir}/usr/lib/seerr/.next" -type f -print0 | xargs -0 sed -i "s^${srcdir}/${pkgname}-${pkgver}^/usr/lib/seerr^g"
# Install license
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
# Systemd
cd "${srcdir}"
install -Dm644 seerr.conf.d "${pkgdir}/etc/conf.d/seerr"
install -Dm644 seerr.sysusers "${pkgdir}/usr/lib/sysusers.d/seerr.conf"
install -Dm644 seerr.tmpfiles "${pkgdir}/usr/lib/tmpfiles.d/seerr.conf"
install -Dm644 seerr.service "${pkgdir}/usr/lib/systemd/system/seerr.service"
}
@John-Gee
Copy link
Author

John-Gee commented Jan 3, 2026

arch.patch:

diff --git i/package.json w/package.json
index 67cbb55e..de454bb2 100644
--- i/package.json
+++ w/package.json
@@ -173,13 +173,20 @@
"typescript": "4.9.5"
},
"engines": {

  • "node": "^22.0.0",
  • "pnpm": "^9.0.0"
  • "node": "^22.0.0",
  • "pnpm": "^10.0.0"
    },
    "overrides": {
    "sqlite3/node-gyp": "8.4.1",
  • "@types/express-session": "1.17.6"
  • "@types/express-session": "1.17.6",
  • "ace-builds": "1.15.2"
    },
  • "pnpm": {
  • "onlyBuiltDependencies": [
  •  "sqlite3",
    
  •  "bcrypt"
    
  • ]
  • },
    "config": {
    "commitizen": {
    "path": "./node_modules/cz-conventional-changelog"
    diff --git i/server/index.ts w/server/index.ts
    index d8aadfa0..eff9037d 100644
    --- i/server/index.ts
    +++ w/server/index.ts
    @@ -162,7 +162,7 @@ app
    }
    });
    if (settings.network.csrfProtection) {
  •  server.use(
    
  •  server.use(() =>
       csurf({
         cookie: {
           httpOnly: true,
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment