diff options
Diffstat (limited to 'pkgs/unofficial-homestuck-collection/default.nix')
-rw-r--r-- | pkgs/unofficial-homestuck-collection/default.nix | 125 |
1 files changed, 30 insertions, 95 deletions
diff --git a/pkgs/unofficial-homestuck-collection/default.nix b/pkgs/unofficial-homestuck-collection/default.nix index 3096d4d..ec09b2b 100644 --- a/pkgs/unofficial-homestuck-collection/default.nix +++ b/pkgs/unofficial-homestuck-collection/default.nix @@ -6,33 +6,12 @@ fetchurl, fetchYarnDeps, fixup-yarn-lock, - autoPatchelfHook, + replaceVars, writableTmpDirAsHomeHook, - git, - copyDesktopItems, - 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, }: stdenv.mkDerivation (finalAttrs: { pname = "unofficial-homestuck-collection"; @@ -42,12 +21,17 @@ stdenv.mkDerivation (finalAttrs: { owner = "GiovanH"; repo = "unofficial-homestuck-collection"; rev = "v${finalAttrs.version}"; - hash = "sha256-rCeWayu32+Y3JRgqTLe36AcxZT+mXZnEaEAkJbL3iI0="; - leaveDotGit = true; + hash = "sha256-hmGvOsx5OUesXD3Nat00IVDra36IpeFLFklwcMu1UTU="; }; patches = [ - ./0001-fix-source.patch + (replaceVars ./0001-disable-git-rev-check.patch { + git_branch = "'main'"; + git_revision = "'${finalAttrs.src.rev}'"; + git_remote = "'${finalAttrs.src.url}'"; + }) + ./0002-disable-update-check.patch + ./0003-make-compatible-with-native-electron.patch ]; offlineCache = fetchYarnDeps { @@ -55,42 +39,14 @@ stdenv.mkDerivation (finalAttrs: { 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 - copyDesktopItems 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 @@ -102,9 +58,8 @@ stdenv.mkDerivation (finalAttrs: { 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 + echo > node_modules/phantomjs-prebuilt/install.js + echo > node_modules/electron/index.js runHook postConfigure ''; @@ -112,15 +67,11 @@ stdenv.mkDerivation (finalAttrs: { 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 \ + --dir \ -c.electronDist=${electron.dist} \ -c.electronVersion=${electron.version} \ --config ${./electron-builder.yml} @@ -131,53 +82,37 @@ stdenv.mkDerivation (finalAttrs: { installPhase = '' runHook preInstall - install -Dm644 build/icons/16x16.png $out/share/icons/hicolor/16x16/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/24x24.png $out/share/icons/hicolor/24x24/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/32x32.png $out/share/icons/hicolor/32x32/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/48x48.png $out/share/icons/hicolor/48x48/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/64x64.png $out/share/icons/hicolor/64x64/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/128x128.png $out/share/icons/hicolor/128x128/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/256x256.png $out/share/icons/hicolor/256x256/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/512x512.png $out/share/icons/hicolor/512x512/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/1024x1024.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 \ + for i in 16x16 24x24 48x48 64x64 128x128 256x256 512x512; do + install -Dm644 build/icons/$i.png $out/share/icons/hicolor/$i/apps/dev.bambosh.UnofficialHomestuckCollection.png + done + install -Dm644 build/dev.bambosh.UnofficialHomestuckCollection.metainfo.xml $out/share/metainfo/dev.bambosh.UnofficialHomestuckCollection.metainfo.xml + install -Dm644 build/dev.bambosh.UnofficialHomestuckCollection.desktop $out/share/applications/dev.bambosh.UnofficialHomestuckCollection.desktop + install -d $out/bin $out/share/unofficial-homestuck-collection + cp -r dist_electron/*-unpacked/{locales,resources{,.pak}} $out/share/unofficial-homestuck-collection + makeWrapper ${lib.getExe electron} $out/bin/unofficial-homestuck-collection \ + --add-flags $out/share/unofficial-homestuck-collection/resources/app.asar \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \ + --add-flags --no-sandbox \ --set LD_LIBRARY_PATH "${ - lib.makeLibraryPath [ - glibc - gcc-unwrapped.lib - libglvnd - ] - }" \ - --add-flags --no-sandbox + lib.makeLibraryPath [ + libglvnd + ] + }" \ + --inherit-argv0 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; + license = lib.licenses.gpl3Plus; 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"]; + platforms = lib.platforms.linux; }; }) |