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