Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r2modman: init at 3.1.42 #229551

Merged
merged 1 commit into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions pkgs/games/r2modman/default.nix
Original file line number Diff line number Diff line change
@@ -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)
aidalgol marked this conversation as resolved.
Show resolved Hide resolved
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";
};
aidalgol marked this conversation as resolved.
Show resolved Hide resolved

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;
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36542,6 +36542,8 @@ with pkgs;

r2mod_cli = callPackage ../games/r2mod_cli { };

r2modman = callPackage ../games/r2modman { };

racer = callPackage ../games/racer { };

randtype = callPackage ../games/randtype { };
Expand Down