parent
8ecc61c91a
commit
3979015355
@ -0,0 +1,36 @@ |
||||
{ lib, fetchpatch, fetchzip, yarn2nix-moretea, nodejs, jq, dos2unix }: |
||||
yarn2nix-moretea.mkYarnPackage rec { |
||||
version = "0.8.87"; |
||||
|
||||
src = fetchzip { |
||||
url = "https://registry.npmjs.org/meshcentral/-/meshcentral-0.8.87.tgz"; |
||||
sha256 = "1jb65pvbld83mdjdb4f4z2brqsdh3b1mvnjdhbllcsn35m705cp5"; |
||||
}; |
||||
|
||||
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}/bin/node' $out/libexec/meshcentral/deps/meshcentral/meshcentral.js |
||||
ln -s $out/libexec/meshcentral/deps/meshcentral/meshcentral.js $out/bin/meshcentral |
||||
''; |
||||
|
||||
publishBinsFor = [ ]; |
||||
|
||||
meta = with lib; { |
||||
description = "Computer management web app"; |
||||
homepage = "https://meshcentral.com/info/"; |
||||
maintainers = [ maintainers.lheckemann ]; |
||||
license = licenses.asl20; |
||||
}; |
||||
} |
@ -0,0 +1,123 @@ |
||||
{ |
||||
"name": "meshcentral", |
||||
"version": "0.8.87", |
||||
"keywords": [ |
||||
"Remote Device Management", |
||||
"Remote Device Monitoring", |
||||
"Remote Desktop", |
||||
"Remote Terminal", |
||||
"Remote File Access", |
||||
"KVM", |
||||
"2FA", |
||||
"Two-Factor Authentication", |
||||
"Intel Active Management Technology", |
||||
"Intel AMT" |
||||
], |
||||
"homepage": "https://meshcentral.com", |
||||
"description": "Web based remote computer management server", |
||||
"author": "Ylian Saint-Hilaire <ylianst@gmail.com>", |
||||
"main": "meshcentral.js", |
||||
"bin": { |
||||
"meshcentral": "bin/meshcentral" |
||||
}, |
||||
"license": "Apache-2.0", |
||||
"files": [ |
||||
"*.js", |
||||
"amt", |
||||
"bin", |
||||
"views", |
||||
"emails", |
||||
"agents", |
||||
"public", |
||||
"translate", |
||||
"readme.txt", |
||||
"license.txt", |
||||
"sample-config.json", |
||||
"sample-config-advanced.json" |
||||
], |
||||
"dependencies": { |
||||
"body-parser": "^1.19.0", |
||||
"cbor": "~5.2.0", |
||||
"compression": "^1.7.4", |
||||
"cookie-session": "^2.0.0-beta.3", |
||||
"express": "^4.17.0", |
||||
"express-handlebars": "^3.1.0", |
||||
"express-ws": "^4.0.0", |
||||
"ipcheck": "^0.1.0", |
||||
"minimist": "^1.2.0", |
||||
"multiparty": "^4.2.1", |
||||
"nedb": "^1.8.0", |
||||
"node-forge": "^0.10.0", |
||||
"ws": "^5.2.3", |
||||
"xmldom": "^0.5.0", |
||||
"yauzl": "^2.10.0" |
||||
}, |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "https://github.com/Ylianst/MeshCentral.git" |
||||
}, |
||||
"readme": "readme.txt", |
||||
"optionalDependencies": { |
||||
"passport": "*", |
||||
"passport-twitter": "*", |
||||
"passport-google-oauth20": "*", |
||||
"passport-github2": "*", |
||||
"passport-reddit": "*", |
||||
"passport-azure-oauth2": "*", |
||||
"jwt-simple": "*", |
||||
"passport-saml": "*", |
||||
"ws": "5.2.3", |
||||
"cbor": "5.2.0", |
||||
"nedb": "*", |
||||
"https": "*", |
||||
"yauzl": "*", |
||||
"xmldom": "*", |
||||
"ipcheck": "*", |
||||
"express": "*", |
||||
"archiver": "4.0.2", |
||||
"multiparty": "*", |
||||
"node-forge": "*", |
||||
"express-ws": "4.0.0", |
||||
"compression": "*", |
||||
"body-parser": "*", |
||||
"cookie-session": "*", |
||||
"express-handlebars": "*", |
||||
"node-windows": "*", |
||||
"loadavg-windows": "*", |
||||
"node-sspi": "*", |
||||
"ldapauth-fork": "*", |
||||
"node-rdpjs-2": "*", |
||||
"ssh2": "*", |
||||
"image-size": "*", |
||||
"acme-client": "*", |
||||
"aedes": "0.39.0", |
||||
"mysql": "*", |
||||
"@mysql/xdevapi": "*", |
||||
"mongodb": "*", |
||||
"saslprep": "*", |
||||
"mariadb": "*", |
||||
"node-vault": "*", |
||||
"semver": "*", |
||||
"https-proxy-agent": "*", |
||||
"mongojs": "*", |
||||
"nodemailer": "*", |
||||
"@sendgrid/mail": "*", |
||||
"jsdom": "*", |
||||
"esprima": "*", |
||||
"minify-js": "*", |
||||
"html-minifier": "*", |
||||
"archiver-zip-encrypted": "*", |
||||
"googleapis": "*", |
||||
"webdav": "*", |
||||
"wildleek": "2.0.0", |
||||
"yubikeyotp": "*", |
||||
"otplib": "10.2.3", |
||||
"twilio": "*", |
||||
"plivo": "*", |
||||
"web-push": "*", |
||||
"node-xcs": "*", |
||||
"modern-syslog": "*", |
||||
"syslog": "*", |
||||
"heapdump": "*" |
||||
} |
||||
} |
@ -0,0 +1,50 @@ |
||||
#!/usr/bin/env nix-shell |
||||
#! nix-shell -i bash -p nodejs yarn yarn2nix jq rsync common-updater-scripts moreutils |
||||
|
||||
set -exuo pipefail |
||||
|
||||
expr_dir=$(cd "$(dirname "$0")"; pwd) |
||||
tmp=$(mktemp -dt update-meshcentral.XXXXXX) |
||||
|
||||
npm show --json meshcentral > "$tmp/npm.json" |
||||
version=$(<"$tmp/npm.json" jq -r .version) |
||||
tarball=$(<"$tmp/npm.json" jq -r .dist.tarball) |
||||
|
||||
prefetch=$(nix-prefetch-url --unpack --print-path "$tarball" | tr '\n' ' ') |
||||
read -r hash storePath <<<"$prefetch" |
||||
cd "$tmp" |
||||
rsync -r --chmod=u=rwX "$storePath/" package/ |
||||
cd package |
||||
|
||||
# Very crude way of discovering optional dependencies. These are |
||||
# fetched at runtime by stock upstream, but we don't allow that kind |
||||
# of thing in nix :) |
||||
awk <meshcentral.js " |
||||
BEGIN { RS=\"[\n;]\" } |
||||
match(\$0, /(modules|passport) = (\[.*\])$/, a) { print a[2] } |
||||
match(\$0, /(modules|passport).push\(('[^']+')\)/, a) { print a[2] } |
||||
" | |
||||
tr \' \" | |
||||
jq --slurp '[if type == "array" then .[] else . end] | flatten' | |
||||
# And an equally crude way of adding them to package.json. We |
||||
# can't use yarn add here, because that will blow up on |
||||
# dependencies which don't support the current platform. Even with |
||||
# --optional. |
||||
jq --slurpfile package package.json \ |
||||
'(. | map(. | capture("(?<name>@?[^@]+)(@(?<version>.+))?") | { key: .name, value: (.version // "*")}) | from_entries) as $optionalDependencies | $package | .[] | .optionalDependencies |= . + $optionalDependencies' | |
||||
sponge package.json |
||||
|
||||
# Fetch all the optional dependencies, so we have them available in |
||||
# yarn.lock/yarn.nix |
||||
yarn install --ignore-scripts |
||||
|
||||
cp package.json "$expr_dir" |
||||
cp yarn.lock "$expr_dir/yarn.lock" |
||||
yarn2nix > "$expr_dir/yarn.nix" |
||||
|
||||
cd "$expr_dir/../../../.." |
||||
update-source-version meshcentral "$version" "$hash" "$tarball" |
||||
|
||||
# Only clean up if everything worked |
||||
cd / |
||||
rm -rf "$tmp" |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue