2023-05-02 22:58:10 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, yarn
|
|
|
|
, fetchYarnDeps
|
2023-11-22 23:01:40 +01:00
|
|
|
, prefetch-yarn-deps
|
2023-05-02 22:58:10 +02:00
|
|
|
, nodejs
|
|
|
|
, electron
|
|
|
|
, fetchFromGitHub
|
|
|
|
, gitUpdater
|
|
|
|
, makeWrapper
|
|
|
|
, makeDesktopItem
|
|
|
|
, copyDesktopItems
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "r2modman";
|
2023-11-26 17:29:02 +01:00
|
|
|
version = "3.1.45";
|
2023-05-02 22:58:10 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ebkr";
|
|
|
|
repo = "r2modmanPlus";
|
|
|
|
rev = "v${version}";
|
2023-11-26 17:29:02 +01:00
|
|
|
hash = "sha256-6o6iPDKKqCzt7H0a64HGTvEvwO6hjRh1Drl8o4x+4ew=";
|
2023-05-02 22:58:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
offlineCache = fetchYarnDeps {
|
|
|
|
yarnLock = "${src}/yarn.lock";
|
|
|
|
hash = "sha256-CXitb/b2tvTfrkFrFv4KP4WdmMg+1sDtC/s2u5ezDfI=";
|
|
|
|
};
|
|
|
|
|
2023-09-12 07:00:52 +02:00
|
|
|
patches = [
|
|
|
|
# Make it possible to launch Steam games from r2modman.
|
|
|
|
./steam-launch-fix.patch
|
|
|
|
];
|
|
|
|
|
2023-05-02 22:58:10 +02:00
|
|
|
nativeBuildInputs = [
|
|
|
|
yarn
|
2023-11-22 23:01:40 +01:00
|
|
|
prefetch-yarn-deps
|
2023-05-02 22:58:10 +02:00
|
|
|
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
|
2023-11-22 23:01:40 +01:00
|
|
|
fixup-yarn-lock yarn.lock
|
2023-05-02 22:58:10 +02:00
|
|
|
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
|
|
|
|
)
|
|
|
|
|
2023-12-11 05:07:42 +01:00
|
|
|
makeWrapper '${lib.getExe electron}' "$out/bin/r2modman" \
|
2023-05-02 22:58:10 +02:00
|
|
|
--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;
|
2023-12-11 05:07:59 +01:00
|
|
|
mainProgram = pname;
|
2023-05-02 22:58:10 +02:00
|
|
|
};
|
|
|
|
}
|