nixpkgs/pkgs/by-name/r2/r2modman/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

126 lines
3.0 KiB
Nix

{
lib,
stdenv,
yarn,
fetchYarnDeps,
fixup-yarn-lock,
nodejs,
electron,
fetchFromGitHub,
nix-update-script,
makeWrapper,
makeDesktopItem,
copyDesktopItems,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "r2modman";
version = "3.1.54";
src = fetchFromGitHub {
owner = "ebkr";
repo = "r2modmanPlus";
rev = "v${finalAttrs.version}";
hash = "sha256-hsaFtQW/awhnBFS6xqDtRvzkzr/afzojYecgglsc3K8=";
};
offlineCache = fetchYarnDeps {
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-VXlFB7hT+aL3yufJ/Ar7FMdrk2Iptf5rdvagAop00lk=";
};
patches = [
# Make it possible to launch Steam games from r2modman.
./steam-launch-fix.patch
];
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/r2modman.png
done
)
makeWrapper '${lib.getExe 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 --enable-wayland-ime=true}}"
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = "r2modman";
exec = "r2modman";
icon = "r2modman";
desktopName = "r2modman";
comment = finalAttrs.meta.description;
categories = [ "Game" ];
keywords = [
"launcher"
"mod manager"
"thunderstore"
];
})
];
passthru.updateScript = nix-update-script { };
meta = {
changelog = "https://github.com/ebkr/r2modmanPlus/releases/tag/v${finalAttrs.version}";
description = "Unofficial Thunderstore mod manager";
homepage = "https://github.com/ebkr/r2modmanPlus";
license = lib.licenses.mit;
mainProgram = "r2modman";
maintainers = with lib.maintainers; [
aidalgol
huantian
];
inherit (electron.meta) platforms;
};
})