From 7728271b31b5b4d05ccbea1f4599b5ecb7e8958f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sat, 9 Sep 2023 17:46:09 -0700 Subject: [PATCH] near-cli: use mkYarnPackage --- pkgs/development/node-packages/aliases.nix | 1 + .../node-packages/main-programs.nix | 1 - .../node-packages/node-packages.json | 1 - .../node-packages/node-packages.nix | 368 ------------------ pkgs/development/node-packages/overrides.nix | 8 - pkgs/tools/misc/near-cli/default.nix | 49 +++ pkgs/tools/misc/near-cli/package.json | 83 ++++ pkgs/top-level/all-packages.nix | 2 + 8 files changed, 135 insertions(+), 378 deletions(-) create mode 100644 pkgs/tools/misc/near-cli/default.nix create mode 100644 pkgs/tools/misc/near-cli/package.json diff --git a/pkgs/development/node-packages/aliases.nix b/pkgs/development/node-packages/aliases.nix index dad33e39b553..1c3c44779059 100644 --- a/pkgs/development/node-packages/aliases.nix +++ b/pkgs/development/node-packages/aliases.nix @@ -93,6 +93,7 @@ mapAliases { inherit (pkgs) markdownlint-cli2; # added 2023-08-22 mdctl-cli = self."@medable/mdctl-cli"; # added 2023-08-21 musescore-downloader = pkgs.dl-librescore; # added 2023-08-19 + inherit (pkgs) near-cli; # added 2023-09-09 node-inspector = throw "node-inspector was removed because it was broken"; # added 2023-08-21 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 diff --git a/pkgs/development/node-packages/main-programs.nix b/pkgs/development/node-packages/main-programs.nix index 66aff39ea45b..5ee9f70d8e33 100644 --- a/pkgs/development/node-packages/main-programs.nix +++ b/pkgs/development/node-packages/main-programs.nix @@ -46,7 +46,6 @@ less = "lessc"; localtunnel = "lt"; lua-fmt = "luafmt"; - near-cli = "near"; neovim = "neovim-node-host"; parsoid = "parse.js"; poor-mans-t-sql-formatter-cli = "sqlformat"; diff --git a/pkgs/development/node-packages/node-packages.json b/pkgs/development/node-packages/node-packages.json index b6c111bdccd4..62a52c53268a 100644 --- a/pkgs/development/node-packages/node-packages.json +++ b/pkgs/development/node-packages/node-packages.json @@ -178,7 +178,6 @@ , "meat" , "mocha" , "multi-file-swagger" -, "near-cli" , "neovim" , "nijs" , "node-gyp" diff --git a/pkgs/development/node-packages/node-packages.nix b/pkgs/development/node-packages/node-packages.nix index 724549d61fbc..4f01a80f0539 100644 --- a/pkgs/development/node-packages/node-packages.nix +++ b/pkgs/development/node-packages/node-packages.nix @@ -98426,374 +98426,6 @@ in bypassCache = true; reconstructLock = true; }; - near-cli = nodeEnv.buildNodePackage { - name = "near-cli"; - packageName = "near-cli"; - version = "3.4.2"; - src = fetchurl { - url = "https://registry.npmjs.org/near-cli/-/near-cli-3.4.2.tgz"; - sha512 = "0EaNAw5SKSIIJrJajG32CNMGfBtZTgIrOVKSXBTWpvo+F0OozsbvuO4UG3ZSRNThXHijxybp58SqPiU3JuzXGA=="; - }; - dependencies = [ - (sources."@babel/code-frame-7.22.10" // { - dependencies = [ - sources."ansi-styles-3.2.1" - sources."chalk-2.4.2" - sources."color-convert-1.9.3" - sources."color-name-1.1.3" - sources."has-flag-3.0.0" - sources."supports-color-5.5.0" - ]; - }) - sources."@babel/helper-validator-identifier-7.22.5" - (sources."@babel/highlight-7.22.10" // { - dependencies = [ - sources."ansi-styles-3.2.1" - sources."chalk-2.4.2" - sources."color-convert-1.9.3" - sources."color-name-1.1.3" - sources."has-flag-3.0.0" - sources."supports-color-5.5.0" - ]; - }) - sources."@jest/environment-27.5.1" - sources."@jest/fake-timers-27.5.1" - sources."@jest/types-27.5.1" - sources."@ledgerhq/devices-8.0.7" - sources."@ledgerhq/errors-6.14.0" - sources."@ledgerhq/hw-transport-6.28.8" - sources."@ledgerhq/hw-transport-node-hid-6.27.21" - sources."@ledgerhq/hw-transport-node-hid-noevents-6.27.19" - (sources."@ledgerhq/hw-transport-u2f-5.36.0-deprecated" // { - dependencies = [ - sources."@ledgerhq/devices-5.51.1" - sources."@ledgerhq/errors-5.50.0" - sources."@ledgerhq/hw-transport-5.51.1" - sources."@ledgerhq/logs-5.50.0" - ]; - }) - (sources."@ledgerhq/hw-transport-webhid-5.51.1" // { - dependencies = [ - sources."@ledgerhq/devices-5.51.1" - sources."@ledgerhq/errors-5.50.0" - sources."@ledgerhq/hw-transport-5.51.1" - sources."@ledgerhq/logs-5.50.0" - ]; - }) - (sources."@ledgerhq/hw-transport-webusb-5.53.1" // { - dependencies = [ - sources."@ledgerhq/devices-5.51.1" - sources."@ledgerhq/errors-5.50.0" - sources."@ledgerhq/hw-transport-5.51.1" - sources."@ledgerhq/logs-5.50.0" - ]; - }) - sources."@ledgerhq/logs-6.10.1" - sources."@segment/loosely-validate-event-2.0.0" - sources."@sindresorhus/is-0.14.0" - sources."@sinonjs/commons-1.8.6" - sources."@sinonjs/fake-timers-8.1.0" - sources."@szmarczak/http-timer-1.1.2" - sources."@types/istanbul-lib-coverage-2.0.4" - sources."@types/istanbul-lib-report-3.0.0" - sources."@types/istanbul-reports-3.0.1" - sources."@types/node-20.5.3" - sources."@types/stack-utils-2.0.1" - sources."@types/w3c-web-usb-1.0.6" - sources."@types/yargs-16.0.5" - sources."@types/yargs-parser-21.0.0" - sources."analytics-node-6.2.0" - sources."ansi-align-3.0.1" - sources."ansi-regex-5.0.1" - sources."ansi-styles-4.3.0" - sources."ascii-table-0.0.9" - sources."asynckit-0.4.0" - sources."axios-0.27.2" - sources."axios-retry-3.2.0" - sources."balanced-match-1.0.2" - sources."base-x-3.0.9" - sources."base64-js-1.5.1" - sources."bindings-1.5.0" - (sources."bip39-3.0.2" // { - dependencies = [ - sources."@types/node-11.11.6" - ]; - }) - sources."bip39-light-1.0.7" - sources."bl-4.1.0" - sources."bn.js-5.2.1" - sources."borsh-0.6.0" - sources."boxen-5.1.2" - sources."brace-expansion-1.1.11" - sources."braces-3.0.2" - sources."bs58-4.0.1" - sources."buffer-5.7.1" - (sources."cacheable-request-6.1.0" // { - dependencies = [ - sources."get-stream-5.2.0" - sources."lowercase-keys-2.0.0" - ]; - }) - sources."camelcase-6.3.0" - sources."capability-0.2.5" - sources."chalk-4.1.2" - sources."charenc-0.0.2" - sources."chownr-1.1.4" - sources."ci-info-2.0.0" - sources."cipher-base-1.0.4" - sources."cli-boxes-2.2.1" - sources."cliui-7.0.4" - sources."clone-response-1.0.3" - sources."color-convert-2.0.1" - sources."color-name-1.1.4" - sources."combined-stream-1.0.8" - sources."component-type-1.2.1" - sources."concat-map-0.0.1" - sources."configstore-5.0.1" - sources."create-hash-1.2.0" - sources."create-hmac-1.1.7" - sources."crypt-0.0.2" - sources."crypto-random-string-2.0.0" - (sources."debug-4.3.1" // { - dependencies = [ - sources."ms-2.1.2" - ]; - }) - sources."decompress-response-3.3.0" - sources."deep-extend-0.6.0" - sources."deep-is-0.1.4" - sources."defer-to-connect-1.1.3" - sources."define-lazy-prop-2.0.0" - sources."delayed-stream-1.0.0" - sources."depd-2.0.0" - sources."detect-libc-2.0.2" - sources."dot-prop-5.3.0" - sources."duplexer3-0.1.5" - sources."emoji-regex-8.0.0" - sources."encoding-0.1.13" - sources."end-of-stream-1.4.4" - sources."error-polyfill-0.1.3" - sources."escalade-3.1.1" - sources."escape-goat-2.1.1" - sources."escape-string-regexp-1.0.5" - sources."events-3.3.0" - sources."expand-template-2.0.3" - sources."file-uri-to-path-1.0.0" - sources."fill-range-7.0.1" - sources."flagged-respawn-1.0.1" - sources."follow-redirects-1.15.2" - sources."form-data-4.0.0" - sources."fs-constants-1.0.0" - sources."fs.realpath-1.0.0" - sources."get-caller-file-2.0.5" - sources."get-stream-4.1.0" - sources."github-from-package-0.0.0" - sources."glob-7.2.3" - sources."global-dirs-3.0.1" - sources."got-9.6.0" - sources."graceful-fs-4.2.11" - sources."has-flag-4.0.0" - sources."has-yarn-2.1.0" - sources."hash-base-3.1.0" - sources."homedir-polyfill-1.0.3" - sources."http-cache-semantics-4.1.1" - (sources."http-errors-1.8.1" // { - dependencies = [ - sources."depd-1.1.2" - ]; - }) - sources."iconv-lite-0.6.3" - sources."ieee754-1.2.1" - sources."import-lazy-2.1.0" - sources."imurmurhash-0.1.4" - sources."inflight-1.0.6" - sources."inherits-2.0.4" - sources."ini-2.0.0" - sources."ip-regex-4.3.0" - sources."is-buffer-1.1.6" - sources."is-ci-2.0.0" - sources."is-docker-2.2.1" - sources."is-fullwidth-code-point-3.0.0" - sources."is-installed-globally-0.4.0" - sources."is-npm-5.0.0" - sources."is-number-7.0.0" - sources."is-obj-2.0.0" - sources."is-path-inside-3.0.3" - sources."is-retry-allowed-1.2.0" - sources."is-typedarray-1.0.0" - sources."is-url-1.2.4" - sources."is-wsl-2.2.0" - sources."is-yarn-global-0.3.0" - sources."is2-2.0.9" - sources."jest-environment-node-27.5.1" - sources."jest-message-util-27.5.1" - sources."jest-mock-27.5.1" - (sources."jest-util-27.5.1" // { - dependencies = [ - sources."ci-info-3.8.0" - ]; - }) - sources."join-component-1.1.0" - sources."js-sha256-0.9.0" - sources."js-tokens-4.0.0" - sources."json-buffer-3.0.0" - sources."keyv-3.1.0" - sources."latest-version-5.1.0" - sources."lodash-4.17.21" - sources."lodash.isstring-4.0.1" - sources."lowercase-keys-1.0.1" - sources."lru-cache-6.0.0" - (sources."make-dir-3.1.0" // { - dependencies = [ - sources."semver-6.3.1" - ]; - }) - sources."md5-2.3.0" - sources."md5.js-1.3.5" - sources."micromatch-4.0.5" - sources."mime-db-1.52.0" - sources."mime-types-2.1.35" - sources."mimic-response-1.0.1" - sources."minimatch-3.1.2" - sources."minimist-1.2.8" - sources."mkdirp-classic-0.5.3" - sources."ms-2.1.3" - sources."mustache-4.2.0" - sources."napi-build-utils-1.0.2" - sources."ncp-2.0.0" - (sources."near-api-js-0.44.2" // { - dependencies = [ - sources."bn.js-5.2.0" - ]; - }) - sources."near-hd-key-1.2.1" - sources."near-ledger-js-0.2.1" - sources."near-seed-phrase-0.2.0" - sources."node-abi-3.47.0" - sources."node-addon-api-3.2.1" - sources."node-fetch-2.6.13" - sources."node-gyp-build-4.6.0" - sources."node-hid-2.1.2" - sources."normalize-url-4.5.1" - sources."o3-1.0.3" - sources."once-1.4.0" - sources."open-8.4.2" - sources."p-cancelable-1.1.0" - (sources."package-json-6.5.0" // { - dependencies = [ - sources."semver-6.3.1" - ]; - }) - sources."parse-passwd-1.0.0" - sources."path-is-absolute-1.0.1" - sources."pbkdf2-3.1.2" - sources."picomatch-2.3.1" - sources."platform-1.3.6" - sources."prebuild-install-7.1.1" - sources."prepend-http-2.0.0" - (sources."pretty-format-27.5.1" // { - dependencies = [ - sources."ansi-styles-5.2.0" - ]; - }) - sources."pump-3.0.0" - sources."pupa-2.1.1" - sources."randombytes-2.1.0" - (sources."rc-1.2.8" // { - dependencies = [ - sources."ini-1.3.8" - ]; - }) - sources."react-is-17.0.2" - sources."readable-stream-3.6.2" - sources."registry-auth-token-4.2.2" - sources."registry-url-5.1.0" - sources."remove-trailing-slash-0.1.1" - sources."require-directory-2.1.1" - sources."responselike-1.0.2" - sources."rimraf-3.0.2" - sources."ripemd160-2.0.2" - sources."rxjs-6.6.7" - sources."safe-buffer-5.2.1" - sources."safer-buffer-2.1.2" - sources."semver-7.5.4" - (sources."semver-diff-3.1.1" // { - dependencies = [ - sources."semver-6.3.1" - ]; - }) - sources."setprototypeof-1.2.0" - sources."sha.js-2.4.11" - sources."signal-exit-3.0.7" - sources."simple-concat-1.0.1" - (sources."simple-get-4.0.1" // { - dependencies = [ - sources."decompress-response-6.0.0" - sources."mimic-response-3.1.0" - ]; - }) - sources."slash-3.0.0" - (sources."stack-utils-2.0.6" // { - dependencies = [ - sources."escape-string-regexp-2.0.0" - ]; - }) - sources."statuses-1.5.0" - sources."stoppable-1.1.0" - sources."string-width-4.2.3" - sources."string_decoder-1.3.0" - sources."strip-ansi-6.0.1" - sources."strip-json-comments-2.0.1" - sources."supports-color-7.2.0" - sources."tar-fs-2.1.1" - sources."tar-stream-2.2.0" - sources."tcp-port-used-1.0.2" - sources."text-encoding-utf-8-1.0.2" - sources."to-readable-stream-1.0.0" - sources."to-regex-range-5.0.1" - sources."toidentifier-1.0.1" - sources."tr46-0.0.3" - sources."tslib-1.14.1" - sources."tunnel-agent-0.6.0" - sources."tweetnacl-1.0.3" - sources."type-detect-4.0.8" - sources."type-fest-0.20.2" - sources."typedarray-to-buffer-3.1.5" - sources."u2f-api-0.2.7" - sources."u3-0.1.1" - sources."unique-string-2.0.0" - sources."update-notifier-5.1.0" - sources."url-parse-lax-3.0.0" - (sources."usb-2.9.0" // { - dependencies = [ - sources."node-addon-api-6.1.0" - ]; - }) - sources."util-deprecate-1.0.2" - sources."uuid-8.3.2" - sources."v8flags-3.2.0" - sources."webidl-conversions-3.0.1" - sources."whatwg-url-5.0.0" - sources."widest-line-3.1.0" - sources."wrap-ansi-7.0.0" - sources."wrappy-1.0.2" - sources."write-file-atomic-3.0.3" - sources."xdg-basedir-4.0.0" - sources."y18n-5.0.8" - sources."yallist-4.0.0" - sources."yargs-16.2.0" - sources."yargs-parser-20.2.9" - ]; - buildInputs = globalBuildInputs; - meta = { - description = "General purpose command line tools for interacting with NEAR Protocol"; - homepage = "https://github.com/near/near-cli#readme"; - license = "(MIT AND Apache-2.0)"; - }; - production = true; - bypassCache = true; - reconstructLock = true; - }; neovim = nodeEnv.buildNodePackage { name = "neovim"; packageName = "neovim"; diff --git a/pkgs/development/node-packages/overrides.nix b/pkgs/development/node-packages/overrides.nix index c58c474e5a2d..036b73c3e8b3 100644 --- a/pkgs/development/node-packages/overrides.nix +++ b/pkgs/development/node-packages/overrides.nix @@ -204,14 +204,6 @@ final: prev: { ''; }); - near-cli = prev.near-cli.override { - nativeBuildInputs = with pkgs; [ - libusb1 - final.prebuild-install - final.node-gyp-build - pkg-config - ]; - }; node-gyp = prev.node-gyp.override { nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ]; diff --git a/pkgs/tools/misc/near-cli/default.nix b/pkgs/tools/misc/near-cli/default.nix new file mode 100644 index 000000000000..8741f694782c --- /dev/null +++ b/pkgs/tools/misc/near-cli/default.nix @@ -0,0 +1,49 @@ +{ lib +, mkYarnPackage +, fetchFromGitHub +, fetchYarnDeps +}: + +mkYarnPackage rec { + pname = "near-cli"; + version = "3.4.2"; + + src = fetchFromGitHub { + owner = "near"; + repo = "near-cli"; + rev = "v${version}"; + hash = "sha256-C+viNYk+6BA11cdi5GqARU3QTTONTR2B2VEZf/SeeSQ="; + }; + + packageJSON = ./package.json; + + offlineCache = fetchYarnDeps { + yarnLock = "${src}/yarn.lock"; + hash = "sha256-G/Y8xGGOlXH37Bup7mKhEaNh05GTP5CC9e/Xw4TBNMU="; + }; + + doDist = false; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/lib/node_modules" + mv deps/near-cli "$out/lib/node_modules" + rm "$out/lib/node_modules/near-cli/node_modules" + mv node_modules "$out/lib/node_modules/near-cli" + + mkdir -p "$out/bin" + ln -s "$out/lib/node_modules/near-cli/bin/near" "$out/bin" + + runHook postInstall + ''; + + meta = { + changelog = "https://github.com/near/near-cli/blob/${src.rev}/CHANGELOG.md"; + description = "General purpose command line tools for interacting with NEAR Protocol"; + homepage = "https://github.com/near/near-cli"; + license = with lib.licenses; [ asl20 mit ]; + mainProgram = "near"; + maintainers = with lib.maintainers; [ ekleog ]; + }; +} diff --git a/pkgs/tools/misc/near-cli/package.json b/pkgs/tools/misc/near-cli/package.json new file mode 100644 index 000000000000..a6b794a99115 --- /dev/null +++ b/pkgs/tools/misc/near-cli/package.json @@ -0,0 +1,83 @@ +{ + "name": "near-cli", + "version": "3.4.2", + "description": "General purpose command line tools for interacting with NEAR Protocol", + "engines": { + "node": ">= 12" + }, + "main": "index.js", + "scripts": { + "pretest": "rm -rf tmp-project", + "test": "npm run test:unit && npm run test:integration", + "test:unit": "jest", + "test:integration": "bash ./test/index.sh", + "lint": "eslint .", + "fix": "eslint . --fix" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/near/near-cli.git" + }, + "author": "Jane Degtiareva", + "license": "(MIT AND Apache-2.0)", + "bugs": { + "url": "https://github.com/near/near-cli/issues" + }, + "homepage": "https://github.com/near/near-cli#readme", + "bin": { + "near": "bin/near" + }, + "devDependencies": { + "danger": "^10.6.6", + "lodash": "^4.17.21", + "eslint": "^7.0.0", + "jest": "^26.1.0", + "strip-ansi": "^7.0.0", + "strip-ansi-cli": "^3.0.0", + "ts-node": "^10.4.0", + "typescript": "^4.5.4" + }, + "dependencies": { + "analytics-node": "^6.1.0", + "ascii-table": "0.0.9", + "bn.js": "^5.1.1", + "bs58": "^4.0.1", + "chalk": "^4.0.0", + "flagged-respawn": "^1.0.1", + "is-ci": "^2.0.0", + "jest-environment-node": "^27.0.6", + "ncp": "^2.0.0", + "near-api-js": "^0.44.2", + "near-seed-phrase": "^0.2.0", + "open": "^8.0.7", + "rimraf": "^3.0.0", + "stoppable": "^1.1.0", + "tcp-port-used": "^1.0.1", + "update-notifier": "^5.0.0", + "uuid": "^8.0.0", + "v8flags": "^3.1.3", + "yargs": "^16.0.3" + }, + "optionalDependencies": { + "@ledgerhq/hw-transport-node-hid": "^6.1.0", + "near-ledger-js": "^0.2.0" + }, + "keywords": [ + "blockchain", + "crypto", + "dapps", + "distributed", + "applications", + "distributed applications" + ], + "files": [ + "bin", + "commands", + "middleware", + "utils", + "config.js", + "get-config.js", + "test_environment.js", + "context" + ] +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 57e8701d4265..2ca3642a7da9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1917,6 +1917,8 @@ with pkgs; mymcplus = python3Packages.callPackage ../tools/games/mymcplus { }; + near-cli = callPackage ../tools/misc/near-cli { }; + networkd-notify = python3Packages.callPackage ../tools/networking/networkd-notify { systemd = pkgs.systemd; };