diff --git a/pkgs/by-name/sh/shiru/0001-Remove-Windows-specific-dep.patch b/pkgs/by-name/sh/shiru/0001-Remove-Windows-specific-dep.patch new file mode 100644 index 000000000000..291b61fc6954 --- /dev/null +++ b/pkgs/by-name/sh/shiru/0001-Remove-Windows-specific-dep.patch @@ -0,0 +1,134 @@ +From 12b0c98a4e844ab18545c8ba521ac1ef71301938 Mon Sep 17 00:00:00 2001 +From: Naomi Roberts +Date: Thu, 4 Dec 2025 19:59:48 +0000 +Subject: [PATCH] Remove Windows-specific dep + +Signed-off-by: Naomi Roberts +--- + electron/package.json | 1 - + electron/src/main/app.js | 17 +---------------- + electron/webpack.config.cjs | 4 +--- + package.json | 1 - + pnpm-lock.yaml | 11 ----------- + 5 files changed, 2 insertions(+), 32 deletions(-) + +diff --git a/electron/package.json b/electron/package.json +index a7b2bd3e..ce55d877 100644 +--- a/electron/package.json ++++ b/electron/package.json +@@ -26,7 +26,6 @@ + "electron-updater": "^6.8.4" + }, + "dependencies": { +- "@paymoapp/electron-shutdown-handler": "^1.1.2", + "@xhayper/discord-rpc": "^1.3.4", + "concurrently": "^9.2.1", + "jimp": "0.22.12", +diff --git a/electron/src/main/app.js b/electron/src/main/app.js +index 5875d276..682d3bb1 100644 +--- a/electron/src/main/app.js ++++ b/electron/src/main/app.js +@@ -7,7 +7,6 @@ import Jimp from 'jimp' + import fs from 'fs' + + import { BrowserWindow, MessageChannelMain, Notification, Tray, Menu, nativeImage, app, dialog, ipcMain, powerMonitor, shell, session } from 'electron' +-import electronShutdownHandler from '@paymoapp/electron-shutdown-handler' + + import { development, getWindowState, saveWindowState, getDefaultBounds } from './util.js' + import Discord from './discord.js' +@@ -157,21 +156,7 @@ export default class App { + notification.show() + }) + +- if (process.platform === 'win32') { +- app.setAppUserModelId('com.github.rockinchaos.shiru') +- // this message usually fires in dev-mode from the parent process +- process.on('message', data => { +- if (data === 'graceful-exit') this.destroy() +- }) +- electronShutdownHandler.setWindowHandle(this.mainWindow.getNativeWindowHandle()) +- electronShutdownHandler.blockShutdown('Saving torrent data...') +- electronShutdownHandler.on('shutdown', async () => { +- await this.destroy() +- electronShutdownHandler.releaseShutdown() +- }) +- } else { +- process.on('SIGTERM', () => this.destroy()) +- } ++ process.on('SIGTERM', () => this.destroy()) + + this.mainWindow.loadURL(development ? 'http://localhost:5000/app.html' : `file://${join(__dirname, '/app.html')}`) + +diff --git a/electron/webpack.config.cjs b/electron/webpack.config.cjs +index 716dfcf7..3c9e4d1f 100644 +--- a/electron/webpack.config.cjs ++++ b/electron/webpack.config.cjs +@@ -78,9 +78,7 @@ module.exports = [ + path: join(__dirname, 'build'), + filename: 'main.js' + }, +- externals: { +- '@paymoapp/electron-shutdown-handler': 'require("@paymoapp/electron-shutdown-handler")' +- }, ++ externals: {}, + resolve: { + aliasFields: [], + alias: { +diff --git a/package.json b/package.json +index 52de5f3a..470faf9d 100644 +--- a/package.json ++++ b/package.json +@@ -48,7 +48,6 @@ + "svelte-keybinds": "patches/svelte-keybinds.patch" + }, + "onlyBuiltDependencies": [ +- "@paymoapp/electron-shutdown-handler", + "bufferutil", + "electron", + "fs-native-extensions", +diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml +index c373d877..e774678a 100644 +--- a/pnpm-lock.yaml ++++ b/pnpm-lock.yaml +@@ -257,9 +257,6 @@ importers: + + electron: + dependencies: +- '@paymoapp/electron-shutdown-handler': +- specifier: ^1.1.2 +- version: 1.1.2 + '@xhayper/discord-rpc': + specifier: ^1.3.4 + version: 1.3.4(bufferutil@4.0.8)(utf-8-validate@6.0.4) +@@ -848,9 +845,6 @@ packages: + '@paralleldrive/cuid2@2.3.1': + resolution: {integrity: sha512-XO7cAxhnTZl0Yggq6jOgjiOHhbgcO4NqFqwSmQpjK3b6TEE6Uj/jfSk6wzYyemh3+I0sHirKSetjQwn5cZktFw==} + +- '@paymoapp/electron-shutdown-handler@1.1.2': +- resolution: {integrity: sha512-/MIC+wdRlVw1Sm56qJcT17O/KBpQARP2tOcAgg1OKB4W83B9IyBBtIoLXkRlpCOEJnGEleuv5HiSBryUgwbFvQ==} +- + '@peculiar/asn1-cms@2.6.1': + resolution: {integrity: sha512-vdG4fBF6Lkirkcl53q6eOdn3XYKt+kJTG59edgRZORlg/3atWWEReRCx5rYE1ZzTTX6vLK5zDMjHh7vbrcXGtw==} + +@@ -4112,9 +4106,6 @@ packages: + node-addon-api@4.3.0: + resolution: {integrity: sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==} + +- node-addon-api@5.1.0: +- resolution: {integrity: sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==} +- + node-addon-api@6.1.0: + resolution: {integrity: sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==} + +@@ -10823,8 +10814,6 @@ snapshots: + + node-addon-api@4.3.0: {} + +- node-addon-api@5.1.0: {} +- + node-addon-api@6.1.0: {} + + node-api-version@0.2.1: +-- +2.53.0 + diff --git a/pkgs/by-name/sh/shiru/package.nix b/pkgs/by-name/sh/shiru/package.nix new file mode 100644 index 000000000000..71f050bff3e9 --- /dev/null +++ b/pkgs/by-name/sh/shiru/package.nix @@ -0,0 +1,120 @@ +{ + lib, + stdenv, + pnpm, + nodejs, + fetchFromGitHub, + python3, + electron_39, + makeDesktopItem, + makeBinaryWrapper, + copyDesktopItems, + fetchPnpmDeps, + pnpmConfigHook, + nix-update-script, +}: +let + electron = electron_39; +in +stdenv.mkDerivation (finalAttrs: { + pname = "shiru"; + version = "6.6.0"; + + src = fetchFromGitHub { + owner = "RockinChaos"; + repo = "shiru"; + tag = "v${finalAttrs.version}"; + hash = "sha256-LccI6Z4hhkmzWHt0CKum9giJMVGm3qM0ZKNvChUCYQ4="; + }; + + patches = [ + # electron-shutdown-handler is only used on Windows and tries to download + # files during build + ./0001-Remove-Windows-specific-dep.patch + ]; + + nativeBuildInputs = [ + nodejs + pnpm + pnpmConfigHook + python3 + makeBinaryWrapper + copyDesktopItems + ]; + + pnpmDeps = fetchPnpmDeps { + inherit (finalAttrs) pname version src; + prePnpmInstall = '' + cd electron + ''; + fetcherVersion = 3; + hash = "sha256-bTo6sEQuUghwm2I99WB7+akL4AOZ1ZN2ovaLWrd5MMg="; + }; + + buildPhase = '' + runHook preBuild + + cd electron + + cp -r ${electron.dist} electron-dist + chmod -R u+w electron-dist + + npm run web:build + + ./node_modules/.bin/electron-builder --dir \ + --c.electronDist=electron-dist \ + --c.electronVersion=${electron.version} + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/share/lib/shiru" + cp -r dist/*-unpacked/{locales,resources{,.pak}} "$out/share/lib/shiru" + + install -Dm644 buildResources/icon.png "$out/share/icons/hicolor/512x512/apps/shiru.png" + + makeWrapper '${electron}/bin/electron' "$out/bin/shiru" \ + --add-flags "$out/share/lib/shiru/resources/app.asar" \ + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}" \ + --inherit-argv0 + + runHook postInstall + ''; + + desktopItems = [ + (makeDesktopItem { + name = "shiru"; + exec = "shiru %U"; + icon = "shiru"; + desktopName = "Shiru"; + genericName = "Personal Media Library"; + comment = "Manage your personal media library, organize your collection, and stream your content in real time, no waiting required!"; + categories = [ + "Video" + "AudioVideo" + ]; + keywords = [ "Anime" ]; + mimeTypes = [ "x-scheme-handler/shiru" ]; + }) + ]; + + strictDeps = true; + __structuredAttrs = true; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Stream your personal media library in real-time"; + homepage = "https://github.com/RockinChaos/Shiru"; + changelog = "https://github.com/RockinChaos/Shiru/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ + naomieow + ]; + platforms = [ "x86_64-linux" ]; + mainProgram = "shiru"; + }; +})