1{ lib
2, fetchzip
3, fetchYarnDeps
4, yarn2nix-moretea
5, nodejs_18
6, dos2unix
7}:
8
9yarn2nix-moretea.mkYarnPackage {
10 version = "1.1.6";
11
12 src = fetchzip {
13 url = "https://registry.npmjs.org/meshcentral/-/meshcentral-1.1.6.tgz";
14 sha256 = "03f2jyjrxmmr28949m3niwb437akyp6kg6h1m2jkaxfg5yj4hs4v";
15 };
16
17 patches = [ ./fix-js-include-paths.patch ];
18
19 packageJSON = ./package.json;
20 yarnLock = ./yarn.lock;
21
22 offlineCache = fetchYarnDeps {
23 yarnLock = ./yarn.lock;
24 hash = "sha256-aKWa6pvIi2JkOtpiWH19KZoncPuSIgvDk/j7PvXp2nw=";
25 };
26
27 # Tarball has CRLF line endings. This makes patching difficult, so let's convert them.
28 nativeBuildInputs = [ dos2unix ];
29 prePatch = ''
30 find . -name '*.js' -exec dos2unix {} +
31 ln -snf meshcentral.js bin/meshcentral
32 '';
33
34 preFixup = ''
35 mkdir -p $out/bin
36 chmod a+x $out/libexec/meshcentral/deps/meshcentral/meshcentral.js
37 sed -i '1i#!${nodejs_18}/bin/node' $out/libexec/meshcentral/deps/meshcentral/meshcentral.js
38 ln -s $out/libexec/meshcentral/deps/meshcentral/meshcentral.js $out/bin/meshcentral
39 '';
40
41 publishBinsFor = [ ];
42
43 passthru.updateScript = ./update.sh;
44
45 meta = with lib; {
46 description = "Computer management web app";
47 homepage = "https://meshcentral.com/";
48 maintainers = [ maintainers.lheckemann ];
49 license = licenses.asl20;
50 };
51}