summaryrefslogtreecommitdiff
path: root/pkgs/unofficial-homestuck-collection/default.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkgs/unofficial-homestuck-collection/default.nix171
1 files changed, 162 insertions, 9 deletions
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"];
+ };
+})