blob: 594a431300ca3f22b44a985a93e5bbc7c3894e74 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
{ lib
, stdenv
, yarn
, fetchYarnDeps
, fixup-yarn-lock
, nodejs
, electron
, fetchFromGitHub
, gitUpdater
, makeWrapper
, makeDesktopItem
, copyDesktopItems
}:
stdenv.mkDerivation (finalAttrs: {
pname = "r2modman";
version = "3.1.49";
src = fetchFromGitHub {
owner = "ebkr";
repo = "r2modmanPlus";
rev = "v${finalAttrs.version}";
hash = "sha256-Br+VkBHgwM/Zu1aypzlVYHB/v8T/KV+B6XUNJn/EbYM=";
};
offlineCache = fetchYarnDeps {
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-ntXZ4gRXRqiPQxdwXDsLxGdBqUV5eboy9ntTlJsz9FA=";
};
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}}"
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 = gitUpdater {
rev-prefix = "v";
};
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;
};
})
|