diff options
author | Sandro <sandro.jaeckel@gmail.com> | 2023-06-15 16:35:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-15 16:35:16 +0200 |
commit | 9f255a018471e69680a89cb1f2b896612c505915 (patch) | |
tree | 75742e1787ca5b8326a8c45629da099bce8a7c99 /pkgs/games | |
parent | f84036f2b1d4dc61f57c3644e522d9610ee60e86 (diff) | |
parent | d5ee2c96ec7d5697d446def5fb5128e8e8ad94c7 (diff) |
Merge pull request #229551 from aidalgol/r2modman
Diffstat (limited to 'pkgs/games')
-rw-r--r-- | pkgs/games/r2modman/default.nix | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/pkgs/games/r2modman/default.nix b/pkgs/games/r2modman/default.nix new file mode 100644 index 0000000000000..624d1e2f8ee35 --- /dev/null +++ b/pkgs/games/r2modman/default.nix @@ -0,0 +1,113 @@ +{ lib +, stdenv +, yarn +, fetchYarnDeps +, fixup_yarn_lock +, nodejs +, electron +, fetchFromGitHub +, gitUpdater +, makeWrapper +, makeDesktopItem +, copyDesktopItems +}: + +stdenv.mkDerivation rec { + pname = "r2modman"; + version = "3.1.42"; + + src = fetchFromGitHub { + owner = "ebkr"; + repo = "r2modmanPlus"; + rev = "v${version}"; + hash = "sha256-16sE706iivYoI40JJUkqVmtxkYsgAFBg+0tXOc6scqc="; + }; + + offlineCache = fetchYarnDeps { + yarnLock = "${src}/yarn.lock"; + hash = "sha256-CXitb/b2tvTfrkFrFv4KP4WdmMg+1sDtC/s2u5ezDfI="; + }; + + nativeBuildInputs = [ + yarn + fixup_yarn_lock + nodejs + makeWrapper + copyDesktopItems + ]; + + configurePhase = '' + runHook preConfigure + + # Workaround for webpack bug + # https://github.com/webpack/webpack/issues/14532 + export NODE_OPTIONS="--openssl-legacy-provider" + export HOME=$(mktemp -d) + yarn config --offline set yarn-offline-mirror $offlineCache + fixup_yarn_lock yarn.lock + yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive + patchShebangs node_modules/ + + runHook postConfigure + ''; + + buildPhase = '' + runHook preBuild + + yarn --offline quasar build --mode electron --skip-pkg + + # Remove dev dependencies. + yarn install --production --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/r2modman + cp -r dist/electron/UnPackaged/. node_modules $out/share/r2modman + + ( + cd public/icons + for img in *png; do + dimensions=''${img#favicon-} + dimensions=''${dimensions%.png} + mkdir -p $out/share/icons/hicolor/$dimensions/apps + cp $img $out/share/icons/hicolor/$dimensions/apps/${pname}.png + done + ) + + makeWrapper '${electron}/bin/electron' "$out/bin/r2modman" \ + --inherit-argv0 \ + --add-flags "$out/share/r2modman" \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" + + runHook postInstall + ''; + + desktopItems = [ + (makeDesktopItem { + name = pname; + exec = pname; + icon = pname; + desktopName = pname; + comment = meta.description; + categories = [ "Game" ]; + keywords = [ "launcher" "mod manager" "thunderstore" ]; + }) + ]; + + passthru.updateScript = gitUpdater { + rev-prefix = "v"; + }; + + meta = with lib; { + description = "Unofficial Thunderstore mod manager"; + homepage = "https://github.com/ebkr/r2modmanPlus"; + changelog = "https://github.com/ebkr/r2modmanPlus/releases/tag/v${version}"; + license = licenses.mit; + maintainers = with maintainers; [ aidalgol huantian ]; + inherit (electron.meta) platforms; + }; +} |