2023-05-02 20:58:10 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, yarn
|
|
|
|
, fetchYarnDeps
|
2023-11-22 22:01:40 +00:00
|
|
|
, prefetch-yarn-deps
|
2023-05-02 20:58:10 +00:00
|
|
|
, nodejs
|
|
|
|
, electron
|
|
|
|
, fetchFromGitHub
|
|
|
|
, gitUpdater
|
|
|
|
, makeWrapper
|
|
|
|
, makeDesktopItem
|
|
|
|
, copyDesktopItems
|
|
|
|
}:
|
|
|
|
|
2023-12-19 20:44:36 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2023-05-02 20:58:10 +00:00
|
|
|
pname = "r2modman";
|
2024-02-23 23:19:46 +00:00
|
|
|
version = "3.1.47";
|
2023-05-02 20:58:10 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ebkr";
|
|
|
|
repo = "r2modmanPlus";
|
2023-12-19 20:44:36 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
2024-02-23 23:19:46 +00:00
|
|
|
hash = "sha256-refFd/d4y8657FltEvogQVAEl48c5gtrwpuGa8vluqE=";
|
2023-05-02 20:58:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
offlineCache = fetchYarnDeps {
|
2023-12-19 20:44:36 +00:00
|
|
|
yarnLock = "${finalAttrs.src}/yarn.lock";
|
2024-02-23 23:19:46 +00:00
|
|
|
hash = "sha256-1JXd1pDGEFDG+ogXbEpl4WMYXwksJJJBx20ZPykc7OM=";
|
2023-05-02 20:58:10 +00:00
|
|
|
};
|
|
|
|
|
2023-09-12 05:00:52 +00:00
|
|
|
patches = [
|
|
|
|
# Make it possible to launch Steam games from r2modman.
|
|
|
|
./steam-launch-fix.patch
|
|
|
|
];
|
|
|
|
|
2023-05-02 20:58:10 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
yarn
|
2023-11-22 22:01:40 +00:00
|
|
|
prefetch-yarn-deps
|
2023-05-02 20:58:10 +00: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 22:01:40 +00:00
|
|
|
fixup-yarn-lock yarn.lock
|
2023-05-02 20:58:10 +00: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
|
2023-12-19 20:44:36 +00:00
|
|
|
cp $img $out/share/icons/hicolor/$dimensions/apps/r2modman.png
|
2023-05-02 20:58:10 +00:00
|
|
|
done
|
|
|
|
)
|
|
|
|
|
2023-12-11 04:07:42 +00:00
|
|
|
makeWrapper '${lib.getExe electron}' "$out/bin/r2modman" \
|
2023-05-02 20:58:10 +00: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 {
|
2023-12-19 20:44:36 +00:00
|
|
|
name = "r2modman";
|
|
|
|
exec = "r2modman";
|
|
|
|
icon = "r2modman";
|
|
|
|
desktopName = "r2modman";
|
|
|
|
comment = finalAttrs.meta.description;
|
2023-05-02 20:58:10 +00:00
|
|
|
categories = [ "Game" ];
|
|
|
|
keywords = [ "launcher" "mod manager" "thunderstore" ];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
passthru.updateScript = gitUpdater {
|
|
|
|
rev-prefix = "v";
|
|
|
|
};
|
|
|
|
|
2023-12-19 20:44:36 +00:00
|
|
|
meta = {
|
|
|
|
changelog = "https://github.com/ebkr/r2modmanPlus/releases/tag/v${finalAttrs.version}";
|
2023-05-02 20:58:10 +00:00
|
|
|
description = "Unofficial Thunderstore mod manager";
|
|
|
|
homepage = "https://github.com/ebkr/r2modmanPlus";
|
2023-12-19 20:44:36 +00:00
|
|
|
license = lib.licenses.mit;
|
|
|
|
mainProgram = "r2modman";
|
|
|
|
maintainers = with lib.maintainers; [ aidalgol huantian ];
|
2023-05-02 20:58:10 +00:00
|
|
|
inherit (electron.meta) platforms;
|
|
|
|
};
|
2023-12-19 20:44:36 +00:00
|
|
|
})
|