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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
{
lib,
stdenv,
electron,
fetchFromGitHub,
fetchurl,
fetchYarnDeps,
fixup-yarn-lock,
autoPatchelfHook,
writableTmpDirAsHomeHook,
git,
makeDesktopItem,
makeWrapper,
nodejs,
yarn,
alsa-lib,
at-spi2-atk,
cairo,
cups,
ffmpeg,
flac,
gcc-unwrapped,
glibc,
gtk3,
libgbm,
libglvnd,
libpng,
libpulseaudio,
libjpeg,
libxkbcommon,
libxslt,
nspr,
nss,
pango,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "unofficial-homestuck-collection";
version = "2.7.0";
src = fetchFromGitHub {
owner = "GiovanH";
repo = "unofficial-homestuck-collection";
rev = "v${finalAttrs.version}";
hash = "sha256-rCeWayu32+Y3JRgqTLe36AcxZT+mXZnEaEAkJbL3iI0=";
leaveDotGit = true;
};
patches = [
./0001-fix-source.patch
];
offlineCache = fetchYarnDeps {
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-mo5Ir/pLoqc6K/0AOJqKC0yup7vx9UrNfQ+casIgBCo=";
};
phantomJS = fetchurl {
url = "https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2";
hash = "sha256-ht2aS/Su5F8ahMn2HPGUfB1tzpuejSqQcQXaeFJGDS8=";
};
nativeBuildInputs = [
autoPatchelfHook
fixup-yarn-lock
git
makeWrapper
nodejs
writableTmpDirAsHomeHook
yarn
];
buildInputs = [
alsa-lib
at-spi2-atk
cairo
cups
flac
gtk3
libgbm
libpng
libpulseaudio
libjpeg
libxkbcommon
libxslt
nspr
nss
pango
];
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
configurePhase = ''
runHook preConfigure
# setup yarn
fixup-yarn-lock yarn.lock
yarn config --offline set ignore-engines true
yarn config --offline set yarn-offline-mirror $offlineCache
yarn install --offline --frozen-lockfile --ignore-scripts --no-progress
patchShebangs node_modules
# fixup node_modules
cp $phantomJS node_modules/phantomjs-prebuilt/phantomjs.tar.bz2
patch node_modules/phantomjs-prebuilt/install.js ${./phantomjs.patch}
touch node_modules/electron/path.txt
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
pushd node_modules/phantomjs-prebuilt
node install.js
popd
make src/imods.tar.gz
make src/js/crc_imods.json
env NODE_OPTIONS=--max_old_space_size=8192 \
yarn run vue-cli-service electron:build \
--linux --dir \
-c.electronDist=${electron.dist} \
-c.electronVersion=${electron.version} \
--config ${./electron-builder.yml}
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dm644 public/icon.png $out/share/icons/hicolor/1024x1024/apps/unofficial-homestuck-collection.png
mkdir -p $out/share/unofficial-homestuck-collection $out/bin
cp -r dist_electron/linux-unpacked/* $out/share/unofficial-homestuck-collection
makeWrapper $out/share/unofficial-homestuck-collection/unofficial-homestuck-collection $out/bin/unofficial-homestuck-collection \
--set LD_LIBRARY_PATH "${
lib.makeLibraryPath [
glibc
gcc-unwrapped.lib
libglvnd
]
}" \
--add-flags --no-sandbox
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = "unofficial-homestuck-collection";
exec = "unofficial-homestuck-collection";
icon = "unofficial-homestuck-collection";
desktopName = "unofficial-homestuck-collection";
categories = ["Game"];
mimeTypes = ["x-scheme-handler/mspa"];
})
];
meta = {
description = "Offline collection of Homestuck and its related works";
homepage = "https://homestuck.giovanh.com/unofficial-homestuck-collection/";
changelog = "https://github.com/GiovanH/unofficial-homestuck-collection/releases/tag/v${finalAttrs.version}";
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [
kenshineto
];
mainProgram = "unofficial-homestuck-collection";
# phantomjs does not support aarch64 :(
# TODO: kenshineto: macos support, i dont own a mac
platforms = ["x86_64-linux"];
};
})
|