nixpkgs/pkgs/tools/admin/meshcentral/default.nix
Maximilian Bosch d9f9708a99
meshcentral: nodejs_16 -> nodejs_18
Part of #229910.

Upstream uses `node:current-alpine` to build their images[1], so newer
nodejs versions shouldn't be a problem.

[1] https://github.com/Ylianst/MeshCentral/blob/1.1.5/docker/Dockerfile
2023-05-14 14:56:05 +02:00

42 lines
1.2 KiB
Nix

{ lib, fetchpatch, fetchzip, yarn2nix-moretea, nodejs_18, jq, dos2unix }:
yarn2nix-moretea.mkYarnPackage {
version = "1.1.5";
src = fetchzip {
url = "https://registry.npmjs.org/meshcentral/-/meshcentral-1.1.5.tgz";
sha256 = "1djdqfcmfk35q7hfbdn4rnh4di2lk1gk7icfasjmihrgpnsxrrir";
};
patches = [ ./fix-js-include-paths.patch ];
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
yarnNix = ./yarn.nix;
# Tarball has CRLF line endings. This makes patching difficult, so let's convert them.
nativeBuildInputs = [ dos2unix ];
prePatch = ''
find . -name '*.js' -exec dos2unix {} +
ln -snf meshcentral.js bin/meshcentral
'';
preFixup = ''
mkdir -p $out/bin
chmod a+x $out/libexec/meshcentral/deps/meshcentral/meshcentral.js
sed -i '1i#!${nodejs_18}/bin/node' $out/libexec/meshcentral/deps/meshcentral/meshcentral.js
ln -s $out/libexec/meshcentral/deps/meshcentral/meshcentral.js $out/bin/meshcentral
'';
publishBinsFor = [ ];
passthru.updateScript = ./update.sh;
meta = with lib; {
description = "Computer management web app";
homepage = "https://meshcentral.com/info/";
maintainers = [ maintainers.lheckemann ];
license = licenses.asl20;
};
}