node-red: move from nodePackages

This commit is contained in:
Robert Schütz 2024-10-06 21:50:37 -07:00
parent 792b14b9b9
commit b129e21ffd
8 changed files with 11996 additions and 423 deletions

View File

@ -10,7 +10,7 @@ in
options.services.node-red = {
enable = mkEnableOption "the Node-RED service";
package = mkPackageOption pkgs [ "nodePackages" "node-red" ] { };
package = mkPackageOption pkgs [ "node-red" ] { };
openFirewall = mkOption {
type = types.bool;
@ -31,8 +31,8 @@ in
configFile = mkOption {
type = types.path;
default = "${cfg.package}/lib/node_modules/node-red/settings.js";
defaultText = literalExpression ''"''${package}/lib/node_modules/node-red/settings.js"'';
default = "${cfg.package}/lib/node_modules/node-red/packages/node_modules/node-red/settings.js";
defaultText = literalExpression ''"''${package}/lib/node_modules/node-red/packages/node_modules/node-red/settings.js"'';
description = ''
Path to the JavaScript configuration file.
See <https://github.com/node-red/node-red/blob/master/packages/node_modules/node-red/settings.js>

11921
pkgs/by-name/no/node-red/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
{
buildNpmPackage,
fetchFromGitHub,
jq,
lib,
nixosTests,
}:
buildNpmPackage rec {
pname = "node-red";
version = "4.0.3";
src = fetchFromGitHub {
owner = "node-red";
repo = "node-red";
rev = "refs/tags/${version}";
hash = "sha256-AiLGqpEUqvWpI+7cL7ZygT2mSCVt7zCUwEJXvRaiGT8=";
};
npmDepsHash = "sha256-ipUhco5Z+x2FYqLPdgMYJk4eXrIqn1BHidaYXXgujis=";
postPatch =
let
packageDir = "packages/node_modules/node-red";
in
''
ln -s ${./package-lock.json} package-lock.json
${lib.getExe jq} '. += {"bin": {"node-red": "${packageDir}/red.js", "node-red-pi": "${packageDir}/bin/node-red-pi"}}' package.json > package.json.tmp
mv package.json.tmp package.json
'';
makeCacheWritable = true;
passthru = {
tests = {
inherit (nixosTests) node-red;
};
updateScript = ./update.sh;
};
meta = {
changelog = "https://github.com/node-red/node-red/blob/${src.rev}/CHANGELOG.md";
description = "Low-code programming for event-driven applications";
homepage = "https://nodered.org/";
license = lib.licenses.asl20;
mainProgram = "node-red";
maintainers = with lib.maintainers; [ matthewcroughan ];
};
}

View File

@ -0,0 +1,21 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p curl nix-update prefetch-npm-deps nodejs jq gnused
set -eu -o pipefail
pushd "$(dirname "${BASH_SOURCE[0]}")"
tag=$(curl -sfL ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} https://api.github.com/repos/node-red/node-red/releases/latest | jq -r .tag_name)
curl -sfL ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "https://github.com/node-red/node-red/raw/refs/tags/$tag/package.json" > package.json
rm package-lock.json
npm i --package-lock-only
npm_hash=$(prefetch-npm-deps package-lock.json)
sed -i "s|npmDepsHash = \".*\";|npmDepsHash = \"$npm_hash\";|" package.nix
rm package.json
popd
nix-update node-red --version "$tag"

View File

@ -134,6 +134,7 @@ mapAliases {
node-inspector = throw "node-inspector was removed because it was broken"; # added 2023-08-21
inherit (pkgs) node-gyp; # added 2024-08-13
inherit (pkgs) node-pre-gyp; # added 2024-08-05
inherit (pkgs) node-red; # added 2024-10-06
inherit (pkgs) nodemon; # added 2024-06-28
inherit (pkgs) npm-check-updates; # added 2023-08-22
ocaml-language-server = throw "ocaml-language-server was removed because it was abandoned upstream"; # added 2023-09-04

View File

@ -145,7 +145,6 @@
, "neovim"
, "nijs"
, "node-gyp-build"
, "node-red"
, "node2nix"
, "np"
, "npm"

View File

@ -75595,421 +75595,6 @@ in
bypassCache = true;
reconstructLock = true;
};
node-red = nodeEnv.buildNodePackage {
name = "node-red";
packageName = "node-red";
version = "4.0.3";
src = fetchurl {
url = "https://registry.npmjs.org/node-red/-/node-red-4.0.3.tgz";
sha512 = "6ZYh54FKqkEANoFgUBNgHm4LaUg5m3eW/01Dslf3cf3aeaRPa9mpS63sRiFC75JuJCxN29LH1/As91/1lSOxYA==";
};
dependencies = [
sources."@babel/runtime-7.25.6"
sources."@emnapi/core-1.2.0"
sources."@emnapi/runtime-1.2.0"
sources."@emnapi/wasi-threads-1.0.1"
(sources."@isaacs/cliui-8.0.2" // {
dependencies = [
sources."ansi-regex-6.1.0"
sources."strip-ansi-7.1.0"
];
})
sources."@isaacs/fs-minipass-4.0.1"
sources."@napi-rs/wasm-runtime-0.2.4"
(sources."@node-red/editor-api-4.0.3" // {
dependencies = [
sources."mime-3.0.0"
];
})
sources."@node-red/editor-client-4.0.3"
(sources."@node-red/nodes-4.0.3" // {
dependencies = [
sources."iconv-lite-0.6.3"
sources."media-typer-1.1.0"
];
})
sources."@node-red/registry-4.0.3"
sources."@node-red/runtime-4.0.3"
sources."@node-red/util-4.0.3"
sources."@node-rs/bcrypt-1.10.4"
sources."@node-rs/bcrypt-android-arm-eabi-1.10.4"
sources."@node-rs/bcrypt-android-arm64-1.10.4"
sources."@node-rs/bcrypt-darwin-arm64-1.10.4"
sources."@node-rs/bcrypt-darwin-x64-1.10.4"
sources."@node-rs/bcrypt-freebsd-x64-1.10.4"
sources."@node-rs/bcrypt-linux-arm-gnueabihf-1.10.4"
sources."@node-rs/bcrypt-linux-arm64-gnu-1.10.4"
sources."@node-rs/bcrypt-linux-arm64-musl-1.10.4"
sources."@node-rs/bcrypt-linux-x64-gnu-1.10.4"
sources."@node-rs/bcrypt-linux-x64-musl-1.10.4"
sources."@node-rs/bcrypt-wasm32-wasi-1.10.4"
sources."@node-rs/bcrypt-win32-arm64-msvc-1.10.4"
sources."@node-rs/bcrypt-win32-ia32-msvc-1.10.4"
sources."@node-rs/bcrypt-win32-x64-msvc-1.10.4"
sources."@sindresorhus/is-5.6.0"
sources."@szmarczak/http-timer-5.0.1"
sources."@tybys/wasm-util-0.9.0"
sources."@types/http-cache-semantics-4.0.4"
sources."@types/node-22.5.5"
(sources."@types/readable-stream-4.0.15" // {
dependencies = [
sources."safe-buffer-5.1.2"
];
})
sources."@types/ws-8.5.12"
sources."abbrev-1.1.1"
sources."abort-controller-3.0.0"
sources."accepts-1.3.8"
sources."acorn-8.12.1"
sources."acorn-walk-8.3.4"
(sources."agent-base-6.0.2" // {
dependencies = [
sources."debug-4.3.7"
sources."ms-2.1.3"
];
})
sources."ajv-8.17.1"
sources."ansi-colors-4.1.3"
sources."ansi-regex-5.0.1"
sources."ansi-styles-6.2.1"
sources."append-field-1.0.0"
sources."argparse-2.0.1"
sources."array-flatten-1.1.1"
sources."async-mutex-0.5.0"
sources."asynckit-0.4.0"
sources."axios-1.7.7"
sources."balanced-match-1.0.2"
sources."base64-js-1.5.1"
(sources."basic-auth-2.0.1" // {
dependencies = [
sources."safe-buffer-5.1.2"
];
})
sources."bcryptjs-2.4.3"
sources."bl-6.0.15"
sources."body-parser-1.20.3"
sources."boolbase-1.0.0"
sources."brace-expansion-2.0.1"
sources."buffer-6.0.3"
sources."buffer-from-1.1.2"
sources."bufferutil-4.0.8"
sources."busboy-1.6.0"
sources."bytes-3.1.2"
sources."cacheable-lookup-7.0.0"
sources."cacheable-request-10.2.14"
sources."call-bind-1.0.7"
sources."cheerio-1.0.0-rc.10"
sources."cheerio-select-1.6.0"
sources."chownr-3.0.0"
sources."cli-table-0.3.11"
sources."clone-2.1.2"
sources."color-convert-2.0.1"
sources."color-name-1.1.4"
sources."colors-1.0.3"
sources."combined-stream-1.0.8"
sources."commist-3.2.0"
(sources."concat-stream-2.0.0" // {
dependencies = [
sources."readable-stream-3.6.2"
];
})
sources."content-disposition-0.5.4"
sources."content-type-1.0.5"
sources."cookie-0.6.0"
(sources."cookie-parser-1.4.6" // {
dependencies = [
sources."cookie-0.4.1"
];
})
sources."cookie-signature-1.0.6"
sources."core-util-is-1.0.3"
sources."cors-2.8.5"
sources."cronosjs-1.7.1"
sources."cross-spawn-7.0.3"
sources."css-select-4.3.0"
sources."css-what-6.1.0"
sources."debug-2.6.9"
(sources."decompress-response-6.0.0" // {
dependencies = [
sources."mimic-response-3.1.0"
];
})
sources."defer-to-connect-2.0.1"
sources."define-data-property-1.1.4"
sources."delayed-stream-1.0.0"
sources."denque-2.1.0"
sources."depd-2.0.0"
sources."destroy-1.2.0"
sources."dom-serializer-1.4.1"
sources."domelementtype-2.3.0"
sources."domhandler-4.3.1"
sources."domutils-2.8.0"
sources."eastasianwidth-0.2.0"
sources."ee-first-1.1.1"
sources."emoji-regex-9.2.2"
sources."encodeurl-2.0.0"
sources."enquirer-2.4.1"
sources."entities-2.2.0"
sources."es-define-property-1.0.0"
sources."es-errors-1.3.0"
sources."escape-html-1.0.3"
sources."etag-1.8.1"
sources."event-target-shim-5.0.1"
sources."events-3.3.0"
sources."express-4.21.0"
(sources."express-session-1.18.0" // {
dependencies = [
sources."cookie-signature-1.0.7"
];
})
sources."fast-deep-equal-3.1.3"
sources."fast-unique-numbers-8.0.13"
sources."fast-uri-3.0.1"
sources."finalhandler-1.3.1"
sources."follow-redirects-1.15.9"
sources."foreground-child-3.3.0"
sources."form-data-4.0.0"
sources."form-data-encoder-2.1.4"
sources."forwarded-0.2.0"
sources."fresh-0.5.2"
sources."fs-extra-11.2.0"
sources."function-bind-1.1.2"
sources."get-intrinsic-1.2.4"
sources."get-stream-6.0.1"
sources."glob-10.4.5"
sources."gopd-1.0.1"
sources."got-12.6.0"
sources."graceful-fs-4.2.11"
sources."has-property-descriptors-1.0.2"
sources."has-proto-1.0.3"
sources."has-symbols-1.0.3"
sources."hash-sum-2.0.0"
sources."hasown-2.0.2"
sources."help-me-5.0.0"
sources."hpagent-1.2.0"
sources."htmlparser2-6.1.0"
sources."http-cache-semantics-4.1.1"
sources."http-errors-2.0.0"
sources."http2-wrapper-2.2.1"
(sources."https-proxy-agent-5.0.1" // {
dependencies = [
sources."debug-4.3.7"
sources."ms-2.1.3"
];
})
sources."i18next-21.10.0"
sources."iconv-lite-0.4.24"
sources."ieee754-1.2.1"
sources."inherits-2.0.4"
sources."ipaddr.js-1.9.1"
sources."is-fullwidth-code-point-3.0.0"
sources."is-utf8-0.2.1"
sources."isarray-1.0.0"
sources."isexe-2.0.0"
sources."jackspeak-3.4.3"
sources."js-sdsl-4.3.0"
sources."js-yaml-4.1.0"
sources."json-buffer-3.0.1"
sources."json-schema-traverse-1.0.0"
sources."json-stringify-safe-5.0.1"
sources."jsonata-2.0.5"
sources."jsonfile-6.1.0"
sources."keyv-4.5.4"
sources."lodash.clonedeep-4.5.0"
sources."lowercase-keys-3.0.0"
sources."lru-cache-6.0.0"
sources."media-typer-0.3.0"
(sources."memorystore-1.6.7" // {
dependencies = [
sources."debug-4.3.7"
sources."lru-cache-4.1.5"
sources."ms-2.1.3"
sources."yallist-2.1.2"
];
})
sources."merge-descriptors-1.0.3"
sources."methods-1.1.2"
sources."mime-1.6.0"
sources."mime-db-1.52.0"
sources."mime-types-2.1.35"
sources."mimic-response-4.0.0"
sources."minimatch-9.0.5"
sources."minimist-1.2.8"
sources."minipass-7.1.2"
sources."minizlib-3.0.1"
sources."mkdirp-0.5.6"
sources."moment-2.30.1"
sources."moment-timezone-0.5.45"
(sources."mqtt-5.7.0" // {
dependencies = [
sources."debug-4.3.7"
sources."lru-cache-10.4.3"
sources."ms-2.1.3"
sources."ws-8.18.0"
];
})
(sources."mqtt-packet-9.0.0" // {
dependencies = [
sources."debug-4.3.7"
sources."ms-2.1.3"
];
})
sources."ms-2.0.0"
(sources."multer-1.4.5-lts.1" // {
dependencies = [
sources."concat-stream-1.6.2"
sources."readable-stream-2.3.8"
sources."safe-buffer-5.1.2"
sources."string_decoder-1.1.1"
];
})
sources."mustache-4.2.0"
sources."mute-stream-1.0.0"
sources."negotiator-0.6.3"
sources."node-gyp-build-4.8.2"
sources."node-red-admin-4.0.1"
sources."node-watch-0.7.4"
sources."nopt-5.0.0"
sources."normalize-url-8.0.1"
sources."nth-check-2.1.1"
(sources."number-allocator-1.0.14" // {
dependencies = [
sources."debug-4.3.7"
sources."ms-2.1.3"
];
})
sources."oauth2orize-1.12.0"
sources."object-assign-4.1.1"
sources."object-inspect-1.13.2"
sources."on-finished-2.4.1"
sources."on-headers-1.0.2"
sources."p-cancelable-3.0.0"
sources."package-json-from-dist-1.0.0"
sources."parse5-6.0.1"
sources."parse5-htmlparser2-tree-adapter-6.0.1"
sources."parseurl-1.3.3"
sources."passport-0.7.0"
sources."passport-http-bearer-1.0.1"
sources."passport-oauth2-client-password-0.1.2"
sources."passport-strategy-1.0.0"
sources."path-key-3.1.1"
(sources."path-scurry-1.11.1" // {
dependencies = [
sources."lru-cache-10.4.3"
];
})
sources."path-to-regexp-0.1.10"
sources."pause-0.0.1"
sources."process-0.11.10"
sources."process-nextick-args-2.0.1"
sources."proxy-addr-2.0.7"
sources."proxy-from-env-1.1.0"
sources."pseudomap-1.0.2"
sources."qs-6.13.0"
sources."quick-lru-5.1.1"
sources."random-bytes-1.0.0"
sources."range-parser-1.2.1"
sources."raw-body-2.5.2"
sources."read-3.0.1"
sources."readable-stream-4.5.2"
sources."regenerator-runtime-0.14.1"
sources."reinterval-1.1.0"
sources."require-from-string-2.0.2"
sources."resolve-alpn-1.2.1"
sources."responselike-3.0.0"
sources."rfdc-1.4.1"
sources."rimraf-5.0.10"
sources."safe-buffer-5.2.1"
sources."safer-buffer-2.1.2"
sources."sax-1.4.1"
sources."semver-7.5.4"
(sources."send-0.19.0" // {
dependencies = [
sources."encodeurl-1.0.2"
sources."ms-2.1.3"
];
})
sources."serve-static-1.16.2"
sources."set-function-length-1.2.2"
sources."setprototypeof-1.2.0"
sources."shebang-command-2.0.0"
sources."shebang-regex-3.0.0"
sources."side-channel-1.0.6"
sources."signal-exit-4.1.0"
sources."split2-4.2.0"
sources."statuses-2.0.1"
sources."streamsearch-1.1.0"
(sources."string-width-5.1.2" // {
dependencies = [
sources."ansi-regex-6.1.0"
sources."strip-ansi-7.1.0"
];
})
(sources."string-width-cjs-4.2.3" // {
dependencies = [
sources."emoji-regex-8.0.0"
];
})
sources."string_decoder-1.3.0"
sources."strip-ansi-6.0.1"
sources."strip-ansi-cjs-6.0.1"
(sources."tar-7.2.0" // {
dependencies = [
sources."mkdirp-3.0.1"
sources."yallist-5.0.0"
];
})
sources."tldts-6.1.47"
sources."tldts-core-6.1.47"
sources."toidentifier-1.0.1"
sources."tough-cookie-5.0.0"
sources."tslib-2.7.0"
sources."type-is-1.6.18"
sources."typedarray-0.0.6"
sources."uglify-js-3.17.4"
sources."uid-safe-2.1.5"
sources."uid2-0.0.4"
sources."undici-types-6.19.8"
sources."universalify-2.0.1"
sources."unpipe-1.0.0"
sources."utf-8-validate-5.0.10"
sources."util-deprecate-1.0.2"
sources."utils-merge-1.0.1"
sources."uuid-9.0.1"
sources."vary-1.1.2"
sources."which-2.0.2"
sources."worker-timers-7.1.8"
sources."worker-timers-broker-6.1.8"
sources."worker-timers-worker-7.0.71"
(sources."wrap-ansi-8.1.0" // {
dependencies = [
sources."ansi-regex-6.1.0"
sources."strip-ansi-7.1.0"
];
})
(sources."wrap-ansi-cjs-7.0.0" // {
dependencies = [
sources."ansi-styles-4.3.0"
sources."emoji-regex-8.0.0"
sources."string-width-4.2.3"
];
})
sources."ws-7.5.10"
sources."xml2js-0.6.2"
sources."xmlbuilder-11.0.1"
sources."xtend-4.0.2"
sources."yallist-4.0.0"
];
buildInputs = globalBuildInputs;
meta = {
description = "Low-code programming for event-driven applications";
homepage = "https://nodered.org";
license = "Apache-2.0";
};
production = true;
bypassCache = true;
reconstructLock = true;
};
node2nix = nodeEnv.buildNodePackage {
name = "node2nix";
packageName = "node2nix";

View File

@ -155,10 +155,6 @@ final: prev: {
'';
};
node-red = prev.node-red.override {
buildInputs = [ pkgs.node-pre-gyp ];
};
node2nix = prev.node2nix.override {
# Get latest commit for misc fixes
src = fetchFromGitHub {