diff options
author | Freya Murphy <freya@freyacat.org> | 2025-07-17 16:09:52 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-07-17 16:12:37 -0400 |
commit | 647af34808ba8a5f7c33306091c32e9f62016bde (patch) | |
tree | 79a9cc96af8363757c4e3678e1aee38ad4b427fb | |
parent | fix hyprlock fade (diff) | |
download | dotfiles-nix-647af34808ba8a5f7c33306091c32e9f62016bde.tar.gz dotfiles-nix-647af34808ba8a5f7c33306091c32e9f62016bde.tar.bz2 dotfiles-nix-647af34808ba8a5f7c33306091c32e9f62016bde.zip |
unofficial-homestuck-collection: no longer app image
4 files changed, 259 insertions, 9 deletions
diff --git a/pkgs/unofficial-homestuck-collection/0001-fix-source.patch b/pkgs/unofficial-homestuck-collection/0001-fix-source.patch new file mode 100644 index 0000000..df1144a --- /dev/null +++ b/pkgs/unofficial-homestuck-collection/0001-fix-source.patch @@ -0,0 +1,40 @@ +From 0d63f04b5224bda4b5e9a37767da912c7ba1ef1c Mon Sep 17 00:00:00 2001 +From: Freya Murphy <freya@freyacat.org> +Date: Thu, 17 Jul 2025 12:58:56 -0400 +Subject: [PATCH] fix source + +--- + src/background.js | 3 ++- + src/store/localData.js | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/background.js b/src/background.js +index 426a84a..3b587ab 100644 +--- a/src/background.js ++++ b/src/background.js +@@ -747,7 +747,8 @@ async function createWindow () { + titleBarStyle: 'hidden', + autoHideMenuBar: true, + webPreferences: { +- nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION, ++ nodeIntegration: true, ++ contextIsolation: false, + enableRemoteModule: true, + plugins: true, + webviewTag: true +diff --git a/src/store/localData.js b/src/store/localData.js +index 2be2235..69833ff 100644 +--- a/src/store/localData.js ++++ b/src/store/localData.js +@@ -33,7 +33,7 @@ const migrations = { + '2.6.9': store => { + const settings_prev = store.get('settings', {}) + if (settings_prev && !isWebApp && settings_prev.ruffleFallback) { +- store.set('settings.ruffleFallback', false) ++ store.set('settings.ruffleFallback', true) + } + } + } +-- +2.50.0 + diff --git a/pkgs/unofficial-homestuck-collection/default.nix b/pkgs/unofficial-homestuck-collection/default.nix index 75f84a3..fdbeae0 100644 --- a/pkgs/unofficial-homestuck-collection/default.nix +++ b/pkgs/unofficial-homestuck-collection/default.nix @@ -1,19 +1,172 @@ { - pkgs, lib, - appimageTools, + stdenv, + electron, + fetchFromGitHub, fetchurl, + fetchYarnDeps, + fixup-yarn-lock, + autoPatchelfHook, + writableTmpDirAsHomeHook, + git, + makeDesktopItem, + makeWrapper, + nodejs, + yarn, + alsa-lib, + at-spi2-atk, + cairo, + cups, + ffmpeg, + flac, + gcc-unwrapped, + glibc, + gtk3, + libgbm, + libglvnd, + libpng, + libpulseaudio, + libjpeg, + libxkbcommon, + libxslt, + nspr, + nss, + pango, }: -appimageTools.wrapType2 rec { +stdenv.mkDerivation (finalAttrs: { pname = "unofficial-homestuck-collection"; version = "2.7.0"; - src = fetchurl { - url = "https://github.com/GiovanH/unofficial-homestuck-collection/releases/download/v${version}/The-Unofficial-Homestuck-Collection-${version}.AppImage"; - hash = "sha256-IfDEgKlRwAlpctiwL+lOTgBdSdUGFxCdArlu+dDiEcY="; + src = fetchFromGitHub { + owner = "GiovanH"; + repo = "unofficial-homestuck-collection"; + rev = "v${finalAttrs.version}"; + hash = "sha256-rCeWayu32+Y3JRgqTLe36AcxZT+mXZnEaEAkJbL3iI0="; + leaveDotGit = true; }; - extraInstallCommands = '' - sed -i 's/$@"/$@" --no-sandbox/' "$out/bin/unofficial-homestuck-collection" + patches = [ + ./0001-fix-source.patch + ]; + + offlineCache = fetchYarnDeps { + yarnLock = "${finalAttrs.src}/yarn.lock"; + hash = "sha256-mo5Ir/pLoqc6K/0AOJqKC0yup7vx9UrNfQ+casIgBCo="; + }; + + phantomJS = fetchurl { + url = "https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2"; + hash = "sha256-ht2aS/Su5F8ahMn2HPGUfB1tzpuejSqQcQXaeFJGDS8="; + }; + + nativeBuildInputs = [ + autoPatchelfHook + fixup-yarn-lock + git + makeWrapper + nodejs + writableTmpDirAsHomeHook + yarn + ]; + + buildInputs = [ + alsa-lib + at-spi2-atk + cairo + cups + flac + gtk3 + libgbm + libpng + libpulseaudio + libjpeg + libxkbcommon + libxslt + nspr + nss + pango + ]; + + env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; + + configurePhase = '' + runHook preConfigure + + # setup yarn + fixup-yarn-lock yarn.lock + yarn config --offline set ignore-engines true + yarn config --offline set yarn-offline-mirror $offlineCache + yarn install --offline --frozen-lockfile --ignore-scripts --no-progress + patchShebangs node_modules + + # fixup node_modules + cp $phantomJS node_modules/phantomjs-prebuilt/phantomjs.tar.bz2 + patch node_modules/phantomjs-prebuilt/install.js ${./phantomjs.patch} + touch node_modules/electron/path.txt + + runHook postConfigure ''; -} + + buildPhase = '' + runHook preBuild + + pushd node_modules/phantomjs-prebuilt + node install.js + popd + + make src/imods.tar.gz + make src/js/crc_imods.json + env NODE_OPTIONS=--max_old_space_size=8192 \ + yarn run vue-cli-service electron:build \ + --linux --dir \ + -c.electronDist=${electron.dist} \ + -c.electronVersion=${electron.version} \ + --config ${./electron-builder.yml} + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + install -Dm644 public/icon.png $out/share/icons/hicolor/1024x1024/apps/unofficial-homestuck-collection.png + mkdir -p $out/share/unofficial-homestuck-collection $out/bin + cp -r dist_electron/linux-unpacked/* $out/share/unofficial-homestuck-collection + makeWrapper $out/share/unofficial-homestuck-collection/unofficial-homestuck-collection $out/bin/unofficial-homestuck-collection \ + --set LD_LIBRARY_PATH "${ + lib.makeLibraryPath [ + glibc + gcc-unwrapped.lib + libglvnd + ] + }" \ + --add-flags --no-sandbox + + runHook postInstall + ''; + + desktopItems = [ + (makeDesktopItem { + name = "unofficial-homestuck-collection"; + exec = "unofficial-homestuck-collection"; + icon = "unofficial-homestuck-collection"; + desktopName = "unofficial-homestuck-collection"; + categories = ["Game"]; + mimeTypes = ["x-scheme-handler/mspa"]; + }) + ]; + + meta = { + description = "Offline collection of Homestuck and its related works"; + homepage = "https://homestuck.giovanh.com/unofficial-homestuck-collection/"; + changelog = "https://github.com/GiovanH/unofficial-homestuck-collection/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [ + kenshineto + ]; + mainProgram = "unofficial-homestuck-collection"; + # phantomjs does not support aarch64 :( + # TODO: kenshineto: macos support, i dont own a mac + platforms = ["x86_64-linux"]; + }; +}) diff --git a/pkgs/unofficial-homestuck-collection/electron-builder.yml b/pkgs/unofficial-homestuck-collection/electron-builder.yml new file mode 100644 index 0000000..bfb1ba0 --- /dev/null +++ b/pkgs/unofficial-homestuck-collection/electron-builder.yml @@ -0,0 +1,21 @@ +directories: + output: dist_electron + buildResources: build + app: dist_electron/bundled +files: + - filter: + - '**' +extends: null +appId: com.bambosh.unofficialhomestuckcollection +productName: The Unofficial Homestuck Collection +copyright: Copyright © 2025 GiovanH +protocols: + name: Unofficial Homestuck Collection + role: Viewer + schemes: + - mspa +linux: + asarUnpack: + - '**/*.node' + maintainer: GiovanH <uhscollection@icloud.com> + category: game diff --git a/pkgs/unofficial-homestuck-collection/phantomjs.patch b/pkgs/unofficial-homestuck-collection/phantomjs.patch new file mode 100644 index 0000000..e59a89a --- /dev/null +++ b/pkgs/unofficial-homestuck-collection/phantomjs.patch @@ -0,0 +1,36 @@ +406,416c406 +< if (!downloadSpec) { +< console.error( +< 'Unexpected platform or architecture: ' + getTargetPlatform() + '/' + getTargetArch() + '\n' + +< 'It seems there is no binary available for your platform/architecture\n' + +< 'Try to install PhantomJS globally') +< exit(1) +< } +< +< var downloadUrl = downloadSpec.url +< var downloadedFile +< +--- +> var downloadedFile = "phantomjs.tar.bz2" +418,436c408 +< // Can't use a global version so start a download. +< var tmpPath = findSuitableTempDirectory() +< var fileName = downloadUrl.split('/').pop() +< downloadedFile = path.join(tmpPath, fileName) +< +< if (fs.existsSync(downloadedFile)) { +< console.log('Download already available at', downloadedFile) +< return verifyChecksum(downloadedFile, downloadSpec.checksum) +< } +< return false +< }).then(function (verified) { +< if (verified) { +< return downloadedFile +< } +< +< // Start the install. +< console.log('Downloading', downloadUrl) +< console.log('Saving to', downloadedFile) +< return requestBinary(getRequestOptions(), downloadedFile) +--- +> return downloadedFile |