From d6d4aaf7da9fac5aae094239afdc07987d5ced88 Mon Sep 17 00:00:00 2001 From: James Brock Date: Fri, 2 Jun 2023 20:02:44 +0900 Subject: [PATCH] Add deluxe nix develop shell to flake.nix. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update inputs, including Node.js 14_x → 18_x and Nixpkgs 23.05. New method for generating `node2nix`, based on Justin’s `composition.nix` method. Code reorganization. --- README.md | 60 + default.nix | 13 +- flake.lock | 34 +- flake.nix | 45 +- pinned.nix | 4 +- {pulp/latest => psa}/composition.nix | 2 +- psa/default.nix | 25 +- psa/node-env.nix | 226 +- psa/node-packages.nix | 349 ++- pscid/composition.nix | 17 + pscid/default.nix | 25 +- pscid/node-env.nix | 226 +- pscid/node-packages.nix | 439 +++- pulp/15.0.0/default.nix | 25 - pulp/15.0.0/node-env.nix | 567 ----- pulp/15.0.0/node-packages.nix | 1844 ---------------- pulp/16.0.0-0/default.nix | 25 - pulp/16.0.0-0/node-packages.nix | 1867 ---------------- pulp/16.0.0-0/package.json | 7 - pulp/16.0.2/default.nix | 26 - pulp/16.0.2/node-env.nix | 588 ------ pulp/16.0.2/node-packages.nix | 1880 ----------------- pulp/16.0.2/package.json | 7 - pulp/README.md | 9 - pulp/composition.nix | 17 + pulp/default.nix | 8 + pulp/latest/default.nix | 3 - pulp/latest/generate.bash | 4 - pulp/latest/node-packages.json | 1 - pulp/{latest => }/node-env.nix | 113 +- pulp/{latest => }/node-packages.nix | 116 +- purescript-language-server/composition.nix | 17 + purescript-language-server/default.nix | 27 +- purescript-language-server/node-env.nix | 226 +- purescript-language-server/node-packages.nix | 107 +- purs-backend-es/1.1.0/default.nix | 26 - purs-backend-es/1.1.0/node-env.nix | 588 ------ purs-backend-es/1.1.0/node-packages.nix | 51 - purs-backend-es/1.1.0/package.json | 7 - purs-backend-es/composition.nix | 17 + purs-backend-es/default.nix | 8 + .../16.0.0-0 => purs-backend-es}/node-env.nix | 141 +- purs-backend-es/node-packages.nix | 27 + purs-tidy/composition.nix | 17 + purs-tidy/default.nix | 27 +- purs-tidy/node-env.nix | 226 +- purs-tidy/node-packages.nix | 50 +- spago2nix.nix | 6 +- 48 files changed, 2027 insertions(+), 8113 deletions(-) rename {pulp/latest => psa}/composition.nix (86%) create mode 100644 pscid/composition.nix delete mode 100644 pulp/15.0.0/default.nix delete mode 100644 pulp/15.0.0/node-env.nix delete mode 100644 pulp/15.0.0/node-packages.nix delete mode 100644 pulp/16.0.0-0/default.nix delete mode 100644 pulp/16.0.0-0/node-packages.nix delete mode 100644 pulp/16.0.0-0/package.json delete mode 100644 pulp/16.0.2/default.nix delete mode 100644 pulp/16.0.2/node-env.nix delete mode 100644 pulp/16.0.2/node-packages.nix delete mode 100644 pulp/16.0.2/package.json delete mode 100644 pulp/README.md create mode 100644 pulp/composition.nix create mode 100644 pulp/default.nix delete mode 100644 pulp/latest/default.nix delete mode 100755 pulp/latest/generate.bash delete mode 100644 pulp/latest/node-packages.json rename pulp/{latest => }/node-env.nix (83%) rename pulp/{latest => }/node-packages.nix (96%) create mode 100644 purescript-language-server/composition.nix delete mode 100644 purs-backend-es/1.1.0/default.nix delete mode 100644 purs-backend-es/1.1.0/node-env.nix delete mode 100644 purs-backend-es/1.1.0/node-packages.nix delete mode 100644 purs-backend-es/1.1.0/package.json create mode 100644 purs-backend-es/composition.nix create mode 100644 purs-backend-es/default.nix rename {pulp/16.0.0-0 => purs-backend-es}/node-env.nix (79%) create mode 100644 purs-backend-es/node-packages.nix create mode 100644 purs-tidy/composition.nix diff --git a/README.md b/README.md index ad6fc55..e933c38 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,66 @@ pkgs.mkShell { } ``` +## Nix Flakes + +There is a `flake.nix`. To see what the `flake.nix` provides, + +``` +nix flake show github:justinwoo/easy-purescript-nix --allow-import-from-derivation +``` + +### Deluxe `nix develop` shell + +To get a deluxe PureScript development shell which includes the latest +versions of everything, + +``` +nix develop github:justinwoo/easy-purescript-nix#deluxe +``` + +### Custom `nix develop` shell + +Create a custom `nix develop` shell with a `flake.nix` like this for example: + +```nix +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; + flake-utils.url = "github:numtide/flake-utils"; + easy-purescript-nix.url = "github:justinwoo/easy-purescript-nix"; + }; + + outputs = { nixpkgs, flake-utils, easy-purescript-nix, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + easy-ps = easy-purescript-nix.packages.${system}; + in + { + devShells = { + default = pkgs.mkShell { + name = "purescript-custom-shell"; + buildInputs = [ + easy-ps.purs-0_15_8 + easy-ps.spago + easy-ps.purescript-language-server + easy-ps.purs-tidy + pkgs.nodejs-18_x + pkgs.esbuild + ]; + shellHook = '' + source <(spago --bash-completion-script `which spago`) + source <(node --completion-bash) + ''; + }; + }; + } + ); +} +``` + + + ## Why was this made? See the blog post about this here: diff --git a/default.nix b/default.nix index 261d26e..7bd7ba8 100644 --- a/default.nix +++ b/default.nix @@ -146,15 +146,7 @@ let inherit pkgs; }; - pulp-15_0_0 = import ./pulp/15.0.0 { inherit pkgs; }; - - pulp-16_0_0-0 = import ./pulp/16.0.0-0 { inherit pkgs; }; - - pulp-16_0_2 = import ./pulp/16.0.2 { inherit pkgs; }; - - pulp = pulp-16_0_2; - - pulp-latest = import ./pulp/latest { inherit pkgs; }; + pulp = import ./pulp { inherit pkgs; }; purescript-language-server = import ./purescript-language-server { inherit pkgs; @@ -164,9 +156,8 @@ let inherit pkgs; }; - purs-backend-es-1_1_0 = import ./purs-backend-es/1.1.0 { inherit pkgs; }; + purs-backend-es = import ./purs-backend-es { inherit pkgs; }; - purs-backend-es = purs-backend-es-1_1_0; }; buildInputs = builtins.attrValues inputs; diff --git a/flake.lock b/flake.lock index be5727f..c29e306 100644 --- a/flake.lock +++ b/flake.lock @@ -1,17 +1,15 @@ { "nodes": { - "root": { + "flake-utils": { "inputs": { - "utils": "utils" - } - }, - "utils": { + "systems": "systems" + }, "locked": { - "lastModified": 1619345332, - "narHash": "sha256-qHnQkEp1uklKTpx3MvKtY6xzgcqXDsz5nLilbbuL+3A=", + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", "owner": "numtide", "repo": "flake-utils", - "rev": "2ebf2558e5bf978c7fb8ea927dfaed8fefab2e28", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", "type": "github" }, "original": { @@ -19,6 +17,26 @@ "repo": "flake-utils", "type": "github" } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 43d5908..1d12323 100644 --- a/flake.nix +++ b/flake.nix @@ -1,10 +1,45 @@ -{ inputs.utils.url = "github:numtide/flake-utils"; +{ inputs.flake-utils.url = "github:numtide/flake-utils"; - outputs = { utils, ... }: - utils.lib.eachDefaultSystem + outputs = { flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: - { packages = - (import ./. { pkgs = import ./pinned.nix { inherit system; }; }).inputs; + let + # TODO pinned.nix could be a flake input.nixpkgs instead. + pkgs = import ./pinned.nix { inherit system; }; + packages = (import ./default.nix { inherit pkgs; }).inputs; + in + { + inherit packages; + devShells = { + deluxe = pkgs.mkShell { + name = "easy-purescript-nix-shell-deluxe"; + buildInputs = with packages; [ + purs + pulp + psc-package + purp + dhall-simple + spago + spago2nix + pscid + purescript-language-server + purs-tidy + purty + zephyr + purs-backend-es + ] ++ [ + pkgs.nodejs-18_x + pkgs.nodePackages.bower + pkgs.esbuild + ]; + shellHook = '' + source <(spago --bash-completion-script `which spago`) + source <(node --completion-bash) + echo -e " \033[1measy-purescript-nix deluxe development environment\033[0m" + echo -e " \033[1mSee https://discourse.purescript.org/t/recommended-tooling-for-purescript-in-2022\033[0m" + ''; + }; + }; } ); } diff --git a/pinned.nix b/pinned.nix index 8dbfe65..beab974 100644 --- a/pinned.nix +++ b/pinned.nix @@ -1,6 +1,6 @@ import ( builtins.fetchTarball { - url = "https://github.com/nixos/nixpkgs/archive/212c4e8f7327324debecb32dc773bbadda08c3d8.tar.gz"; - sha256 = "0kx4sh20s37v7w0ygxwq080iscl3a3pzjlrvvw17621si1lprcwp"; + url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/23.05.tar.gz"; + sha256 = "10wn0l08j9lgqcw8177nh2ljrnxdrpri7bp0g7nvrsn9rkawvlbf"; } ) diff --git a/pulp/latest/composition.nix b/psa/composition.nix similarity index 86% rename from pulp/latest/composition.nix rename to psa/composition.nix index 08f947e..d9c0dae 100644 --- a/pulp/latest/composition.nix +++ b/psa/composition.nix @@ -2,7 +2,7 @@ {pkgs ? import { inherit system; - }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-14_x"}: + }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_18"}: let nodeEnv = import ./node-env.nix { diff --git a/psa/default.nix b/psa/default.nix index 4631440..26652ad 100644 --- a/psa/default.nix +++ b/psa/default.nix @@ -1,20 +1,7 @@ -{ pkgs ? import { inherit system; } -, system ? builtins.currentSystem -, nodejs ? pkgs."nodejs-14_x" -}: +# How to generate the files in this directory: +# +# nix run nixpkgs#node2nix -- -i <(echo '["psa"]') -c composition.nix -18 +# +{ pkgs ? import { } }: -let - nodeEnv = import ./node-env.nix { - inherit (pkgs) stdenv lib python2 runCommand writeTextFile; - inherit pkgs nodejs; - libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; - }; - - nodePackage = import ./node-packages.nix { - inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; - inherit nodeEnv; - }; - - source = nodePackage.sources."purescript-psa-0.8.2".src; -in -nodeEnv.buildNodePackage (nodePackage.args // { src = source; }) +(import ./composition.nix { inherit pkgs; }).psa diff --git a/psa/node-env.nix b/psa/node-env.nix index c2b7231..bc1e366 100644 --- a/psa/node-env.nix +++ b/psa/node-env.nix @@ -1,6 +1,6 @@ # This file originates from node2nix -{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile}: +{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}: let # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master @@ -40,36 +40,22 @@ let ''; }; - includeDependencies = {dependencies}: - lib.optionalString (dependencies != []) - (lib.concatMapStrings (dependency: - '' - # Bundle the dependencies of the package - mkdir -p node_modules - cd node_modules - - # Only include dependencies if they don't exist. They may also be bundled in the package. - if [ ! -e "${dependency.name}" ] - then - ${composePackage dependency} - fi + # Common shell logic + installPackage = writeShellScript "install-package" '' + installPackage() { + local packageName=$1 src=$2 - cd .. - '' - ) dependencies); + local strippedName - # Recursively composes the dependencies of a package - composePackage = { name, packageName, src, dependencies ? [], ... }@args: - builtins.addErrorContext "while evaluating node package '${packageName}'" '' - DIR=$(pwd) + local DIR=$PWD cd $TMPDIR - unpackFile ${src} + unpackFile $src # Make the base dir in which the target dependency resides first - mkdir -p "$(dirname "$DIR/${packageName}")" + mkdir -p "$(dirname "$DIR/$packageName")" - if [ -f "${src}" ] + if [ -f "$src" ] then # Figure out what directory has been unpacked packageDir="$(find . -maxdepth 1 -type d | tail -1)" @@ -79,28 +65,53 @@ let chmod -R u+w "$packageDir" # Move the extracted tarball into the output folder - mv "$packageDir" "$DIR/${packageName}" - elif [ -d "${src}" ] + mv "$packageDir" "$DIR/$packageName" + elif [ -d "$src" ] then # Get a stripped name (without hash) of the source directory. # On old nixpkgs it's already set internally. if [ -z "$strippedName" ] then - strippedName="$(stripHash ${src})" + strippedName="$(stripHash $src)" fi # Restore write permissions to make building work chmod -R u+w "$strippedName" # Move the extracted directory into the output folder - mv "$strippedName" "$DIR/${packageName}" + mv "$strippedName" "$DIR/$packageName" fi - # Unset the stripped name to not confuse the next unpack step - unset strippedName + # Change to the package directory to install dependencies + cd "$DIR/$packageName" + } + ''; - # Include the dependencies of the package - cd "$DIR/${packageName}" + # Bundle the dependencies of the package + # + # Only include dependencies if they don't exist. They may also be bundled in the package. + includeDependencies = {dependencies}: + lib.optionalString (dependencies != []) ( + '' + mkdir -p node_modules + cd node_modules + '' + + (lib.concatMapStrings (dependency: + '' + if [ ! -e "${dependency.packageName}" ]; then + ${composePackage dependency} + fi + '' + ) dependencies) + + '' + cd .. + '' + ); + + # Recursively composes the dependencies of a package + composePackage = { name, packageName, src, dependencies ? [], ... }@args: + builtins.addErrorContext "while evaluating node package '${packageName}'" '' + installPackage "${packageName}" "${src}" ${includeDependencies { inherit dependencies; }} cd .. ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} @@ -154,7 +165,11 @@ let if(process.argv[2] == "development") { replaceDependencies(packageObj.devDependencies); } + else { + packageObj.devDependencies = {}; + } replaceDependencies(packageObj.optionalDependencies); + replaceDependencies(packageObj.peerDependencies); /* Write the fixed package.json file */ fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); @@ -246,8 +261,8 @@ let var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); if(![1, 2].includes(packageLock.lockfileVersion)) { - process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); - process.exit(1); + process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); + process.exit(1); } if(packageLock.dependencies !== undefined) { @@ -259,7 +274,7 @@ let # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes reconstructPackageLock = writeTextFile { - name = "addintegrityfields.js"; + name = "reconstructpackagelock.js"; text = '' var fs = require('fs'); var path = require('path'); @@ -269,25 +284,43 @@ let var lockObj = { name: packageObj.name, version: packageObj.version, - lockfileVersion: 1, + lockfileVersion: 2, requires: true, + packages: { + "": { + name: packageObj.name, + version: packageObj.version, + license: packageObj.license, + bin: packageObj.bin, + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + } + }, dependencies: {} }; - function augmentPackageJSON(filePath, dependencies) { + function augmentPackageJSON(filePath, packages, dependencies) { var packageJSON = path.join(filePath, "package.json"); if(fs.existsSync(packageJSON)) { var packageObj = JSON.parse(fs.readFileSync(packageJSON)); + packages[filePath] = { + version: packageObj.version, + integrity: "sha1-000000000000000000000000000=", + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + }; dependencies[packageObj.name] = { version: packageObj.version, integrity: "sha1-000000000000000000000000000=", dependencies: {} }; - processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies); + processDependencies(path.join(filePath, "node_modules"), packages, dependencies[packageObj.name].dependencies); } } - function processDependencies(dir, dependencies) { + function processDependencies(dir, packages, dependencies) { if(fs.existsSync(dir)) { var files = fs.readdirSync(dir); @@ -303,23 +336,84 @@ let pkgFiles.forEach(function(entry) { if(stats.isDirectory()) { var pkgFilePath = path.join(filePath, entry); - augmentPackageJSON(pkgFilePath, dependencies); + augmentPackageJSON(pkgFilePath, packages, dependencies); } }); } else { - augmentPackageJSON(filePath, dependencies); + augmentPackageJSON(filePath, packages, dependencies); } } }); } } - processDependencies("node_modules", lockObj.dependencies); + processDependencies("node_modules", lockObj.packages, lockObj.dependencies); fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); ''; }; + # Script that links bins defined in package.json to the node_modules bin directory + # NPM does not do this for top-level packages itself anymore as of v7 + linkBinsScript = writeTextFile { + name = "linkbins.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + var packageObj = JSON.parse(fs.readFileSync("package.json")); + + var nodeModules = Array(packageObj.name.split("/").length).fill("..").join(path.sep); + + if(packageObj.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + if(typeof packageObj.bin == "object") { + Object.keys(packageObj.bin).forEach(function(exe) { + if(fs.existsSync(packageObj.bin[exe])) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin[exe]), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + else { + if(fs.existsSync(packageObj.bin)) { + console.log("linking bin '" + packageObj.bin + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin), + path.join(nodeModules, ".bin", packageObj.name.split("/").pop()) + ); + } + else { + console.log("skipping non-existent bin '" + packageObj.bin + "'"); + } + } + } + else if(packageObj.directories !== undefined && packageObj.directories.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + fs.readdirSync(packageObj.directories.bin).forEach(function(exe) { + if(fs.existsSync(path.join(packageObj.directories.bin, exe))) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.directories.bin, exe), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + ''; + }; + prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}: let forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; @@ -366,20 +460,25 @@ let npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild + runHook postRebuild + if [ "''${dontNpmInstall-}" != "1" ] then # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. rm -f npm-shrinkwrap.json - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install + npm ${forceOfflineFlag} --nodedir=${nodeSources} --no-bin-links --ignore-scripts ${npmFlags} ${lib.optionalString production "--production"} install fi + + # Link executables defined in package.json + node ${linkBinsScript} ''; # Builds and composes an NPM package including all its dependencies buildNodePackage = { name , packageName - , version + , version ? null , dependencies ? [] , buildInputs ? [] , production ? true @@ -391,13 +490,14 @@ let , dontStrip ? true , unpackPhase ? "true" , buildPhase ? "true" + , meta ? {} , ... }@args: let - extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ]; + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ]; in stdenv.mkDerivation ({ - name = "node_${name}-${version}"; + name = "${name}${if version == null then "" else "-${version}"}"; buildInputs = [ tarWrapper python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ lib.optional (stdenv.isDarwin) libtool @@ -414,6 +514,8 @@ let passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; installPhase = '' + source ${installPackage} + # Create and enter a root node_modules/ folder mkdir -p $out/lib/node_modules cd $out/lib/node_modules @@ -427,6 +529,17 @@ let if [ -d "$out/lib/node_modules/.bin" ] then ln -s $out/lib/node_modules/.bin $out/bin + + # Fixup all executables + ls $out/bin/* | while read i + do + file="$(readlink -f "$i")" + chmod u+rwx "$file" + if isScript "$file" + then + sed -i 's/\r$//' "$file" # convert crlf to lf + fi + done fi # Create symlinks to the deployed manual page folders, if applicable @@ -446,13 +559,18 @@ let # Run post install hook, if provided runHook postInstall ''; + + meta = { + # default to Node.js' platforms + platforms = nodejs.meta.platforms; + } // meta; } // extraArgs); # Builds a node environment (a node_modules folder and a set of binaries) buildNodeDependencies = { name , packageName - , version + , version ? null , src , dependencies ? [] , buildInputs ? [] @@ -470,7 +588,7 @@ let extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; in stdenv.mkDerivation ({ - name = "node-dependencies-${name}-${version}"; + name = "node-dependencies-${name}${if version == null then "" else "-${version}"}"; buildInputs = [ tarWrapper python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux @@ -486,6 +604,8 @@ let passAsFile = [ "includeScript" "pinpointDependenciesScript" ]; installPhase = '' + source ${installPackage} + mkdir -p $out/${packageName} cd $out/${packageName} @@ -498,6 +618,7 @@ let if [ -f ${src}/package-lock.json ] then cp ${src}/package-lock.json . + chmod 644 package-lock.json fi ''} @@ -520,7 +641,7 @@ let buildNodeShell = { name , packageName - , version + , version ? null , src , dependencies ? [] , buildInputs ? [] @@ -536,9 +657,10 @@ let let nodeDependencies = buildNodeDependencies args; + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "unpackPhase" "buildPhase" ]; in - stdenv.mkDerivation { - name = "node-shell-${name}-${version}"; + stdenv.mkDerivation ({ + name = "node-shell-${name}${if version == null then "" else "-${version}"}"; buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs; buildCommand = '' @@ -557,7 +679,7 @@ let export NODE_PATH=${nodeDependencies}/lib/node_modules export PATH="${nodeDependencies}/bin:$PATH" ''; - }; + } // extraArgs); in { buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist; diff --git a/psa/node-packages.nix b/psa/node-packages.nix index 5093e17..75bb71a 100644 --- a/psa/node-packages.nix +++ b/psa/node-packages.nix @@ -1,51 +1,340 @@ -# This file has been generated by node2nix 1.9.0. Do not edit! +# This file has been generated by node2nix 1.11.1. Do not edit! {nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}: let sources = { - "purescript-psa-0.8.2" = { - name = "purescript-psa"; - packageName = "purescript-psa"; - version = "0.8.2"; + "ansi-regex-2.1.1" = { + name = "ansi-regex"; + packageName = "ansi-regex"; + version = "2.1.1"; src = fetchurl { - url = "https://registry.npmjs.org/purescript-psa/-/purescript-psa-0.8.2.tgz"; - sha512 = "4Olf0aQQrNCfcDLXQI3gJgINEQ+3U+4QPLmQ2LHX2L/YOXSwM7fOGIUs/wMm/FQnwERUyQmHKQTJKB4LIjE2fg=="; + url = "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz"; + sha512 = "TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA=="; + }; + }; + "ansi-styles-2.2.1" = { + name = "ansi-styles"; + packageName = "ansi-styles"; + version = "2.2.1"; + src = fetchurl { + url = "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz"; + sha512 = "kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA=="; + }; + }; + "ansicolors-0.2.1" = { + name = "ansicolors"; + packageName = "ansicolors"; + version = "0.2.1"; + src = fetchurl { + url = "https://registry.npmjs.org/ansicolors/-/ansicolors-0.2.1.tgz"; + sha512 = "tOIuy1/SK/dr94ZA0ckDohKXNeBNqZ4us6PjMVLs5h1w2GBB6uPtOknp2+VF4F/zcy9LI70W+Z+pE2Soajky1w=="; + }; + }; + "cardinal-1.0.0" = { + name = "cardinal"; + packageName = "cardinal"; + version = "1.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/cardinal/-/cardinal-1.0.0.tgz"; + sha512 = "INsuF4GyiFLk8C91FPokbKTc/rwHqV4JnfatVZ6GPhguP1qmkRWX2dp5tepYboYdPpGWisLVLI+KsXoXFPRSMg=="; + }; + }; + "chalk-1.1.3" = { + name = "chalk"; + packageName = "chalk"; + version = "1.1.3"; + src = fetchurl { + url = "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz"; + sha512 = "U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A=="; + }; + }; + "cli-table-0.3.11" = { + name = "cli-table"; + packageName = "cli-table"; + version = "0.3.11"; + src = fetchurl { + url = "https://registry.npmjs.org/cli-table/-/cli-table-0.3.11.tgz"; + sha512 = "IqLQi4lO0nIB4tcdTpN4LCB9FI3uqrJZK7RC515EnhZ6qBaglkIgICb1wjeAqpdoOabm1+SuQtkXIPdYC93jhQ=="; + }; + }; + "colors-1.0.3" = { + name = "colors"; + packageName = "colors"; + version = "1.0.3"; + src = fetchurl { + url = "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz"; + sha512 = "pFGrxThWcWQ2MsAz6RtgeWe4NK2kUE1WfsrvvlctdII745EW9I0yflqhe7++M5LEc7bV2c/9/5zc8sFcpL0Drw=="; + }; + }; + "configstore-3.1.5" = { + name = "configstore"; + packageName = "configstore"; + version = "3.1.5"; + src = fetchurl { + url = "https://registry.npmjs.org/configstore/-/configstore-3.1.5.tgz"; + sha512 = "nlOhI4+fdzoK5xmJ+NY+1gZK56bwEaWZr8fYuXohZ9Vkc1o3a4T/R3M+yE/w7x/ZVJ1zF8c+oaOvF0dztdUgmA=="; + }; + }; + "crypto-random-string-1.0.0" = { + name = "crypto-random-string"; + packageName = "crypto-random-string"; + version = "1.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz"; + sha512 = "GsVpkFPlycH7/fRR7Dhcmnoii54gV1nz7y4CWyeFS14N+JVBBhY+r8amRHE4BwSYal7BPTDp8isvAlCxyFt3Hg=="; + }; + }; + "dot-prop-4.2.1" = { + name = "dot-prop"; + packageName = "dot-prop"; + version = "4.2.1"; + src = fetchurl { + url = "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.1.tgz"; + sha512 = "l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ=="; + }; + }; + "escape-string-regexp-1.0.5" = { + name = "escape-string-regexp"; + packageName = "escape-string-regexp"; + version = "1.0.5"; + src = fetchurl { + url = "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz"; + sha512 = "vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="; + }; + }; + "esprima-3.0.0" = { + name = "esprima"; + packageName = "esprima"; + version = "3.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/esprima/-/esprima-3.0.0.tgz"; + sha512 = "xoBq/MIShSydNZOkjkoCEjqod963yHNXTLC40ypBhop6yPqflPz/vTinmCfSrGcywVLnSftRf6a0kJLdFdzemw=="; + }; + }; + "figlet-1.6.0" = { + name = "figlet"; + packageName = "figlet"; + version = "1.6.0"; + src = fetchurl { + url = "https://registry.npmjs.org/figlet/-/figlet-1.6.0.tgz"; + sha512 = "31EQGhCEITv6+hi2ORRPyn3bulaV9Fl4xOdR169cBzH/n1UqcxsiSB/noo6SJdD7Kfb1Ljit+IgR1USvF/XbdA=="; + }; + }; + "graceful-fs-4.2.11" = { + name = "graceful-fs"; + packageName = "graceful-fs"; + version = "4.2.11"; + src = fetchurl { + url = "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz"; + sha512 = "RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="; + }; + }; + "has-ansi-2.0.0" = { + name = "has-ansi"; + packageName = "has-ansi"; + version = "2.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz"; + sha512 = "C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg=="; + }; + }; + "imurmurhash-0.1.4" = { + name = "imurmurhash"; + packageName = "imurmurhash"; + version = "0.1.4"; + src = fetchurl { + url = "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz"; + sha512 = "JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="; + }; + }; + "is-obj-1.0.1" = { + name = "is-obj"; + packageName = "is-obj"; + version = "1.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz"; + sha512 = "l4RyHgRqGN4Y3+9JHVrNqO+tN0rV5My76uW5/nuO4K1b6vw5G8d/cmFjP9tRfEsdhZNt0IFdZuK/c2Vr4Nb+Qg=="; + }; + }; + "lodash-4.17.21" = { + name = "lodash"; + packageName = "lodash"; + version = "4.17.21"; + src = fetchurl { + url = "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"; + sha512 = "v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="; + }; + }; + "lodash.assign-4.2.0" = { + name = "lodash.assign"; + packageName = "lodash.assign"; + version = "4.2.0"; + src = fetchurl { + url = "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz"; + sha512 = "hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw=="; + }; + }; + "make-dir-1.3.0" = { + name = "make-dir"; + packageName = "make-dir"; + version = "1.3.0"; + src = fetchurl { + url = "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz"; + sha512 = "2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ=="; + }; + }; + "marked-0.3.19" = { + name = "marked"; + packageName = "marked"; + version = "0.3.19"; + src = fetchurl { + url = "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz"; + sha512 = "ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg=="; + }; + }; + "marked-terminal-2.0.0" = { + name = "marked-terminal"; + packageName = "marked-terminal"; + version = "2.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/marked-terminal/-/marked-terminal-2.0.0.tgz"; + sha512 = "aZ7yKAww2yyYsuBbO4NoaD8ExWXKYy9k3rWcWUS9iI1wrYtr6vrVeUHdwoBEElrRpKkb0ZWlJi4K392XBYet4A=="; + }; + }; + "node-emoji-1.11.0" = { + name = "node-emoji"; + packageName = "node-emoji"; + version = "1.11.0"; + src = fetchurl { + url = "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz"; + sha512 = "wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A=="; + }; + }; + "pify-3.0.0" = { + name = "pify"; + packageName = "pify"; + version = "3.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz"; + sha512 = "C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg=="; + }; + }; + "redeyed-1.0.1" = { + name = "redeyed"; + packageName = "redeyed"; + version = "1.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/redeyed/-/redeyed-1.0.1.tgz"; + sha512 = "8eEWsNCkV2rvwKLS1Cvp5agNjMhwRe2um+y32B2+3LqOzg4C9BBPs6vzAfV16Ivb8B9HPNKIqd8OrdBws8kNlQ=="; + }; + }; + "signal-exit-3.0.7" = { + name = "signal-exit"; + packageName = "signal-exit"; + version = "3.0.7"; + src = fetchurl { + url = "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz"; + sha512 = "wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="; + }; + }; + "strip-ansi-3.0.1" = { + name = "strip-ansi"; + packageName = "strip-ansi"; + version = "3.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz"; + sha512 = "VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg=="; + }; + }; + "supports-color-2.0.0" = { + name = "supports-color"; + packageName = "supports-color"; + version = "2.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz"; + sha512 = "KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g=="; + }; + }; + "unique-string-1.0.0" = { + name = "unique-string"; + packageName = "unique-string"; + version = "1.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz"; + sha512 = "ODgiYu03y5g76A1I9Gt0/chLCzQjvzDy7DsZGsLOE/1MrF6wriEskSncj1+/C58Xk/kPZDppSctDybCwOSaGAg=="; + }; + }; + "write-file-atomic-2.4.3" = { + name = "write-file-atomic"; + packageName = "write-file-atomic"; + version = "2.4.3"; + src = fetchurl { + url = "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz"; + sha512 = "GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ=="; + }; + }; + "xdg-basedir-3.0.0" = { + name = "xdg-basedir"; + packageName = "xdg-basedir"; + version = "3.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz"; + sha512 = "1Dly4xqlulvPD3fZUQJLY+FUIeqN3N2MM3uqe4rCJftAvOjFa3jFGfctOgluGx4ahPbUCsZkmJILiP0Vi4T6lQ=="; }; }; }; - args = { +in +{ + psa = nodeEnv.buildNodePackage { name = "psa"; packageName = "psa"; - version = "0.8.2"; - src = ./.; + version = "1.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/psa/-/psa-1.0.0.tgz"; + sha512 = "EbYfuB+KQCuQvq7EfDb8BspQtMPTllNTOeUMA96U6BFu+l+IC++oY7NcRf5s48jNfsx/hII+LmJzNwYPPi+H7w=="; + }; dependencies = [ - sources."purescript-psa-0.8.2" + sources."ansi-regex-2.1.1" + sources."ansi-styles-2.2.1" + sources."ansicolors-0.2.1" + sources."cardinal-1.0.0" + sources."chalk-1.1.3" + sources."cli-table-0.3.11" + sources."colors-1.0.3" + sources."configstore-3.1.5" + sources."crypto-random-string-1.0.0" + sources."dot-prop-4.2.1" + sources."escape-string-regexp-1.0.5" + sources."esprima-3.0.0" + sources."figlet-1.6.0" + sources."graceful-fs-4.2.11" + sources."has-ansi-2.0.0" + sources."imurmurhash-0.1.4" + sources."is-obj-1.0.1" + sources."lodash-4.17.21" + sources."lodash.assign-4.2.0" + sources."make-dir-1.3.0" + sources."marked-0.3.19" + sources."marked-terminal-2.0.0" + sources."node-emoji-1.11.0" + sources."pify-3.0.0" + sources."redeyed-1.0.1" + sources."signal-exit-3.0.7" + sources."strip-ansi-3.0.1" + sources."supports-color-2.0.0" + sources."unique-string-1.0.0" + sources."write-file-atomic-2.4.3" + sources."xdg-basedir-3.0.0" ]; buildInputs = globalBuildInputs; meta = { + description = ""; + homepage = "https://github.com/jpnelson/psa#readme"; + license = "MIT"; }; production = true; bypassCache = true; reconstructLock = true; }; -in -{ - args = args; - sources = sources; - tarball = nodeEnv.buildNodeSourceDist args; - package = nodeEnv.buildNodePackage args; - shell = nodeEnv.buildNodeShell args; - nodeDependencies = nodeEnv.buildNodeDependencies (lib.overrideExisting args { - src = stdenv.mkDerivation { - name = args.name + "-package-json"; - src = nix-gitignore.gitignoreSourcePure [ - "*" - "!package.json" - "!package-lock.json" - ] args.src; - dontBuild = true; - installPhase = "mkdir -p $out; cp -r ./* $out;"; - }; - }); } diff --git a/pscid/composition.nix b/pscid/composition.nix new file mode 100644 index 0000000..d9c0dae --- /dev/null +++ b/pscid/composition.nix @@ -0,0 +1,17 @@ +# This file has been generated by node2nix 1.11.1. Do not edit! + +{pkgs ? import { + inherit system; + }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_18"}: + +let + nodeEnv = import ./node-env.nix { + inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; + inherit pkgs nodejs; + libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; + }; +in +import ./node-packages.nix { + inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; + inherit nodeEnv; +} diff --git a/pscid/default.nix b/pscid/default.nix index 8ac0868..6bd98a1 100644 --- a/pscid/default.nix +++ b/pscid/default.nix @@ -1,20 +1,7 @@ -{ pkgs ? import { inherit system; } -, system ? builtins.currentSystem -, nodejs ? pkgs."nodejs-14_x" -}: +# How to generate the files in this directory: +# +# nix run nixpkgs#node2nix -- -i <(echo '["pscid"]') -c composition.nix -18 +# +{ pkgs ? import { } }: -let - nodeEnv = import ./node-env.nix { - inherit (pkgs) stdenv lib python2 runCommand writeTextFile; - inherit pkgs nodejs; - libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; - }; - - nodePackage = import ./node-packages.nix { - inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; - inherit nodeEnv; - }; - - source = nodePackage.sources."pscid-2.9.3".src; -in -nodeEnv.buildNodePackage (nodePackage.args // { src = source; }) +(import ./composition.nix { inherit pkgs; }).pscid diff --git a/pscid/node-env.nix b/pscid/node-env.nix index c2b7231..bc1e366 100644 --- a/pscid/node-env.nix +++ b/pscid/node-env.nix @@ -1,6 +1,6 @@ # This file originates from node2nix -{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile}: +{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}: let # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master @@ -40,36 +40,22 @@ let ''; }; - includeDependencies = {dependencies}: - lib.optionalString (dependencies != []) - (lib.concatMapStrings (dependency: - '' - # Bundle the dependencies of the package - mkdir -p node_modules - cd node_modules - - # Only include dependencies if they don't exist. They may also be bundled in the package. - if [ ! -e "${dependency.name}" ] - then - ${composePackage dependency} - fi + # Common shell logic + installPackage = writeShellScript "install-package" '' + installPackage() { + local packageName=$1 src=$2 - cd .. - '' - ) dependencies); + local strippedName - # Recursively composes the dependencies of a package - composePackage = { name, packageName, src, dependencies ? [], ... }@args: - builtins.addErrorContext "while evaluating node package '${packageName}'" '' - DIR=$(pwd) + local DIR=$PWD cd $TMPDIR - unpackFile ${src} + unpackFile $src # Make the base dir in which the target dependency resides first - mkdir -p "$(dirname "$DIR/${packageName}")" + mkdir -p "$(dirname "$DIR/$packageName")" - if [ -f "${src}" ] + if [ -f "$src" ] then # Figure out what directory has been unpacked packageDir="$(find . -maxdepth 1 -type d | tail -1)" @@ -79,28 +65,53 @@ let chmod -R u+w "$packageDir" # Move the extracted tarball into the output folder - mv "$packageDir" "$DIR/${packageName}" - elif [ -d "${src}" ] + mv "$packageDir" "$DIR/$packageName" + elif [ -d "$src" ] then # Get a stripped name (without hash) of the source directory. # On old nixpkgs it's already set internally. if [ -z "$strippedName" ] then - strippedName="$(stripHash ${src})" + strippedName="$(stripHash $src)" fi # Restore write permissions to make building work chmod -R u+w "$strippedName" # Move the extracted directory into the output folder - mv "$strippedName" "$DIR/${packageName}" + mv "$strippedName" "$DIR/$packageName" fi - # Unset the stripped name to not confuse the next unpack step - unset strippedName + # Change to the package directory to install dependencies + cd "$DIR/$packageName" + } + ''; - # Include the dependencies of the package - cd "$DIR/${packageName}" + # Bundle the dependencies of the package + # + # Only include dependencies if they don't exist. They may also be bundled in the package. + includeDependencies = {dependencies}: + lib.optionalString (dependencies != []) ( + '' + mkdir -p node_modules + cd node_modules + '' + + (lib.concatMapStrings (dependency: + '' + if [ ! -e "${dependency.packageName}" ]; then + ${composePackage dependency} + fi + '' + ) dependencies) + + '' + cd .. + '' + ); + + # Recursively composes the dependencies of a package + composePackage = { name, packageName, src, dependencies ? [], ... }@args: + builtins.addErrorContext "while evaluating node package '${packageName}'" '' + installPackage "${packageName}" "${src}" ${includeDependencies { inherit dependencies; }} cd .. ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} @@ -154,7 +165,11 @@ let if(process.argv[2] == "development") { replaceDependencies(packageObj.devDependencies); } + else { + packageObj.devDependencies = {}; + } replaceDependencies(packageObj.optionalDependencies); + replaceDependencies(packageObj.peerDependencies); /* Write the fixed package.json file */ fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); @@ -246,8 +261,8 @@ let var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); if(![1, 2].includes(packageLock.lockfileVersion)) { - process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); - process.exit(1); + process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); + process.exit(1); } if(packageLock.dependencies !== undefined) { @@ -259,7 +274,7 @@ let # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes reconstructPackageLock = writeTextFile { - name = "addintegrityfields.js"; + name = "reconstructpackagelock.js"; text = '' var fs = require('fs'); var path = require('path'); @@ -269,25 +284,43 @@ let var lockObj = { name: packageObj.name, version: packageObj.version, - lockfileVersion: 1, + lockfileVersion: 2, requires: true, + packages: { + "": { + name: packageObj.name, + version: packageObj.version, + license: packageObj.license, + bin: packageObj.bin, + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + } + }, dependencies: {} }; - function augmentPackageJSON(filePath, dependencies) { + function augmentPackageJSON(filePath, packages, dependencies) { var packageJSON = path.join(filePath, "package.json"); if(fs.existsSync(packageJSON)) { var packageObj = JSON.parse(fs.readFileSync(packageJSON)); + packages[filePath] = { + version: packageObj.version, + integrity: "sha1-000000000000000000000000000=", + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + }; dependencies[packageObj.name] = { version: packageObj.version, integrity: "sha1-000000000000000000000000000=", dependencies: {} }; - processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies); + processDependencies(path.join(filePath, "node_modules"), packages, dependencies[packageObj.name].dependencies); } } - function processDependencies(dir, dependencies) { + function processDependencies(dir, packages, dependencies) { if(fs.existsSync(dir)) { var files = fs.readdirSync(dir); @@ -303,23 +336,84 @@ let pkgFiles.forEach(function(entry) { if(stats.isDirectory()) { var pkgFilePath = path.join(filePath, entry); - augmentPackageJSON(pkgFilePath, dependencies); + augmentPackageJSON(pkgFilePath, packages, dependencies); } }); } else { - augmentPackageJSON(filePath, dependencies); + augmentPackageJSON(filePath, packages, dependencies); } } }); } } - processDependencies("node_modules", lockObj.dependencies); + processDependencies("node_modules", lockObj.packages, lockObj.dependencies); fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); ''; }; + # Script that links bins defined in package.json to the node_modules bin directory + # NPM does not do this for top-level packages itself anymore as of v7 + linkBinsScript = writeTextFile { + name = "linkbins.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + var packageObj = JSON.parse(fs.readFileSync("package.json")); + + var nodeModules = Array(packageObj.name.split("/").length).fill("..").join(path.sep); + + if(packageObj.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + if(typeof packageObj.bin == "object") { + Object.keys(packageObj.bin).forEach(function(exe) { + if(fs.existsSync(packageObj.bin[exe])) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin[exe]), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + else { + if(fs.existsSync(packageObj.bin)) { + console.log("linking bin '" + packageObj.bin + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin), + path.join(nodeModules, ".bin", packageObj.name.split("/").pop()) + ); + } + else { + console.log("skipping non-existent bin '" + packageObj.bin + "'"); + } + } + } + else if(packageObj.directories !== undefined && packageObj.directories.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + fs.readdirSync(packageObj.directories.bin).forEach(function(exe) { + if(fs.existsSync(path.join(packageObj.directories.bin, exe))) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.directories.bin, exe), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + ''; + }; + prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}: let forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; @@ -366,20 +460,25 @@ let npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild + runHook postRebuild + if [ "''${dontNpmInstall-}" != "1" ] then # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. rm -f npm-shrinkwrap.json - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install + npm ${forceOfflineFlag} --nodedir=${nodeSources} --no-bin-links --ignore-scripts ${npmFlags} ${lib.optionalString production "--production"} install fi + + # Link executables defined in package.json + node ${linkBinsScript} ''; # Builds and composes an NPM package including all its dependencies buildNodePackage = { name , packageName - , version + , version ? null , dependencies ? [] , buildInputs ? [] , production ? true @@ -391,13 +490,14 @@ let , dontStrip ? true , unpackPhase ? "true" , buildPhase ? "true" + , meta ? {} , ... }@args: let - extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ]; + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ]; in stdenv.mkDerivation ({ - name = "node_${name}-${version}"; + name = "${name}${if version == null then "" else "-${version}"}"; buildInputs = [ tarWrapper python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ lib.optional (stdenv.isDarwin) libtool @@ -414,6 +514,8 @@ let passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; installPhase = '' + source ${installPackage} + # Create and enter a root node_modules/ folder mkdir -p $out/lib/node_modules cd $out/lib/node_modules @@ -427,6 +529,17 @@ let if [ -d "$out/lib/node_modules/.bin" ] then ln -s $out/lib/node_modules/.bin $out/bin + + # Fixup all executables + ls $out/bin/* | while read i + do + file="$(readlink -f "$i")" + chmod u+rwx "$file" + if isScript "$file" + then + sed -i 's/\r$//' "$file" # convert crlf to lf + fi + done fi # Create symlinks to the deployed manual page folders, if applicable @@ -446,13 +559,18 @@ let # Run post install hook, if provided runHook postInstall ''; + + meta = { + # default to Node.js' platforms + platforms = nodejs.meta.platforms; + } // meta; } // extraArgs); # Builds a node environment (a node_modules folder and a set of binaries) buildNodeDependencies = { name , packageName - , version + , version ? null , src , dependencies ? [] , buildInputs ? [] @@ -470,7 +588,7 @@ let extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; in stdenv.mkDerivation ({ - name = "node-dependencies-${name}-${version}"; + name = "node-dependencies-${name}${if version == null then "" else "-${version}"}"; buildInputs = [ tarWrapper python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux @@ -486,6 +604,8 @@ let passAsFile = [ "includeScript" "pinpointDependenciesScript" ]; installPhase = '' + source ${installPackage} + mkdir -p $out/${packageName} cd $out/${packageName} @@ -498,6 +618,7 @@ let if [ -f ${src}/package-lock.json ] then cp ${src}/package-lock.json . + chmod 644 package-lock.json fi ''} @@ -520,7 +641,7 @@ let buildNodeShell = { name , packageName - , version + , version ? null , src , dependencies ? [] , buildInputs ? [] @@ -536,9 +657,10 @@ let let nodeDependencies = buildNodeDependencies args; + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "unpackPhase" "buildPhase" ]; in - stdenv.mkDerivation { - name = "node-shell-${name}-${version}"; + stdenv.mkDerivation ({ + name = "node-shell-${name}${if version == null then "" else "-${version}"}"; buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs; buildCommand = '' @@ -557,7 +679,7 @@ let export NODE_PATH=${nodeDependencies}/lib/node_modules export PATH="${nodeDependencies}/bin:$PATH" ''; - }; + } // extraArgs); in { buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist; diff --git a/pscid/node-packages.nix b/pscid/node-packages.nix index 55dd2ee..f8b52f2 100644 --- a/pscid/node-packages.nix +++ b/pscid/node-packages.nix @@ -1,9 +1,63 @@ -# This file has been generated by node2nix 1.9.0. Do not edit! +# This file has been generated by node2nix 1.11.1. Do not edit! {nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}: let sources = { + "@isaacs/cliui-8.0.2" = { + name = "_at_isaacs_slash_cliui"; + packageName = "@isaacs/cliui"; + version = "8.0.2"; + src = fetchurl { + url = "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz"; + sha512 = "O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="; + }; + }; + "@pkgjs/parseargs-0.11.0" = { + name = "_at_pkgjs_slash_parseargs"; + packageName = "@pkgjs/parseargs"; + version = "0.11.0"; + src = fetchurl { + url = "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz"; + sha512 = "+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="; + }; + }; + "ansi-regex-5.0.1" = { + name = "ansi-regex"; + packageName = "ansi-regex"; + version = "5.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz"; + sha512 = "quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="; + }; + }; + "ansi-regex-6.0.1" = { + name = "ansi-regex"; + packageName = "ansi-regex"; + version = "6.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz"; + sha512 = "n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA=="; + }; + }; + "ansi-styles-4.3.0" = { + name = "ansi-styles"; + packageName = "ansi-styles"; + version = "4.3.0"; + src = fetchurl { + url = "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz"; + sha512 = "zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="; + }; + }; + "ansi-styles-6.2.1" = { + name = "ansi-styles"; + packageName = "ansi-styles"; + version = "6.2.1"; + src = fetchurl { + url = "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz"; + sha512 = "bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug=="; + }; + }; "balanced-match-1.0.2" = { name = "balanced-match"; packageName = "balanced-match"; @@ -22,13 +76,85 @@ let sha512 = "iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="; }; }; + "brace-expansion-2.0.1" = { + name = "brace-expansion"; + packageName = "brace-expansion"; + version = "2.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz"; + sha512 = "XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="; + }; + }; + "color-convert-2.0.1" = { + name = "color-convert"; + packageName = "color-convert"; + version = "2.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz"; + sha512 = "RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="; + }; + }; + "color-name-1.1.4" = { + name = "color-name"; + packageName = "color-name"; + version = "1.1.4"; + src = fetchurl { + url = "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz"; + sha512 = "dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="; + }; + }; "concat-map-0.0.1" = { name = "concat-map"; packageName = "concat-map"; version = "0.0.1"; src = fetchurl { url = "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"; - sha1 = "d8a96bd77fd68df7793a73036a3ba0d5405d477b"; + sha512 = "/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="; + }; + }; + "cross-spawn-7.0.3" = { + name = "cross-spawn"; + packageName = "cross-spawn"; + version = "7.0.3"; + src = fetchurl { + url = "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz"; + sha512 = "iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w=="; + }; + }; + "eastasianwidth-0.2.0" = { + name = "eastasianwidth"; + packageName = "eastasianwidth"; + version = "0.2.0"; + src = fetchurl { + url = "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz"; + sha512 = "I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="; + }; + }; + "emoji-regex-8.0.0" = { + name = "emoji-regex"; + packageName = "emoji-regex"; + version = "8.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz"; + sha512 = "MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="; + }; + }; + "emoji-regex-9.2.2" = { + name = "emoji-regex"; + packageName = "emoji-regex"; + version = "9.2.2"; + src = fetchurl { + url = "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz"; + sha512 = "L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="; + }; + }; + "foreground-child-3.1.1" = { + name = "foreground-child"; + packageName = "foreground-child"; + version = "3.1.1"; + src = fetchurl { + url = "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz"; + sha512 = "TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg=="; }; }; "fs.realpath-1.0.0" = { @@ -37,7 +163,7 @@ let version = "1.0.0"; src = fetchurl { url = "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"; - sha1 = "1504ad2523158caa40db4a2787cb01411994ea4f"; + sha512 = "OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="; }; }; "gaze-1.1.3" = { @@ -49,6 +175,15 @@ let sha512 = "BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g=="; }; }; + "glob-10.2.6" = { + name = "glob"; + packageName = "glob"; + version = "10.2.6"; + src = fetchurl { + url = "https://registry.npmjs.org/glob/-/glob-10.2.6.tgz"; + sha512 = "U/rnDpXJGF414QQQZv5uVsabTVxMSwzS5CH0p3DRCIV6ownl4f7PzGnkGmvlum2wB+9RlJWJZ6ACU1INnBqiPA=="; + }; + }; "glob-7.1.7" = { name = "glob"; packageName = "glob"; @@ -58,13 +193,13 @@ let sha512 = "OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ=="; }; }; - "globule-1.3.2" = { + "globule-1.3.4" = { name = "globule"; packageName = "globule"; - version = "1.3.2"; + version = "1.3.4"; src = fetchurl { - url = "https://registry.npmjs.org/globule/-/globule-1.3.2.tgz"; - sha512 = "7IDTQTIu2xzXkT+6mlluidnWo+BypnbSoEVVQCGfzqnl5Ik8d3e1d4wycb8Rj9tWW+Z39uPWsdlquqiqPCd/pA=="; + url = "https://registry.npmjs.org/globule/-/globule-1.3.4.tgz"; + sha512 = "OPTIfhMBh7JbBYDpa5b+Q5ptmMWKwcNcFSR/0c6t8V4f3ZAVBEsKNY37QdVqmLRYSMhOUGYrY0QhSoEpzGr/Eg=="; }; }; "inflight-1.0.6" = { @@ -73,7 +208,7 @@ let version = "1.0.6"; src = fetchurl { url = "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz"; - sha1 = "49bd6331d7d02d0c09bc910a1075ba8165b56df9"; + sha512 = "k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA=="; }; }; "inherits-2.0.4" = { @@ -85,13 +220,31 @@ let sha512 = "k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="; }; }; + "is-fullwidth-code-point-3.0.0" = { + name = "is-fullwidth-code-point"; + packageName = "is-fullwidth-code-point"; + version = "3.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz"; + sha512 = "zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="; + }; + }; "isexe-2.0.0" = { name = "isexe"; packageName = "isexe"; version = "2.0.0"; src = fetchurl { url = "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz"; - sha1 = "e8fbf374dc556ff8947a10dcb0572d633f2cfa10"; + sha512 = "RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="; + }; + }; + "jackspeak-2.2.1" = { + name = "jackspeak"; + packageName = "jackspeak"; + version = "2.2.1"; + src = fetchurl { + url = "https://registry.npmjs.org/jackspeak/-/jackspeak-2.2.1.tgz"; + sha512 = "MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw=="; }; }; "keypress-0.2.1" = { @@ -100,7 +253,7 @@ let version = "0.2.1"; src = fetchurl { url = "https://registry.npmjs.org/keypress/-/keypress-0.2.1.tgz"; - sha1 = "1e80454250018dbad4c3fe94497d6e67b6269c77"; + sha512 = "HjorDJFNhnM4SicvaUXac0X77NiskggxJdesG72+O5zBKpSqKFCrqmndKVqpu3pFqkla0St6uGk8Ju0sCurrmg=="; }; }; "lodash-4.17.21" = { @@ -112,13 +265,40 @@ let sha512 = "v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="; }; }; - "minimatch-3.0.4" = { + "lru-cache-9.1.2" = { + name = "lru-cache"; + packageName = "lru-cache"; + version = "9.1.2"; + src = fetchurl { + url = "https://registry.npmjs.org/lru-cache/-/lru-cache-9.1.2.tgz"; + sha512 = "ERJq3FOzJTxBbFjZ7iDs+NiK4VI9Wz+RdrrAB8dio1oV+YvdPzUEE4QNiT2VD51DkIbCYRUUzCRkssXCHqSnKQ=="; + }; + }; + "minimatch-3.0.8" = { name = "minimatch"; packageName = "minimatch"; - version = "3.0.4"; + version = "3.0.8"; + src = fetchurl { + url = "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz"; + sha512 = "6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q=="; + }; + }; + "minimatch-9.0.1" = { + name = "minimatch"; + packageName = "minimatch"; + version = "9.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/minimatch/-/minimatch-9.0.1.tgz"; + sha512 = "0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w=="; + }; + }; + "minipass-6.0.2" = { + name = "minipass"; + packageName = "minipass"; + version = "6.0.2"; src = fetchurl { - url = "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz"; - sha512 = "yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA=="; + url = "https://registry.npmjs.org/minipass/-/minipass-6.0.2.tgz"; + sha512 = "MzWSV5nYVT7mVyWCwn2o7JH13w2TBRmmSqSRCKzTw+lmft9X4z+3wjvs06Tzijo5z4W/kahUCDpRXTF+ZrmF/w=="; }; }; "once-1.4.0" = { @@ -127,7 +307,7 @@ let version = "1.4.0"; src = fetchurl { url = "https://registry.npmjs.org/once/-/once-1.4.0.tgz"; - sha1 = "583b1aa775961d4b113ac17d9c50baef9dd76bd1"; + sha512 = "lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="; }; }; "path-is-absolute-1.0.1" = { @@ -136,16 +316,106 @@ let version = "1.0.1"; src = fetchurl { url = "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz"; - sha1 = "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"; + sha512 = "AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg=="; + }; + }; + "path-key-3.1.1" = { + name = "path-key"; + packageName = "path-key"; + version = "3.1.1"; + src = fetchurl { + url = "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz"; + sha512 = "ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="; + }; + }; + "path-scurry-1.9.2" = { + name = "path-scurry"; + packageName = "path-scurry"; + version = "1.9.2"; + src = fetchurl { + url = "https://registry.npmjs.org/path-scurry/-/path-scurry-1.9.2.tgz"; + sha512 = "qSDLy2aGFPm8i4rsbHd4MNyTcrzHFsLQykrtbuGRknZZCBBVXSv2tSCDN2Cg6Rt/GFRw8GoW9y9Ecw5rIPG1sg=="; + }; + }; + "shebang-command-2.0.0" = { + name = "shebang-command"; + packageName = "shebang-command"; + version = "2.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz"; + sha512 = "kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="; + }; + }; + "shebang-regex-3.0.0" = { + name = "shebang-regex"; + packageName = "shebang-regex"; + version = "3.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz"; + sha512 = "7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="; + }; + }; + "signal-exit-4.0.2" = { + name = "signal-exit"; + packageName = "signal-exit"; + version = "4.0.2"; + src = fetchurl { + url = "https://registry.npmjs.org/signal-exit/-/signal-exit-4.0.2.tgz"; + sha512 = "MY2/qGx4enyjprQnFaZsHib3Yadh3IXyV2C321GY0pjGfVBu4un0uDJkwgdxqO+Rdx8JMT8IfJIRwbYVz3Ob3Q=="; + }; + }; + "string-width-4.2.3" = { + name = "string-width"; + packageName = "string-width"; + version = "4.2.3"; + src = fetchurl { + url = "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"; + sha512 = "wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="; }; }; - "pscid-2.9.3" = { - name = "pscid"; - packageName = "pscid"; - version = "2.9.3"; + "string-width-5.1.2" = { + name = "string-width"; + packageName = "string-width"; + version = "5.1.2"; src = fetchurl { - url = "https://registry.npmjs.org/pscid/-/pscid-2.9.3.tgz"; - sha512 = "6N4chHbL38Km4kTrC7a9UJ4fpPsFV6BDwO3yZetdExN7agC+YGYLpVhLflFUlsZJ9VnUT9UToitwC/DqGnGSjA=="; + url = "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz"; + sha512 = "HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="; + }; + }; + "string-width-cjs-4.2.3" = { + name = "string-width-cjs"; + packageName = "string-width-cjs"; + version = "4.2.3"; + src = fetchurl { + url = "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"; + sha512 = "wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="; + }; + }; + "strip-ansi-6.0.1" = { + name = "strip-ansi"; + packageName = "strip-ansi"; + version = "6.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"; + sha512 = "Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="; + }; + }; + "strip-ansi-7.1.0" = { + name = "strip-ansi"; + packageName = "strip-ansi"; + version = "7.1.0"; + src = fetchurl { + url = "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz"; + sha512 = "iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ=="; + }; + }; + "strip-ansi-cjs-6.0.1" = { + name = "strip-ansi-cjs"; + packageName = "strip-ansi-cjs"; + version = "6.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"; + sha512 = "Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="; }; }; "which-2.0.2" = { @@ -157,65 +427,134 @@ let sha512 = "BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="; }; }; + "which-3.0.1" = { + name = "which"; + packageName = "which"; + version = "3.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/which/-/which-3.0.1.tgz"; + sha512 = "XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg=="; + }; + }; + "wrap-ansi-8.1.0" = { + name = "wrap-ansi"; + packageName = "wrap-ansi"; + version = "8.1.0"; + src = fetchurl { + url = "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"; + sha512 = "si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="; + }; + }; + "wrap-ansi-cjs-7.0.0" = { + name = "wrap-ansi-cjs"; + packageName = "wrap-ansi-cjs"; + version = "7.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"; + sha512 = "YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="; + }; + }; "wrappy-1.0.2" = { name = "wrappy"; packageName = "wrappy"; version = "1.0.2"; src = fetchurl { url = "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"; - sha1 = "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"; + sha512 = "l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="; }; }; }; - args = { +in +{ + pscid = nodeEnv.buildNodePackage { name = "pscid"; packageName = "pscid"; - version = "2.9.3"; - src = ./.; + version = "2.10.0"; + src = fetchurl { + url = "https://registry.npmjs.org/pscid/-/pscid-2.10.0.tgz"; + sha512 = "9YZY5/4yqLp6mXGsTMq7AQO7WfZ9McvFx+9Q1SyRyDsgXbg2CAQ36r0bSLIggVytHtyg7TIb3I+bG6jSWxHewA=="; + }; dependencies = [ + sources."@isaacs/cliui-8.0.2" + sources."@pkgjs/parseargs-0.11.0" + sources."ansi-regex-5.0.1" + sources."ansi-styles-6.2.1" sources."balanced-match-1.0.2" sources."brace-expansion-1.1.11" + sources."color-convert-2.0.1" + sources."color-name-1.1.4" sources."concat-map-0.0.1" + (sources."cross-spawn-7.0.3" // { + dependencies = [ + sources."which-2.0.2" + ]; + }) + sources."eastasianwidth-0.2.0" + sources."emoji-regex-9.2.2" + sources."foreground-child-3.1.1" sources."fs.realpath-1.0.0" sources."gaze-1.1.3" - sources."glob-7.1.7" - sources."globule-1.3.2" + (sources."glob-10.2.6" // { + dependencies = [ + sources."brace-expansion-2.0.1" + sources."minimatch-9.0.1" + ]; + }) + (sources."globule-1.3.4" // { + dependencies = [ + sources."glob-7.1.7" + ]; + }) sources."inflight-1.0.6" sources."inherits-2.0.4" + sources."is-fullwidth-code-point-3.0.0" sources."isexe-2.0.0" + sources."jackspeak-2.2.1" sources."keypress-0.2.1" sources."lodash-4.17.21" - sources."minimatch-3.0.4" + sources."lru-cache-9.1.2" + sources."minimatch-3.0.8" + sources."minipass-6.0.2" sources."once-1.4.0" sources."path-is-absolute-1.0.1" - sources."pscid-2.9.3" - sources."which-2.0.2" + sources."path-key-3.1.1" + sources."path-scurry-1.9.2" + sources."shebang-command-2.0.0" + sources."shebang-regex-3.0.0" + sources."signal-exit-4.0.2" + sources."string-width-5.1.2" + (sources."string-width-cjs-4.2.3" // { + dependencies = [ + sources."emoji-regex-8.0.0" + sources."strip-ansi-6.0.1" + ]; + }) + (sources."strip-ansi-7.1.0" // { + dependencies = [ + sources."ansi-regex-6.0.1" + ]; + }) + sources."strip-ansi-cjs-6.0.1" + sources."which-3.0.1" + sources."wrap-ansi-8.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."strip-ansi-6.0.1" + ]; + }) sources."wrappy-1.0.2" ]; buildInputs = globalBuildInputs; meta = { + description = "A lightweight editor experience for PureScript development"; + homepage = "https://github.com/kritzcreek/pscid#readme"; + license = "LGPL-3.0"; }; production = true; bypassCache = true; reconstructLock = true; }; -in -{ - args = args; - sources = sources; - tarball = nodeEnv.buildNodeSourceDist args; - package = nodeEnv.buildNodePackage args; - shell = nodeEnv.buildNodeShell args; - nodeDependencies = nodeEnv.buildNodeDependencies (lib.overrideExisting args { - src = stdenv.mkDerivation { - name = args.name + "-package-json"; - src = nix-gitignore.gitignoreSourcePure [ - "*" - "!package.json" - "!package-lock.json" - ] args.src; - dontBuild = true; - installPhase = "mkdir -p $out; cp -r ./* $out;"; - }; - }); } diff --git a/pulp/15.0.0/default.nix b/pulp/15.0.0/default.nix deleted file mode 100644 index 5161fd5..0000000 --- a/pulp/15.0.0/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -# This file has been generated by node2nix 1.9.0. Do not edit! - -{ pkgs ? import { - inherit system; - } -, system ? builtins.currentSystem -, nodejs ? pkgs."nodejs-14_x" -}: - -let - nodeEnv = import ./node-env.nix { - inherit (pkgs) stdenv lib python2 runCommand writeTextFile; - inherit pkgs nodejs; - libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; - }; - - nodePackage = import ./node-packages.nix - { - inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; - inherit nodeEnv; - }; - - source = nodePackage.sources."pulp-15.0.0".src; -in -nodeEnv.buildNodePackage (nodePackage.args // { src = source; }) diff --git a/pulp/15.0.0/node-env.nix b/pulp/15.0.0/node-env.nix deleted file mode 100644 index c2b7231..0000000 --- a/pulp/15.0.0/node-env.nix +++ /dev/null @@ -1,567 +0,0 @@ -# This file originates from node2nix - -{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile}: - -let - # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master - utillinux = if pkgs ? utillinux then pkgs.utillinux else pkgs.util-linux; - - python = if nodejs ? python then nodejs.python else python2; - - # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise - tarWrapper = runCommand "tarWrapper" {} '' - mkdir -p $out/bin - - cat > $out/bin/tar <> $out/nix-support/hydra-build-products - ''; - }; - - includeDependencies = {dependencies}: - lib.optionalString (dependencies != []) - (lib.concatMapStrings (dependency: - '' - # Bundle the dependencies of the package - mkdir -p node_modules - cd node_modules - - # Only include dependencies if they don't exist. They may also be bundled in the package. - if [ ! -e "${dependency.name}" ] - then - ${composePackage dependency} - fi - - cd .. - '' - ) dependencies); - - # Recursively composes the dependencies of a package - composePackage = { name, packageName, src, dependencies ? [], ... }@args: - builtins.addErrorContext "while evaluating node package '${packageName}'" '' - DIR=$(pwd) - cd $TMPDIR - - unpackFile ${src} - - # Make the base dir in which the target dependency resides first - mkdir -p "$(dirname "$DIR/${packageName}")" - - if [ -f "${src}" ] - then - # Figure out what directory has been unpacked - packageDir="$(find . -maxdepth 1 -type d | tail -1)" - - # Restore write permissions to make building work - find "$packageDir" -type d -exec chmod u+x {} \; - chmod -R u+w "$packageDir" - - # Move the extracted tarball into the output folder - mv "$packageDir" "$DIR/${packageName}" - elif [ -d "${src}" ] - then - # Get a stripped name (without hash) of the source directory. - # On old nixpkgs it's already set internally. - if [ -z "$strippedName" ] - then - strippedName="$(stripHash ${src})" - fi - - # Restore write permissions to make building work - chmod -R u+w "$strippedName" - - # Move the extracted directory into the output folder - mv "$strippedName" "$DIR/${packageName}" - fi - - # Unset the stripped name to not confuse the next unpack step - unset strippedName - - # Include the dependencies of the package - cd "$DIR/${packageName}" - ${includeDependencies { inherit dependencies; }} - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - ''; - - pinpointDependencies = {dependencies, production}: - let - pinpointDependenciesFromPackageJSON = writeTextFile { - name = "pinpointDependencies.js"; - text = '' - var fs = require('fs'); - var path = require('path'); - - function resolveDependencyVersion(location, name) { - if(location == process.env['NIX_STORE']) { - return null; - } else { - var dependencyPackageJSON = path.join(location, "node_modules", name, "package.json"); - - if(fs.existsSync(dependencyPackageJSON)) { - var dependencyPackageObj = JSON.parse(fs.readFileSync(dependencyPackageJSON)); - - if(dependencyPackageObj.name == name) { - return dependencyPackageObj.version; - } - } else { - return resolveDependencyVersion(path.resolve(location, ".."), name); - } - } - } - - function replaceDependencies(dependencies) { - if(typeof dependencies == "object" && dependencies !== null) { - for(var dependency in dependencies) { - var resolvedVersion = resolveDependencyVersion(process.cwd(), dependency); - - if(resolvedVersion === null) { - process.stderr.write("WARNING: cannot pinpoint dependency: "+dependency+", context: "+process.cwd()+"\n"); - } else { - dependencies[dependency] = resolvedVersion; - } - } - } - } - - /* Read the package.json configuration */ - var packageObj = JSON.parse(fs.readFileSync('./package.json')); - - /* Pinpoint all dependencies */ - replaceDependencies(packageObj.dependencies); - if(process.argv[2] == "development") { - replaceDependencies(packageObj.devDependencies); - } - replaceDependencies(packageObj.optionalDependencies); - - /* Write the fixed package.json file */ - fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); - ''; - }; - in - '' - node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} - - ${lib.optionalString (dependencies != []) - '' - if [ -d node_modules ] - then - cd node_modules - ${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} - cd .. - fi - ''} - ''; - - # Recursively traverses all dependencies of a package and pinpoints all - # dependencies in the package.json file to the versions that are actually - # being used. - - pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args: - '' - if [ -d "${packageName}" ] - then - cd "${packageName}" - ${pinpointDependencies { inherit dependencies production; }} - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - fi - ''; - - # Extract the Node.js source code which is used to compile packages with - # native bindings - nodeSources = runCommand "node-sources" {} '' - tar --no-same-owner --no-same-permissions -xf ${nodejs.src} - mv node-* $out - ''; - - # Script that adds _integrity fields to all package.json files to prevent NPM from consulting the cache (that is empty) - addIntegrityFieldsScript = writeTextFile { - name = "addintegrityfields.js"; - text = '' - var fs = require('fs'); - var path = require('path'); - - function augmentDependencies(baseDir, dependencies) { - for(var dependencyName in dependencies) { - var dependency = dependencies[dependencyName]; - - // Open package.json and augment metadata fields - var packageJSONDir = path.join(baseDir, "node_modules", dependencyName); - var packageJSONPath = path.join(packageJSONDir, "package.json"); - - if(fs.existsSync(packageJSONPath)) { // Only augment packages that exist. Sometimes we may have production installs in which development dependencies can be ignored - console.log("Adding metadata fields to: "+packageJSONPath); - var packageObj = JSON.parse(fs.readFileSync(packageJSONPath)); - - if(dependency.integrity) { - packageObj["_integrity"] = dependency.integrity; - } else { - packageObj["_integrity"] = "sha1-000000000000000000000000000="; // When no _integrity string has been provided (e.g. by Git dependencies), add a dummy one. It does not seem to harm and it bypasses downloads. - } - - if(dependency.resolved) { - packageObj["_resolved"] = dependency.resolved; // Adopt the resolved property if one has been provided - } else { - packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories. - } - - if(dependency.from !== undefined) { // Adopt from property if one has been provided - packageObj["_from"] = dependency.from; - } - - fs.writeFileSync(packageJSONPath, JSON.stringify(packageObj, null, 2)); - } - - // Augment transitive dependencies - if(dependency.dependencies !== undefined) { - augmentDependencies(packageJSONDir, dependency.dependencies); - } - } - } - - if(fs.existsSync("./package-lock.json")) { - var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); - - if(![1, 2].includes(packageLock.lockfileVersion)) { - process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); - process.exit(1); - } - - if(packageLock.dependencies !== undefined) { - augmentDependencies(".", packageLock.dependencies); - } - } - ''; - }; - - # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes - reconstructPackageLock = writeTextFile { - name = "addintegrityfields.js"; - text = '' - var fs = require('fs'); - var path = require('path'); - - var packageObj = JSON.parse(fs.readFileSync("package.json")); - - var lockObj = { - name: packageObj.name, - version: packageObj.version, - lockfileVersion: 1, - requires: true, - dependencies: {} - }; - - function augmentPackageJSON(filePath, dependencies) { - var packageJSON = path.join(filePath, "package.json"); - if(fs.existsSync(packageJSON)) { - var packageObj = JSON.parse(fs.readFileSync(packageJSON)); - dependencies[packageObj.name] = { - version: packageObj.version, - integrity: "sha1-000000000000000000000000000=", - dependencies: {} - }; - processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies); - } - } - - function processDependencies(dir, dependencies) { - if(fs.existsSync(dir)) { - var files = fs.readdirSync(dir); - - files.forEach(function(entry) { - var filePath = path.join(dir, entry); - var stats = fs.statSync(filePath); - - if(stats.isDirectory()) { - if(entry.substr(0, 1) == "@") { - // When we encounter a namespace folder, augment all packages belonging to the scope - var pkgFiles = fs.readdirSync(filePath); - - pkgFiles.forEach(function(entry) { - if(stats.isDirectory()) { - var pkgFilePath = path.join(filePath, entry); - augmentPackageJSON(pkgFilePath, dependencies); - } - }); - } else { - augmentPackageJSON(filePath, dependencies); - } - } - }); - } - } - - processDependencies("node_modules", lockObj.dependencies); - - fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); - ''; - }; - - prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}: - let - forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; - in - '' - # Pinpoint the versions of all dependencies to the ones that are actually being used - echo "pinpointing versions of dependencies..." - source $pinpointDependenciesScriptPath - - # Patch the shebangs of the bundled modules to prevent them from - # calling executables outside the Nix store as much as possible - patchShebangs . - - # Deploy the Node.js package by running npm install. Since the - # dependencies have been provided already by ourselves, it should not - # attempt to install them again, which is good, because we want to make - # it Nix's responsibility. If it needs to install any dependencies - # anyway (e.g. because the dependency parameters are - # incomplete/incorrect), it fails. - # - # The other responsibilities of NPM are kept -- version checks, build - # steps, postprocessing etc. - - export HOME=$TMPDIR - cd "${packageName}" - runHook preRebuild - - ${lib.optionalString bypassCache '' - ${lib.optionalString reconstructLock '' - if [ -f package-lock.json ] - then - echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" - echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!" - rm package-lock.json - else - echo "No package-lock.json file found, reconstructing..." - fi - - node ${reconstructPackageLock} - ''} - - node ${addIntegrityFieldsScript} - ''} - - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild - - if [ "''${dontNpmInstall-}" != "1" ] - then - # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. - rm -f npm-shrinkwrap.json - - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install - fi - ''; - - # Builds and composes an NPM package including all its dependencies - buildNodePackage = - { name - , packageName - , version - , dependencies ? [] - , buildInputs ? [] - , production ? true - , npmFlags ? "" - , dontNpmInstall ? false - , bypassCache ? false - , reconstructLock ? false - , preRebuild ? "" - , dontStrip ? true - , unpackPhase ? "true" - , buildPhase ? "true" - , ... }@args: - - let - extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ]; - in - stdenv.mkDerivation ({ - name = "node_${name}-${version}"; - buildInputs = [ tarWrapper python nodejs ] - ++ lib.optional (stdenv.isLinux) utillinux - ++ lib.optional (stdenv.isDarwin) libtool - ++ buildInputs; - - inherit nodejs; - - inherit dontStrip; # Stripping may fail a build for some package deployments - inherit dontNpmInstall preRebuild unpackPhase buildPhase; - - compositionScript = composePackage args; - pinpointDependenciesScript = pinpointDependenciesOfPackage args; - - passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; - - installPhase = '' - # Create and enter a root node_modules/ folder - mkdir -p $out/lib/node_modules - cd $out/lib/node_modules - - # Compose the package and all its dependencies - source $compositionScriptPath - - ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} - - # Create symlink to the deployed executable folder, if applicable - if [ -d "$out/lib/node_modules/.bin" ] - then - ln -s $out/lib/node_modules/.bin $out/bin - fi - - # Create symlinks to the deployed manual page folders, if applicable - if [ -d "$out/lib/node_modules/${packageName}/man" ] - then - mkdir -p $out/share - for dir in "$out/lib/node_modules/${packageName}/man/"* - do - mkdir -p $out/share/man/$(basename "$dir") - for page in "$dir"/* - do - ln -s $page $out/share/man/$(basename "$dir") - done - done - fi - - # Run post install hook, if provided - runHook postInstall - ''; - } // extraArgs); - - # Builds a node environment (a node_modules folder and a set of binaries) - buildNodeDependencies = - { name - , packageName - , version - , src - , dependencies ? [] - , buildInputs ? [] - , production ? true - , npmFlags ? "" - , dontNpmInstall ? false - , bypassCache ? false - , reconstructLock ? false - , dontStrip ? true - , unpackPhase ? "true" - , buildPhase ? "true" - , ... }@args: - - let - extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; - in - stdenv.mkDerivation ({ - name = "node-dependencies-${name}-${version}"; - - buildInputs = [ tarWrapper python nodejs ] - ++ lib.optional (stdenv.isLinux) utillinux - ++ lib.optional (stdenv.isDarwin) libtool - ++ buildInputs; - - inherit dontStrip; # Stripping may fail a build for some package deployments - inherit dontNpmInstall unpackPhase buildPhase; - - includeScript = includeDependencies { inherit dependencies; }; - pinpointDependenciesScript = pinpointDependenciesOfPackage args; - - passAsFile = [ "includeScript" "pinpointDependenciesScript" ]; - - installPhase = '' - mkdir -p $out/${packageName} - cd $out/${packageName} - - source $includeScriptPath - - # Create fake package.json to make the npm commands work properly - cp ${src}/package.json . - chmod 644 package.json - ${lib.optionalString bypassCache '' - if [ -f ${src}/package-lock.json ] - then - cp ${src}/package-lock.json . - fi - ''} - - # Go to the parent folder to make sure that all packages are pinpointed - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - - ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} - - # Expose the executables that were installed - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - - mv ${packageName} lib - ln -s $out/lib/node_modules/.bin $out/bin - ''; - } // extraArgs); - - # Builds a development shell - buildNodeShell = - { name - , packageName - , version - , src - , dependencies ? [] - , buildInputs ? [] - , production ? true - , npmFlags ? "" - , dontNpmInstall ? false - , bypassCache ? false - , reconstructLock ? false - , dontStrip ? true - , unpackPhase ? "true" - , buildPhase ? "true" - , ... }@args: - - let - nodeDependencies = buildNodeDependencies args; - in - stdenv.mkDerivation { - name = "node-shell-${name}-${version}"; - - buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs; - buildCommand = '' - mkdir -p $out/bin - cat > $out/bin/shell < { - inherit system; - } -, system ? builtins.currentSystem -, nodejs ? pkgs."nodejs-14_x" -}: - -let - nodeEnv = import ./node-env.nix { - inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; - inherit pkgs nodejs; - libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; - }; - - nodePackage = import ./node-packages.nix - { - inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; - inherit nodeEnv; - }; - - source = nodePackage.sources."pulp-16.0.0-0".src; -in -nodeEnv.buildNodePackage (nodePackage.args // { src = source; }) diff --git a/pulp/16.0.0-0/node-packages.nix b/pulp/16.0.0-0/node-packages.nix deleted file mode 100644 index c445e0e..0000000 --- a/pulp/16.0.0-0/node-packages.nix +++ /dev/null @@ -1,1867 +0,0 @@ -# This file has been generated by node2nix 1.9.0. Do not edit! - -{nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}: - -let - sources = { - "JSONStream-0.10.0" = { - name = "JSONStream"; - packageName = "JSONStream"; - version = "0.10.0"; - src = fetchurl { - url = "https://registry.npmjs.org/JSONStream/-/JSONStream-0.10.0.tgz"; - sha1 = "74349d0d89522b71f30f0a03ff9bd20ca6f12ac0"; - }; - }; - "JSONStream-1.3.5" = { - name = "JSONStream"; - packageName = "JSONStream"; - version = "1.3.5"; - src = fetchurl { - url = "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz"; - sha512 = "E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ=="; - }; - }; - "acorn-7.4.1" = { - name = "acorn"; - packageName = "acorn"; - version = "7.4.1"; - src = fetchurl { - url = "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz"; - sha512 = "nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A=="; - }; - }; - "acorn-node-1.8.2" = { - name = "acorn-node"; - packageName = "acorn-node"; - version = "1.8.2"; - src = fetchurl { - url = "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz"; - sha512 = "8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A=="; - }; - }; - "acorn-walk-7.2.0" = { - name = "acorn-walk"; - packageName = "acorn-walk"; - version = "7.2.0"; - src = fetchurl { - url = "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz"; - sha512 = "OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA=="; - }; - }; - "asn1.js-5.4.1" = { - name = "asn1.js"; - packageName = "asn1.js"; - version = "5.4.1"; - src = fetchurl { - url = "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz"; - sha512 = "+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA=="; - }; - }; - "assert-1.5.0" = { - name = "assert"; - packageName = "assert"; - version = "1.5.0"; - src = fetchurl { - url = "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz"; - sha512 = "EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA=="; - }; - }; - "async-1.5.2" = { - name = "async"; - packageName = "async"; - version = "1.5.2"; - src = fetchurl { - url = "https://registry.npmjs.org/async/-/async-1.5.2.tgz"; - sha1 = "ec6a61ae56480c0c3cb241c95618e20892f9672a"; - }; - }; - "balanced-match-1.0.2" = { - name = "balanced-match"; - packageName = "balanced-match"; - version = "1.0.2"; - src = fetchurl { - url = "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"; - sha512 = "3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="; - }; - }; - "base64-js-1.5.1" = { - name = "base64-js"; - packageName = "base64-js"; - version = "1.5.1"; - src = fetchurl { - url = "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"; - sha512 = "AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="; - }; - }; - "bn.js-4.12.0" = { - name = "bn.js"; - packageName = "bn.js"; - version = "4.12.0"; - src = fetchurl { - url = "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz"; - sha512 = "c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA=="; - }; - }; - "bn.js-5.2.0" = { - name = "bn.js"; - packageName = "bn.js"; - version = "5.2.0"; - src = fetchurl { - url = "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz"; - sha512 = "D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw=="; - }; - }; - "brace-expansion-1.1.11" = { - name = "brace-expansion"; - packageName = "brace-expansion"; - version = "1.1.11"; - src = fetchurl { - url = "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz"; - sha512 = "iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="; - }; - }; - "brorand-1.1.0" = { - name = "brorand"; - packageName = "brorand"; - version = "1.1.0"; - src = fetchurl { - url = "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz"; - sha1 = "12c25efe40a45e3c323eb8675a0a0ce57b22371f"; - }; - }; - "browser-pack-6.1.0" = { - name = "browser-pack"; - packageName = "browser-pack"; - version = "6.1.0"; - src = fetchurl { - url = "https://registry.npmjs.org/browser-pack/-/browser-pack-6.1.0.tgz"; - sha512 = "erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA=="; - }; - }; - "browser-resolve-2.0.0" = { - name = "browser-resolve"; - packageName = "browser-resolve"; - version = "2.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/browser-resolve/-/browser-resolve-2.0.0.tgz"; - sha512 = "7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ=="; - }; - }; - "browserify-16.5.2" = { - name = "browserify"; - packageName = "browserify"; - version = "16.5.2"; - src = fetchurl { - url = "https://registry.npmjs.org/browserify/-/browserify-16.5.2.tgz"; - sha512 = "TkOR1cQGdmXU9zW4YukWzWVSJwrxmNdADFbqbE3HFgQWe5wqZmOawqZ7J/8MPCwk/W8yY7Y0h+7mOtcZxLP23g=="; - }; - }; - "browserify-aes-1.2.0" = { - name = "browserify-aes"; - packageName = "browserify-aes"; - version = "1.2.0"; - src = fetchurl { - url = "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz"; - sha512 = "+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA=="; - }; - }; - "browserify-cache-api-3.0.1" = { - name = "browserify-cache-api"; - packageName = "browserify-cache-api"; - version = "3.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/browserify-cache-api/-/browserify-cache-api-3.0.1.tgz"; - sha1 = "96247e853f068fd6e0d45cc73f0bb2cd9778ef02"; - }; - }; - "browserify-cipher-1.0.1" = { - name = "browserify-cipher"; - packageName = "browserify-cipher"; - version = "1.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz"; - sha512 = "sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w=="; - }; - }; - "browserify-des-1.0.2" = { - name = "browserify-des"; - packageName = "browserify-des"; - version = "1.0.2"; - src = fetchurl { - url = "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz"; - sha512 = "BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A=="; - }; - }; - "browserify-incremental-3.1.1" = { - name = "browserify-incremental"; - packageName = "browserify-incremental"; - version = "3.1.1"; - src = fetchurl { - url = "https://registry.npmjs.org/browserify-incremental/-/browserify-incremental-3.1.1.tgz"; - sha1 = "0713cb7587247a632a9f08cf1bd169b878b62a8a"; - }; - }; - "browserify-rsa-4.1.0" = { - name = "browserify-rsa"; - packageName = "browserify-rsa"; - version = "4.1.0"; - src = fetchurl { - url = "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz"; - sha512 = "AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog=="; - }; - }; - "browserify-sign-4.2.1" = { - name = "browserify-sign"; - packageName = "browserify-sign"; - version = "4.2.1"; - src = fetchurl { - url = "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz"; - sha512 = "/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg=="; - }; - }; - "browserify-zlib-0.2.0" = { - name = "browserify-zlib"; - packageName = "browserify-zlib"; - version = "0.2.0"; - src = fetchurl { - url = "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz"; - sha512 = "Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA=="; - }; - }; - "buffer-5.2.1" = { - name = "buffer"; - packageName = "buffer"; - version = "5.2.1"; - src = fetchurl { - url = "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz"; - sha512 = "c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg=="; - }; - }; - "buffer-crc32-0.2.13" = { - name = "buffer-crc32"; - packageName = "buffer-crc32"; - version = "0.2.13"; - src = fetchurl { - url = "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz"; - sha1 = "0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"; - }; - }; - "buffer-from-1.1.2" = { - name = "buffer-from"; - packageName = "buffer-from"; - version = "1.1.2"; - src = fetchurl { - url = "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz"; - sha512 = "E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="; - }; - }; - "buffer-xor-1.0.3" = { - name = "buffer-xor"; - packageName = "buffer-xor"; - version = "1.0.3"; - src = fetchurl { - url = "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz"; - sha1 = "26e61ed1422fb70dd42e6e36729ed51d855fe8d9"; - }; - }; - "builtin-status-codes-3.0.0" = { - name = "builtin-status-codes"; - packageName = "builtin-status-codes"; - version = "3.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz"; - sha1 = "85982878e21b98e1c66425e03d0174788f569ee8"; - }; - }; - "cached-path-relative-1.1.0" = { - name = "cached-path-relative"; - packageName = "cached-path-relative"; - version = "1.1.0"; - src = fetchurl { - url = "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.1.0.tgz"; - sha512 = "WF0LihfemtesFcJgO7xfOoOcnWzY/QHR4qeDqV44jPU3HTI54+LnfXK3SA27AVVGCdZFgjjFFaqUA9Jx7dMJZA=="; - }; - }; - "cipher-base-1.0.4" = { - name = "cipher-base"; - packageName = "cipher-base"; - version = "1.0.4"; - src = fetchurl { - url = "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz"; - sha512 = "Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q=="; - }; - }; - "colors-1.4.0" = { - name = "colors"; - packageName = "colors"; - version = "1.4.0"; - src = fetchurl { - url = "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz"; - sha512 = "a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA=="; - }; - }; - "combine-source-map-0.8.0" = { - name = "combine-source-map"; - packageName = "combine-source-map"; - version = "0.8.0"; - src = fetchurl { - url = "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz"; - sha1 = "a58d0df042c186fcf822a8e8015f5450d2d79a8b"; - }; - }; - "concat-map-0.0.1" = { - name = "concat-map"; - packageName = "concat-map"; - version = "0.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"; - sha1 = "d8a96bd77fd68df7793a73036a3ba0d5405d477b"; - }; - }; - "concat-stream-1.6.2" = { - name = "concat-stream"; - packageName = "concat-stream"; - version = "1.6.2"; - src = fetchurl { - url = "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz"; - sha512 = "27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw=="; - }; - }; - "concat-stream-2.0.0" = { - name = "concat-stream"; - packageName = "concat-stream"; - version = "2.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz"; - sha512 = "MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A=="; - }; - }; - "console-browserify-1.2.0" = { - name = "console-browserify"; - packageName = "console-browserify"; - version = "1.2.0"; - src = fetchurl { - url = "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz"; - sha512 = "ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA=="; - }; - }; - "constants-browserify-1.0.0" = { - name = "constants-browserify"; - packageName = "constants-browserify"; - version = "1.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz"; - sha1 = "c20b96d8c617748aaf1c16021760cd27fcb8cb75"; - }; - }; - "convert-source-map-1.1.3" = { - name = "convert-source-map"; - packageName = "convert-source-map"; - version = "1.1.3"; - src = fetchurl { - url = "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz"; - sha1 = "4829c877e9fe49b3161f3bf3673888e204699860"; - }; - }; - "core-util-is-1.0.3" = { - name = "core-util-is"; - packageName = "core-util-is"; - version = "1.0.3"; - src = fetchurl { - url = "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz"; - sha512 = "ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="; - }; - }; - "create-ecdh-4.0.4" = { - name = "create-ecdh"; - packageName = "create-ecdh"; - version = "4.0.4"; - src = fetchurl { - url = "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz"; - sha512 = "mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A=="; - }; - }; - "create-hash-1.2.0" = { - name = "create-hash"; - packageName = "create-hash"; - version = "1.2.0"; - src = fetchurl { - url = "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz"; - sha512 = "z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg=="; - }; - }; - "create-hmac-1.1.7" = { - name = "create-hmac"; - packageName = "create-hmac"; - version = "1.1.7"; - src = fetchurl { - url = "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz"; - sha512 = "MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg=="; - }; - }; - "crypto-browserify-3.12.0" = { - name = "crypto-browserify"; - packageName = "crypto-browserify"; - version = "3.12.0"; - src = fetchurl { - url = "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz"; - sha512 = "fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg=="; - }; - }; - "dash-ast-1.0.0" = { - name = "dash-ast"; - packageName = "dash-ast"; - version = "1.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/dash-ast/-/dash-ast-1.0.0.tgz"; - sha512 = "Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA=="; - }; - }; - "defined-1.0.0" = { - name = "defined"; - packageName = "defined"; - version = "1.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz"; - sha1 = "c98d9bcef75674188e110969151199e39b1fa693"; - }; - }; - "deps-sort-2.0.1" = { - name = "deps-sort"; - packageName = "deps-sort"; - version = "2.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.1.tgz"; - sha512 = "1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw=="; - }; - }; - "des.js-1.0.1" = { - name = "des.js"; - packageName = "des.js"; - version = "1.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz"; - sha512 = "Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA=="; - }; - }; - "detective-5.2.0" = { - name = "detective"; - packageName = "detective"; - version = "5.2.0"; - src = fetchurl { - url = "https://registry.npmjs.org/detective/-/detective-5.2.0.tgz"; - sha512 = "6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg=="; - }; - }; - "diffie-hellman-5.0.3" = { - name = "diffie-hellman"; - packageName = "diffie-hellman"; - version = "5.0.3"; - src = fetchurl { - url = "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz"; - sha512 = "kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg=="; - }; - }; - "domain-browser-1.2.0" = { - name = "domain-browser"; - packageName = "domain-browser"; - version = "1.2.0"; - src = fetchurl { - url = "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz"; - sha512 = "jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA=="; - }; - }; - "duplexer2-0.1.4" = { - name = "duplexer2"; - packageName = "duplexer2"; - version = "0.1.4"; - src = fetchurl { - url = "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz"; - sha1 = "8b12dab878c0d69e3e7891051662a32fc6bddcc1"; - }; - }; - "elliptic-6.5.4" = { - name = "elliptic"; - packageName = "elliptic"; - version = "6.5.4"; - src = fetchurl { - url = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz"; - sha512 = "iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ=="; - }; - }; - "es6-promise-3.3.1" = { - name = "es6-promise"; - packageName = "es6-promise"; - version = "3.3.1"; - src = fetchurl { - url = "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz"; - sha1 = "a08cdde84ccdbf34d027a1451bc91d4bcd28a613"; - }; - }; - "events-2.1.0" = { - name = "events"; - packageName = "events"; - version = "2.1.0"; - src = fetchurl { - url = "https://registry.npmjs.org/events/-/events-2.1.0.tgz"; - sha512 = "3Zmiobend8P9DjmKAty0Era4jV8oJ0yGYe2nJJAxgymF9+N8F2m0hhZiMoWtcfepExzNKZumFU3ksdQbInGWCg=="; - }; - }; - "evp_bytestokey-1.0.3" = { - name = "evp_bytestokey"; - packageName = "evp_bytestokey"; - version = "1.0.3"; - src = fetchurl { - url = "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz"; - sha512 = "/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA=="; - }; - }; - "fast-safe-stringify-2.1.1" = { - name = "fast-safe-stringify"; - packageName = "fast-safe-stringify"; - version = "2.1.1"; - src = fetchurl { - url = "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz"; - sha512 = "W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA=="; - }; - }; - "fs.realpath-1.0.0" = { - name = "fs.realpath"; - packageName = "fs.realpath"; - version = "1.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"; - sha1 = "1504ad2523158caa40db4a2787cb01411994ea4f"; - }; - }; - "function-bind-1.1.1" = { - name = "function-bind"; - packageName = "function-bind"; - version = "1.1.1"; - src = fetchurl { - url = "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"; - sha512 = "yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="; - }; - }; - "gaze-1.1.3" = { - name = "gaze"; - packageName = "gaze"; - version = "1.1.3"; - src = fetchurl { - url = "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz"; - sha512 = "BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g=="; - }; - }; - "get-assigned-identifiers-1.2.0" = { - name = "get-assigned-identifiers"; - packageName = "get-assigned-identifiers"; - version = "1.2.0"; - src = fetchurl { - url = "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz"; - sha512 = "mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ=="; - }; - }; - "glob-7.1.7" = { - name = "glob"; - packageName = "glob"; - version = "7.1.7"; - src = fetchurl { - url = "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz"; - sha512 = "OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ=="; - }; - }; - "glob-7.2.0" = { - name = "glob"; - packageName = "glob"; - version = "7.2.0"; - src = fetchurl { - url = "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz"; - sha512 = "lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q=="; - }; - }; - "globule-1.3.3" = { - name = "globule"; - packageName = "globule"; - version = "1.3.3"; - src = fetchurl { - url = "https://registry.npmjs.org/globule/-/globule-1.3.3.tgz"; - sha512 = "mb1aYtDbIjTu4ShMB85m3UzjX9BVKe9WCzsnfMSZk+K5GpIbBOexgg4PPCt5eHDEG5/ZQAUX2Kct02zfiPLsKg=="; - }; - }; - "graceful-fs-4.2.9" = { - name = "graceful-fs"; - packageName = "graceful-fs"; - version = "4.2.9"; - src = fetchurl { - url = "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz"; - sha512 = "NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ=="; - }; - }; - "has-1.0.3" = { - name = "has"; - packageName = "has"; - version = "1.0.3"; - src = fetchurl { - url = "https://registry.npmjs.org/has/-/has-1.0.3.tgz"; - sha512 = "f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw=="; - }; - }; - "hash-base-3.1.0" = { - name = "hash-base"; - packageName = "hash-base"; - version = "3.1.0"; - src = fetchurl { - url = "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz"; - sha512 = "1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA=="; - }; - }; - "hash.js-1.1.7" = { - name = "hash.js"; - packageName = "hash.js"; - version = "1.1.7"; - src = fetchurl { - url = "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz"; - sha512 = "taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA=="; - }; - }; - "hmac-drbg-1.0.1" = { - name = "hmac-drbg"; - packageName = "hmac-drbg"; - version = "1.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz"; - sha1 = "d2745701025a6c775a6c545793ed502fc0c649a1"; - }; - }; - "htmlescape-1.1.1" = { - name = "htmlescape"; - packageName = "htmlescape"; - version = "1.1.1"; - src = fetchurl { - url = "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz"; - sha1 = "3a03edc2214bca3b66424a3e7959349509cb0351"; - }; - }; - "https-browserify-1.0.0" = { - name = "https-browserify"; - packageName = "https-browserify"; - version = "1.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz"; - sha1 = "ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73"; - }; - }; - "ieee754-1.2.1" = { - name = "ieee754"; - packageName = "ieee754"; - version = "1.2.1"; - src = fetchurl { - url = "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz"; - sha512 = "dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="; - }; - }; - "inflight-1.0.6" = { - name = "inflight"; - packageName = "inflight"; - version = "1.0.6"; - src = fetchurl { - url = "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz"; - sha1 = "49bd6331d7d02d0c09bc910a1075ba8165b56df9"; - }; - }; - "inherits-2.0.1" = { - name = "inherits"; - packageName = "inherits"; - version = "2.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"; - sha1 = "b17d08d326b4423e568eff719f91b0b1cbdf69f1"; - }; - }; - "inherits-2.0.3" = { - name = "inherits"; - packageName = "inherits"; - version = "2.0.3"; - src = fetchurl { - url = "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"; - sha1 = "633c2c83e3da42a502f52466022480f4208261de"; - }; - }; - "inherits-2.0.4" = { - name = "inherits"; - packageName = "inherits"; - version = "2.0.4"; - src = fetchurl { - url = "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz"; - sha512 = "k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="; - }; - }; - "inline-source-map-0.6.2" = { - name = "inline-source-map"; - packageName = "inline-source-map"; - version = "0.6.2"; - src = fetchurl { - url = "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.2.tgz"; - sha1 = "f9393471c18a79d1724f863fa38b586370ade2a5"; - }; - }; - "insert-module-globals-7.2.1" = { - name = "insert-module-globals"; - packageName = "insert-module-globals"; - version = "7.2.1"; - src = fetchurl { - url = "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.1.tgz"; - sha512 = "ufS5Qq9RZN+Bu899eA9QCAYThY+gGW7oRkmb0vC93Vlyu/CFGcH0OYPEjVkDXA5FEbTt1+VWzdoOD3Ny9N+8tg=="; - }; - }; - "is-buffer-1.1.6" = { - name = "is-buffer"; - packageName = "is-buffer"; - version = "1.1.6"; - src = fetchurl { - url = "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz"; - sha512 = "NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="; - }; - }; - "is-core-module-2.8.1" = { - name = "is-core-module"; - packageName = "is-core-module"; - version = "2.8.1"; - src = fetchurl { - url = "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz"; - sha512 = "SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA=="; - }; - }; - "isarray-1.0.0" = { - name = "isarray"; - packageName = "isarray"; - version = "1.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"; - sha1 = "bb935d48582cba168c06834957a54a3e07124f11"; - }; - }; - "isexe-2.0.0" = { - name = "isexe"; - packageName = "isexe"; - version = "2.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz"; - sha1 = "e8fbf374dc556ff8947a10dcb0572d633f2cfa10"; - }; - }; - "json-stable-stringify-0.0.1" = { - name = "json-stable-stringify"; - packageName = "json-stable-stringify"; - version = "0.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz"; - sha1 = "611c23e814db375527df851193db59dd2af27f45"; - }; - }; - "jsonify-0.0.0" = { - name = "jsonify"; - packageName = "jsonify"; - version = "0.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz"; - sha1 = "2c74b6ee41d93ca51b7b5aaee8f503631d252a73"; - }; - }; - "jsonparse-0.0.5" = { - name = "jsonparse"; - packageName = "jsonparse"; - version = "0.0.5"; - src = fetchurl { - url = "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz"; - sha1 = "330542ad3f0a654665b778f3eb2d9a9fa507ac64"; - }; - }; - "jsonparse-1.3.1" = { - name = "jsonparse"; - packageName = "jsonparse"; - version = "1.3.1"; - src = fetchurl { - url = "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz"; - sha1 = "3f4dae4a91fac315f71062f8521cc239f1366280"; - }; - }; - "labeled-stream-splicer-2.0.2" = { - name = "labeled-stream-splicer"; - packageName = "labeled-stream-splicer"; - version = "2.0.2"; - src = fetchurl { - url = "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz"; - sha512 = "Ca4LSXFFZUjPScRaqOcFxneA0VpKZr4MMYCljyQr4LIewTLb3Y0IUTIsnBBsVubIeEfxeSZpSjSsRM8APEQaAw=="; - }; - }; - "lodash-4.17.21" = { - name = "lodash"; - packageName = "lodash"; - version = "4.17.21"; - src = fetchurl { - url = "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"; - sha512 = "v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="; - }; - }; - "lodash.memoize-3.0.4" = { - name = "lodash.memoize"; - packageName = "lodash.memoize"; - version = "3.0.4"; - src = fetchurl { - url = "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz"; - sha1 = "2dcbd2c287cbc0a55cc42328bd0c736150d53e3f"; - }; - }; - "md5.js-1.3.5" = { - name = "md5.js"; - packageName = "md5.js"; - version = "1.3.5"; - src = fetchurl { - url = "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz"; - sha512 = "xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg=="; - }; - }; - "miller-rabin-4.0.1" = { - name = "miller-rabin"; - packageName = "miller-rabin"; - version = "4.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz"; - sha512 = "115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA=="; - }; - }; - "mime-1.6.0" = { - name = "mime"; - packageName = "mime"; - version = "1.6.0"; - src = fetchurl { - url = "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz"; - sha512 = "x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="; - }; - }; - "minimalistic-assert-1.0.1" = { - name = "minimalistic-assert"; - packageName = "minimalistic-assert"; - version = "1.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz"; - sha512 = "UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="; - }; - }; - "minimalistic-crypto-utils-1.0.1" = { - name = "minimalistic-crypto-utils"; - packageName = "minimalistic-crypto-utils"; - version = "1.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz"; - sha1 = "f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"; - }; - }; - "minimatch-3.0.8" = { - name = "minimatch"; - packageName = "minimatch"; - version = "3.0.8"; - src = fetchurl { - url = "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz"; - sha512 = "6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q=="; - }; - }; - "minimist-0.0.10" = { - name = "minimist"; - packageName = "minimist"; - version = "0.0.10"; - src = fetchurl { - url = "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz"; - sha1 = "de3f98543dbf96082be48ad1a0c7cda836301dcf"; - }; - }; - "minimist-1.2.6" = { - name = "minimist"; - packageName = "minimist"; - version = "1.2.6"; - src = fetchurl { - url = "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz"; - sha512 = "Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="; - }; - }; - "mkdirp-0.5.6" = { - name = "mkdirp"; - packageName = "mkdirp"; - version = "0.5.6"; - src = fetchurl { - url = "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz"; - sha512 = "FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw=="; - }; - }; - "mkdirp-classic-0.5.3" = { - name = "mkdirp-classic"; - packageName = "mkdirp-classic"; - version = "0.5.3"; - src = fetchurl { - url = "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz"; - sha512 = "gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="; - }; - }; - "module-deps-6.2.3" = { - name = "module-deps"; - packageName = "module-deps"; - version = "6.2.3"; - src = fetchurl { - url = "https://registry.npmjs.org/module-deps/-/module-deps-6.2.3.tgz"; - sha512 = "fg7OZaQBcL4/L+AK5f4iVqf9OMbCclXfy/znXRxTVhJSeW5AIlS9AwheYwDaXM3lVW7OBeaeUEY3gbaC6cLlSA=="; - }; - }; - "mold-source-map-0.4.0" = { - name = "mold-source-map"; - packageName = "mold-source-map"; - version = "0.4.0"; - src = fetchurl { - url = "https://registry.npmjs.org/mold-source-map/-/mold-source-map-0.4.0.tgz"; - sha1 = "cf67e0b31c47ab9badb5c9c25651862127bb8317"; - }; - }; - "mute-stream-0.0.8" = { - name = "mute-stream"; - packageName = "mute-stream"; - version = "0.0.8"; - src = fetchurl { - url = "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz"; - sha512 = "nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA=="; - }; - }; - "node-static-0.7.11" = { - name = "node-static"; - packageName = "node-static"; - version = "0.7.11"; - src = fetchurl { - url = "https://registry.npmjs.org/node-static/-/node-static-0.7.11.tgz"; - sha512 = "zfWC/gICcqb74D9ndyvxZWaI1jzcoHmf4UTHWQchBNuNMxdBLJMDiUgZ1tjGLEIe/BMhj2DxKD8HOuc2062pDQ=="; - }; - }; - "object-assign-4.1.1" = { - name = "object-assign"; - packageName = "object-assign"; - version = "4.1.1"; - src = fetchurl { - url = "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz"; - sha1 = "2109adc7965887cfc05cbbd442cac8bfbb360863"; - }; - }; - "once-1.4.0" = { - name = "once"; - packageName = "once"; - version = "1.4.0"; - src = fetchurl { - url = "https://registry.npmjs.org/once/-/once-1.4.0.tgz"; - sha1 = "583b1aa775961d4b113ac17d9c50baef9dd76bd1"; - }; - }; - "optimist-0.6.1" = { - name = "optimist"; - packageName = "optimist"; - version = "0.6.1"; - src = fetchurl { - url = "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz"; - sha1 = "da3ea74686fa21a19a111c326e90eb15a0196686"; - }; - }; - "os-browserify-0.3.0" = { - name = "os-browserify"; - packageName = "os-browserify"; - version = "0.3.0"; - src = fetchurl { - url = "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz"; - sha1 = "854373c7f5c2315914fc9bfc6bd8238fdda1ec27"; - }; - }; - "pako-1.0.11" = { - name = "pako"; - packageName = "pako"; - version = "1.0.11"; - src = fetchurl { - url = "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz"; - sha512 = "4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="; - }; - }; - "parents-1.0.1" = { - name = "parents"; - packageName = "parents"; - version = "1.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz"; - sha1 = "fedd4d2bf193a77745fe71e371d73c3307d9c751"; - }; - }; - "parse-asn1-5.1.6" = { - name = "parse-asn1"; - packageName = "parse-asn1"; - version = "5.1.6"; - src = fetchurl { - url = "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz"; - sha512 = "RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw=="; - }; - }; - "path-browserify-0.0.1" = { - name = "path-browserify"; - packageName = "path-browserify"; - version = "0.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz"; - sha512 = "BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ=="; - }; - }; - "path-is-absolute-1.0.1" = { - name = "path-is-absolute"; - packageName = "path-is-absolute"; - version = "1.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz"; - sha1 = "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"; - }; - }; - "path-parse-1.0.7" = { - name = "path-parse"; - packageName = "path-parse"; - version = "1.0.7"; - src = fetchurl { - url = "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz"; - sha512 = "LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="; - }; - }; - "path-platform-0.11.15" = { - name = "path-platform"; - packageName = "path-platform"; - version = "0.11.15"; - src = fetchurl { - url = "https://registry.npmjs.org/path-platform/-/path-platform-0.11.15.tgz"; - sha1 = "e864217f74c36850f0852b78dc7bf7d4a5721bf2"; - }; - }; - "pbkdf2-3.1.2" = { - name = "pbkdf2"; - packageName = "pbkdf2"; - version = "3.1.2"; - src = fetchurl { - url = "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz"; - sha512 = "iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA=="; - }; - }; - "process-0.11.10" = { - name = "process"; - packageName = "process"; - version = "0.11.10"; - src = fetchurl { - url = "https://registry.npmjs.org/process/-/process-0.11.10.tgz"; - sha1 = "7332300e840161bda3e69a1d1d91a7d4bc16f182"; - }; - }; - "process-nextick-args-2.0.1" = { - name = "process-nextick-args"; - packageName = "process-nextick-args"; - version = "2.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz"; - sha512 = "3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="; - }; - }; - "public-encrypt-4.0.3" = { - name = "public-encrypt"; - packageName = "public-encrypt"; - version = "4.0.3"; - src = fetchurl { - url = "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz"; - sha512 = "zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q=="; - }; - }; - "pulp-16.0.0-0" = { - name = "pulp"; - packageName = "pulp"; - version = "16.0.0-0"; - src = fetchurl { - url = "https://registry.npmjs.org/pulp/-/pulp-16.0.0-0.tgz"; - sha512 = "6nG6qg/p5IGa0k4w9EkBVBX3+7Ra1mjbOCYwbn85kjUC6x1jkyP+hAP7xAwBxTPgxSD8x5IZtoX9sbrNeKecnQ=="; - }; - }; - "punycode-1.3.2" = { - name = "punycode"; - packageName = "punycode"; - version = "1.3.2"; - src = fetchurl { - url = "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz"; - sha1 = "9653a036fb7c1ee42342f2325cceefea3926c48d"; - }; - }; - "punycode-1.4.1" = { - name = "punycode"; - packageName = "punycode"; - version = "1.4.1"; - src = fetchurl { - url = "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz"; - sha1 = "c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"; - }; - }; - "querystring-0.2.0" = { - name = "querystring"; - packageName = "querystring"; - version = "0.2.0"; - src = fetchurl { - url = "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz"; - sha1 = "b209849203bb25df820da756e747005878521620"; - }; - }; - "querystring-es3-0.2.1" = { - name = "querystring-es3"; - packageName = "querystring-es3"; - version = "0.2.1"; - src = fetchurl { - url = "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz"; - sha1 = "9ec61f79049875707d69414596fd907a4d711e73"; - }; - }; - "randombytes-2.1.0" = { - name = "randombytes"; - packageName = "randombytes"; - version = "2.1.0"; - src = fetchurl { - url = "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz"; - sha512 = "vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ=="; - }; - }; - "randomfill-1.0.4" = { - name = "randomfill"; - packageName = "randomfill"; - version = "1.0.4"; - src = fetchurl { - url = "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz"; - sha512 = "87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw=="; - }; - }; - "read-1.0.7" = { - name = "read"; - packageName = "read"; - version = "1.0.7"; - src = fetchurl { - url = "https://registry.npmjs.org/read/-/read-1.0.7.tgz"; - sha1 = "b3da19bd052431a97671d44a42634adf710b40c4"; - }; - }; - "read-only-stream-2.0.0" = { - name = "read-only-stream"; - packageName = "read-only-stream"; - version = "2.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/read-only-stream/-/read-only-stream-2.0.0.tgz"; - sha1 = "2724fd6a8113d73764ac288d4386270c1dbf17f0"; - }; - }; - "readable-stream-2.3.7" = { - name = "readable-stream"; - packageName = "readable-stream"; - version = "2.3.7"; - src = fetchurl { - url = "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz"; - sha512 = "Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw=="; - }; - }; - "readable-stream-3.6.0" = { - name = "readable-stream"; - packageName = "readable-stream"; - version = "3.6.0"; - src = fetchurl { - url = "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz"; - sha512 = "BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA=="; - }; - }; - "resolve-1.22.0" = { - name = "resolve"; - packageName = "resolve"; - version = "1.22.0"; - src = fetchurl { - url = "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz"; - sha512 = "Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw=="; - }; - }; - "rimraf-2.6.3" = { - name = "rimraf"; - packageName = "rimraf"; - version = "2.6.3"; - src = fetchurl { - url = "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz"; - sha512 = "mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA=="; - }; - }; - "rimraf-2.7.1" = { - name = "rimraf"; - packageName = "rimraf"; - version = "2.7.1"; - src = fetchurl { - url = "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz"; - sha512 = "uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w=="; - }; - }; - "ripemd160-2.0.2" = { - name = "ripemd160"; - packageName = "ripemd160"; - version = "2.0.2"; - src = fetchurl { - url = "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz"; - sha512 = "ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA=="; - }; - }; - "safe-buffer-5.1.2" = { - name = "safe-buffer"; - packageName = "safe-buffer"; - version = "5.1.2"; - src = fetchurl { - url = "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz"; - sha512 = "Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="; - }; - }; - "safe-buffer-5.2.1" = { - name = "safe-buffer"; - packageName = "safe-buffer"; - version = "5.2.1"; - src = fetchurl { - url = "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz"; - sha512 = "rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="; - }; - }; - "safer-buffer-2.1.2" = { - name = "safer-buffer"; - packageName = "safer-buffer"; - version = "2.1.2"; - src = fetchurl { - url = "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz"; - sha512 = "YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="; - }; - }; - "sander-0.5.1" = { - name = "sander"; - packageName = "sander"; - version = "0.5.1"; - src = fetchurl { - url = "https://registry.npmjs.org/sander/-/sander-0.5.1.tgz"; - sha1 = "741e245e231f07cafb6fdf0f133adfa216a502ad"; - }; - }; - "sha.js-2.4.11" = { - name = "sha.js"; - packageName = "sha.js"; - version = "2.4.11"; - src = fetchurl { - url = "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz"; - sha512 = "QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ=="; - }; - }; - "shasum-1.0.2" = { - name = "shasum"; - packageName = "shasum"; - version = "1.0.2"; - src = fetchurl { - url = "https://registry.npmjs.org/shasum/-/shasum-1.0.2.tgz"; - sha1 = "e7012310d8f417f4deb5712150e5678b87ae565f"; - }; - }; - "shasum-object-1.0.0" = { - name = "shasum-object"; - packageName = "shasum-object"; - version = "1.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/shasum-object/-/shasum-object-1.0.0.tgz"; - sha512 = "Iqo5rp/3xVi6M4YheapzZhhGPVs0yZwHj7wvwQ1B9z8H6zk+FEnI7y3Teq7qwnekfEhu8WmG2z0z4iWZaxLWVg=="; - }; - }; - "shell-quote-1.7.3" = { - name = "shell-quote"; - packageName = "shell-quote"; - version = "1.7.3"; - src = fetchurl { - url = "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz"; - sha512 = "Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw=="; - }; - }; - "simple-concat-1.0.1" = { - name = "simple-concat"; - packageName = "simple-concat"; - version = "1.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz"; - sha512 = "cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q=="; - }; - }; - "sorcery-0.10.0" = { - name = "sorcery"; - packageName = "sorcery"; - version = "0.10.0"; - src = fetchurl { - url = "https://registry.npmjs.org/sorcery/-/sorcery-0.10.0.tgz"; - sha1 = "8ae90ad7d7cb05fc59f1ab0c637845d5c15a52b7"; - }; - }; - "source-map-0.5.7" = { - name = "source-map"; - packageName = "source-map"; - version = "0.5.7"; - src = fetchurl { - url = "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz"; - sha1 = "8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"; - }; - }; - "sourcemap-codec-1.4.8" = { - name = "sourcemap-codec"; - packageName = "sourcemap-codec"; - version = "1.4.8"; - src = fetchurl { - url = "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz"; - sha512 = "9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA=="; - }; - }; - "stream-browserify-2.0.2" = { - name = "stream-browserify"; - packageName = "stream-browserify"; - version = "2.0.2"; - src = fetchurl { - url = "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz"; - sha512 = "nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg=="; - }; - }; - "stream-combiner2-1.1.1" = { - name = "stream-combiner2"; - packageName = "stream-combiner2"; - version = "1.1.1"; - src = fetchurl { - url = "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz"; - sha1 = "fb4d8a1420ea362764e21ad4780397bebcb41cbe"; - }; - }; - "stream-http-3.2.0" = { - name = "stream-http"; - packageName = "stream-http"; - version = "3.2.0"; - src = fetchurl { - url = "https://registry.npmjs.org/stream-http/-/stream-http-3.2.0.tgz"; - sha512 = "Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A=="; - }; - }; - "stream-splicer-2.0.1" = { - name = "stream-splicer"; - packageName = "stream-splicer"; - version = "2.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.1.tgz"; - sha512 = "Xizh4/NPuYSyAXyT7g8IvdJ9HJpxIGL9PjyhtywCZvvP0OPIdqyrr4dMikeuvY8xahpdKEBlBTySe583totajg=="; - }; - }; - "string_decoder-1.1.1" = { - name = "string_decoder"; - packageName = "string_decoder"; - version = "1.1.1"; - src = fetchurl { - url = "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz"; - sha512 = "n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="; - }; - }; - "string_decoder-1.3.0" = { - name = "string_decoder"; - packageName = "string_decoder"; - version = "1.3.0"; - src = fetchurl { - url = "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz"; - sha512 = "hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="; - }; - }; - "subarg-1.0.0" = { - name = "subarg"; - packageName = "subarg"; - version = "1.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz"; - sha1 = "f62cf17581e996b48fc965699f54c06ae268b8d2"; - }; - }; - "supports-preserve-symlinks-flag-1.0.0" = { - name = "supports-preserve-symlinks-flag"; - packageName = "supports-preserve-symlinks-flag"; - version = "1.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz"; - sha512 = "ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="; - }; - }; - "syntax-error-1.4.0" = { - name = "syntax-error"; - packageName = "syntax-error"; - version = "1.4.0"; - src = fetchurl { - url = "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz"; - sha512 = "YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w=="; - }; - }; - "temp-0.9.4" = { - name = "temp"; - packageName = "temp"; - version = "0.9.4"; - src = fetchurl { - url = "https://registry.npmjs.org/temp/-/temp-0.9.4.tgz"; - sha512 = "yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA=="; - }; - }; - "through-2.2.7" = { - name = "through"; - packageName = "through"; - version = "2.2.7"; - src = fetchurl { - url = "https://registry.npmjs.org/through/-/through-2.2.7.tgz"; - sha1 = "6e8e21200191d4eb6a99f6f010df46aa1c6eb2bd"; - }; - }; - "through-2.3.8" = { - name = "through"; - packageName = "through"; - version = "2.3.8"; - src = fetchurl { - url = "https://registry.npmjs.org/through/-/through-2.3.8.tgz"; - sha1 = "0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"; - }; - }; - "through2-2.0.5" = { - name = "through2"; - packageName = "through2"; - version = "2.0.5"; - src = fetchurl { - url = "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz"; - sha512 = "/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ=="; - }; - }; - "timers-browserify-1.4.2" = { - name = "timers-browserify"; - packageName = "timers-browserify"; - version = "1.4.2"; - src = fetchurl { - url = "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz"; - sha1 = "c9c58b575be8407375cb5e2462dacee74359f41d"; - }; - }; - "tree-kill-1.2.2" = { - name = "tree-kill"; - packageName = "tree-kill"; - version = "1.2.2"; - src = fetchurl { - url = "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz"; - sha512 = "L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A=="; - }; - }; - "tty-browserify-0.0.1" = { - name = "tty-browserify"; - packageName = "tty-browserify"; - version = "0.0.1"; - src = fetchurl { - url = "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz"; - sha512 = "C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw=="; - }; - }; - "typedarray-0.0.6" = { - name = "typedarray"; - packageName = "typedarray"; - version = "0.0.6"; - src = fetchurl { - url = "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz"; - sha1 = "867ac74e3864187b1d3d47d996a78ec5c8830777"; - }; - }; - "umd-3.0.3" = { - name = "umd"; - packageName = "umd"; - version = "3.0.3"; - src = fetchurl { - url = "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz"; - sha512 = "4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow=="; - }; - }; - "undeclared-identifiers-1.1.3" = { - name = "undeclared-identifiers"; - packageName = "undeclared-identifiers"; - version = "1.1.3"; - src = fetchurl { - url = "https://registry.npmjs.org/undeclared-identifiers/-/undeclared-identifiers-1.1.3.tgz"; - sha512 = "pJOW4nxjlmfwKApE4zvxLScM/njmwj/DiUBv7EabwE4O8kRUy+HIwxQtZLBPll/jx1LJyBcqNfB3/cpv9EZwOw=="; - }; - }; - "url-0.11.0" = { - name = "url"; - packageName = "url"; - version = "0.11.0"; - src = fetchurl { - url = "https://registry.npmjs.org/url/-/url-0.11.0.tgz"; - sha1 = "3838e97cfc60521eb73c525a8e55bfdd9e2e28f1"; - }; - }; - "util-0.10.3" = { - name = "util"; - packageName = "util"; - version = "0.10.3"; - src = fetchurl { - url = "https://registry.npmjs.org/util/-/util-0.10.3.tgz"; - sha1 = "7afb1afe50805246489e3db7fe0ed379336ac0f9"; - }; - }; - "util-0.10.4" = { - name = "util"; - packageName = "util"; - version = "0.10.4"; - src = fetchurl { - url = "https://registry.npmjs.org/util/-/util-0.10.4.tgz"; - sha512 = "0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A=="; - }; - }; - "util-deprecate-1.0.2" = { - name = "util-deprecate"; - packageName = "util-deprecate"; - version = "1.0.2"; - src = fetchurl { - url = "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"; - sha1 = "450d4dc9fa70de732762fbd2d4a28981419a0ccf"; - }; - }; - "vm-browserify-1.1.2" = { - name = "vm-browserify"; - packageName = "vm-browserify"; - version = "1.1.2"; - src = fetchurl { - url = "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz"; - sha512 = "2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ=="; - }; - }; - "which-1.3.1" = { - name = "which"; - packageName = "which"; - version = "1.3.1"; - src = fetchurl { - url = "https://registry.npmjs.org/which/-/which-1.3.1.tgz"; - sha512 = "HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ=="; - }; - }; - "wordwrap-0.0.3" = { - name = "wordwrap"; - packageName = "wordwrap"; - version = "0.0.3"; - src = fetchurl { - url = "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz"; - sha1 = "a3d5da6cd5c0bc0008d37234bbaf1bed63059107"; - }; - }; - "wordwrap-1.0.0" = { - name = "wordwrap"; - packageName = "wordwrap"; - version = "1.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz"; - sha1 = "27584810891456a4171c8d0226441ade90cbcaeb"; - }; - }; - "wrappy-1.0.2" = { - name = "wrappy"; - packageName = "wrappy"; - version = "1.0.2"; - src = fetchurl { - url = "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"; - sha1 = "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"; - }; - }; - "xtend-4.0.2" = { - name = "xtend"; - packageName = "xtend"; - version = "4.0.2"; - src = fetchurl { - url = "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz"; - sha512 = "LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="; - }; - }; - }; - args = { - name = "pulp"; - packageName = "pulp"; - version = "v16.0.0-0"; - src = ./.; - dependencies = [ - sources."JSONStream-1.3.5" - sources."acorn-7.4.1" - sources."acorn-node-1.8.2" - sources."acorn-walk-7.2.0" - (sources."asn1.js-5.4.1" // { - dependencies = [ - sources."bn.js-4.12.0" - ]; - }) - (sources."assert-1.5.0" // { - dependencies = [ - sources."inherits-2.0.1" - sources."util-0.10.3" - ]; - }) - sources."async-1.5.2" - sources."balanced-match-1.0.2" - sources."base64-js-1.5.1" - sources."bn.js-5.2.0" - sources."brace-expansion-1.1.11" - sources."brorand-1.1.0" - sources."browser-pack-6.1.0" - sources."browser-resolve-2.0.0" - (sources."browserify-16.5.2" // { - dependencies = [ - sources."concat-stream-1.6.2" - ]; - }) - sources."browserify-aes-1.2.0" - sources."browserify-cache-api-3.0.1" - sources."browserify-cipher-1.0.1" - sources."browserify-des-1.0.2" - (sources."browserify-incremental-3.1.1" // { - dependencies = [ - sources."JSONStream-0.10.0" - sources."jsonparse-0.0.5" - ]; - }) - sources."browserify-rsa-4.1.0" - (sources."browserify-sign-4.2.1" // { - dependencies = [ - sources."readable-stream-3.6.0" - ]; - }) - sources."browserify-zlib-0.2.0" - sources."buffer-5.2.1" - sources."buffer-crc32-0.2.13" - sources."buffer-from-1.1.2" - sources."buffer-xor-1.0.3" - sources."builtin-status-codes-3.0.0" - sources."cached-path-relative-1.1.0" - sources."cipher-base-1.0.4" - sources."colors-1.4.0" - sources."combine-source-map-0.8.0" - sources."concat-map-0.0.1" - (sources."concat-stream-2.0.0" // { - dependencies = [ - sources."readable-stream-3.6.0" - ]; - }) - sources."console-browserify-1.2.0" - sources."constants-browserify-1.0.0" - sources."convert-source-map-1.1.3" - sources."core-util-is-1.0.3" - (sources."create-ecdh-4.0.4" // { - dependencies = [ - sources."bn.js-4.12.0" - ]; - }) - sources."create-hash-1.2.0" - sources."create-hmac-1.1.7" - sources."crypto-browserify-3.12.0" - sources."dash-ast-1.0.0" - sources."defined-1.0.0" - sources."deps-sort-2.0.1" - sources."des.js-1.0.1" - sources."detective-5.2.0" - (sources."diffie-hellman-5.0.3" // { - dependencies = [ - sources."bn.js-4.12.0" - ]; - }) - sources."domain-browser-1.2.0" - sources."duplexer2-0.1.4" - (sources."elliptic-6.5.4" // { - dependencies = [ - sources."bn.js-4.12.0" - ]; - }) - sources."es6-promise-3.3.1" - sources."events-2.1.0" - sources."evp_bytestokey-1.0.3" - sources."fast-safe-stringify-2.1.1" - sources."fs.realpath-1.0.0" - sources."function-bind-1.1.1" - sources."gaze-1.1.3" - sources."get-assigned-identifiers-1.2.0" - sources."glob-7.2.0" - (sources."globule-1.3.3" // { - dependencies = [ - sources."glob-7.1.7" - ]; - }) - sources."graceful-fs-4.2.9" - sources."has-1.0.3" - (sources."hash-base-3.1.0" // { - dependencies = [ - sources."readable-stream-3.6.0" - ]; - }) - sources."hash.js-1.1.7" - sources."hmac-drbg-1.0.1" - sources."htmlescape-1.1.1" - sources."https-browserify-1.0.0" - sources."ieee754-1.2.1" - sources."inflight-1.0.6" - sources."inherits-2.0.4" - sources."inline-source-map-0.6.2" - (sources."insert-module-globals-7.2.1" // { - dependencies = [ - sources."concat-stream-1.6.2" - ]; - }) - sources."is-buffer-1.1.6" - sources."is-core-module-2.8.1" - sources."isarray-1.0.0" - sources."isexe-2.0.0" - sources."json-stable-stringify-0.0.1" - sources."jsonify-0.0.0" - sources."jsonparse-1.3.1" - sources."labeled-stream-splicer-2.0.2" - sources."lodash-4.17.21" - sources."lodash.memoize-3.0.4" - sources."md5.js-1.3.5" - (sources."miller-rabin-4.0.1" // { - dependencies = [ - sources."bn.js-4.12.0" - ]; - }) - sources."mime-1.6.0" - sources."minimalistic-assert-1.0.1" - sources."minimalistic-crypto-utils-1.0.1" - sources."minimatch-3.0.8" - sources."minimist-1.2.6" - sources."mkdirp-0.5.6" - sources."mkdirp-classic-0.5.3" - (sources."module-deps-6.2.3" // { - dependencies = [ - sources."concat-stream-1.6.2" - ]; - }) - (sources."mold-source-map-0.4.0" // { - dependencies = [ - sources."through-2.2.7" - ]; - }) - sources."mute-stream-0.0.8" - sources."node-static-0.7.11" - sources."object-assign-4.1.1" - sources."once-1.4.0" - (sources."optimist-0.6.1" // { - dependencies = [ - sources."minimist-0.0.10" - sources."wordwrap-0.0.3" - ]; - }) - sources."os-browserify-0.3.0" - sources."pako-1.0.11" - sources."parents-1.0.1" - sources."parse-asn1-5.1.6" - sources."path-browserify-0.0.1" - sources."path-is-absolute-1.0.1" - sources."path-parse-1.0.7" - sources."path-platform-0.11.15" - sources."pbkdf2-3.1.2" - sources."process-0.11.10" - sources."process-nextick-args-2.0.1" - (sources."public-encrypt-4.0.3" // { - dependencies = [ - sources."bn.js-4.12.0" - ]; - }) - sources."pulp-16.0.0-0" - sources."punycode-1.4.1" - sources."querystring-0.2.0" - sources."querystring-es3-0.2.1" - sources."randombytes-2.1.0" - sources."randomfill-1.0.4" - sources."read-1.0.7" - sources."read-only-stream-2.0.0" - (sources."readable-stream-2.3.7" // { - dependencies = [ - sources."safe-buffer-5.1.2" - sources."string_decoder-1.1.1" - ]; - }) - sources."resolve-1.22.0" - sources."rimraf-2.7.1" - sources."ripemd160-2.0.2" - sources."safe-buffer-5.2.1" - sources."safer-buffer-2.1.2" - sources."sander-0.5.1" - sources."sha.js-2.4.11" - sources."shasum-1.0.2" - sources."shasum-object-1.0.0" - sources."shell-quote-1.7.3" - sources."simple-concat-1.0.1" - sources."sorcery-0.10.0" - sources."source-map-0.5.7" - sources."sourcemap-codec-1.4.8" - sources."stream-browserify-2.0.2" - sources."stream-combiner2-1.1.1" - (sources."stream-http-3.2.0" // { - dependencies = [ - sources."readable-stream-3.6.0" - ]; - }) - sources."stream-splicer-2.0.1" - sources."string_decoder-1.3.0" - sources."subarg-1.0.0" - sources."supports-preserve-symlinks-flag-1.0.0" - sources."syntax-error-1.4.0" - (sources."temp-0.9.4" // { - dependencies = [ - sources."rimraf-2.6.3" - ]; - }) - sources."through-2.3.8" - sources."through2-2.0.5" - sources."timers-browserify-1.4.2" - sources."tree-kill-1.2.2" - sources."tty-browserify-0.0.1" - sources."typedarray-0.0.6" - sources."umd-3.0.3" - sources."undeclared-identifiers-1.1.3" - (sources."url-0.11.0" // { - dependencies = [ - sources."punycode-1.3.2" - ]; - }) - (sources."util-0.10.4" // { - dependencies = [ - sources."inherits-2.0.3" - ]; - }) - sources."util-deprecate-1.0.2" - sources."vm-browserify-1.1.2" - sources."which-1.3.1" - sources."wordwrap-1.0.0" - sources."wrappy-1.0.2" - sources."xtend-4.0.2" - ]; - buildInputs = globalBuildInputs; - meta = { - }; - production = true; - bypassCache = true; - reconstructLock = true; - }; -in -{ - args = args; - sources = sources; - tarball = nodeEnv.buildNodeSourceDist args; - package = nodeEnv.buildNodePackage args; - shell = nodeEnv.buildNodeShell args; - nodeDependencies = nodeEnv.buildNodeDependencies (lib.overrideExisting args { - src = stdenv.mkDerivation { - name = args.name + "-package-json"; - src = nix-gitignore.gitignoreSourcePure [ - "*" - "!package.json" - "!package-lock.json" - ] args.src; - dontBuild = true; - installPhase = "mkdir -p $out; cp -r ./* $out;"; - }; - }); -} diff --git a/pulp/16.0.0-0/package.json b/pulp/16.0.0-0/package.json deleted file mode 100644 index 3be720a..0000000 --- a/pulp/16.0.0-0/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "pulp", - "version": "v16.0.0-0", - "dependencies": { - "pulp":"v16.0.0-0" - } -} diff --git a/pulp/16.0.2/default.nix b/pulp/16.0.2/default.nix deleted file mode 100644 index 70303b3..0000000 --- a/pulp/16.0.2/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -# This file was not generated, it was actually copied from ../16.0.0-0/default.nix -# This file has been generated by node2nix 1.9.0. Do not edit! - -{ pkgs ? import { - inherit system; - } -, system ? builtins.currentSystem -, nodejs ? pkgs."nodejs-14_x" -}: - -let - nodeEnv = import ./node-env.nix { - inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; - inherit pkgs nodejs; - libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; - }; - - nodePackage = import ./node-packages.nix - { - inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; - inherit nodeEnv; - }; - - source = nodePackage.sources."pulp-16.0.2".src; -in -nodeEnv.buildNodePackage (nodePackage.args // { src = source; }) diff --git a/pulp/16.0.2/node-env.nix b/pulp/16.0.2/node-env.nix deleted file mode 100644 index 5f05578..0000000 --- a/pulp/16.0.2/node-env.nix +++ /dev/null @@ -1,588 +0,0 @@ -# This file originates from node2nix - -{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}: - -let - # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master - utillinux = if pkgs ? utillinux then pkgs.utillinux else pkgs.util-linux; - - python = if nodejs ? python then nodejs.python else python2; - - # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise - tarWrapper = runCommand "tarWrapper" {} '' - mkdir -p $out/bin - - cat > $out/bin/tar <> $out/nix-support/hydra-build-products - ''; - }; - - # Common shell logic - installPackage = writeShellScript "install-package" '' - installPackage() { - local packageName=$1 src=$2 - - local strippedName - - local DIR=$PWD - cd $TMPDIR - - unpackFile $src - - # Make the base dir in which the target dependency resides first - mkdir -p "$(dirname "$DIR/$packageName")" - - if [ -f "$src" ] - then - # Figure out what directory has been unpacked - packageDir="$(find . -maxdepth 1 -type d | tail -1)" - - # Restore write permissions to make building work - find "$packageDir" -type d -exec chmod u+x {} \; - chmod -R u+w "$packageDir" - - # Move the extracted tarball into the output folder - mv "$packageDir" "$DIR/$packageName" - elif [ -d "$src" ] - then - # Get a stripped name (without hash) of the source directory. - # On old nixpkgs it's already set internally. - if [ -z "$strippedName" ] - then - strippedName="$(stripHash $src)" - fi - - # Restore write permissions to make building work - chmod -R u+w "$strippedName" - - # Move the extracted directory into the output folder - mv "$strippedName" "$DIR/$packageName" - fi - - # Change to the package directory to install dependencies - cd "$DIR/$packageName" - } - ''; - - # Bundle the dependencies of the package - # - # Only include dependencies if they don't exist. They may also be bundled in the package. - includeDependencies = {dependencies}: - lib.optionalString (dependencies != []) ( - '' - mkdir -p node_modules - cd node_modules - '' - + (lib.concatMapStrings (dependency: - '' - if [ ! -e "${dependency.name}" ]; then - ${composePackage dependency} - fi - '' - ) dependencies) - + '' - cd .. - '' - ); - - # Recursively composes the dependencies of a package - composePackage = { name, packageName, src, dependencies ? [], ... }@args: - builtins.addErrorContext "while evaluating node package '${packageName}'" '' - installPackage "${packageName}" "${src}" - ${includeDependencies { inherit dependencies; }} - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - ''; - - pinpointDependencies = {dependencies, production}: - let - pinpointDependenciesFromPackageJSON = writeTextFile { - name = "pinpointDependencies.js"; - text = '' - var fs = require('fs'); - var path = require('path'); - - function resolveDependencyVersion(location, name) { - if(location == process.env['NIX_STORE']) { - return null; - } else { - var dependencyPackageJSON = path.join(location, "node_modules", name, "package.json"); - - if(fs.existsSync(dependencyPackageJSON)) { - var dependencyPackageObj = JSON.parse(fs.readFileSync(dependencyPackageJSON)); - - if(dependencyPackageObj.name == name) { - return dependencyPackageObj.version; - } - } else { - return resolveDependencyVersion(path.resolve(location, ".."), name); - } - } - } - - function replaceDependencies(dependencies) { - if(typeof dependencies == "object" && dependencies !== null) { - for(var dependency in dependencies) { - var resolvedVersion = resolveDependencyVersion(process.cwd(), dependency); - - if(resolvedVersion === null) { - process.stderr.write("WARNING: cannot pinpoint dependency: "+dependency+", context: "+process.cwd()+"\n"); - } else { - dependencies[dependency] = resolvedVersion; - } - } - } - } - - /* Read the package.json configuration */ - var packageObj = JSON.parse(fs.readFileSync('./package.json')); - - /* Pinpoint all dependencies */ - replaceDependencies(packageObj.dependencies); - if(process.argv[2] == "development") { - replaceDependencies(packageObj.devDependencies); - } - replaceDependencies(packageObj.optionalDependencies); - - /* Write the fixed package.json file */ - fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); - ''; - }; - in - '' - node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} - - ${lib.optionalString (dependencies != []) - '' - if [ -d node_modules ] - then - cd node_modules - ${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} - cd .. - fi - ''} - ''; - - # Recursively traverses all dependencies of a package and pinpoints all - # dependencies in the package.json file to the versions that are actually - # being used. - - pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args: - '' - if [ -d "${packageName}" ] - then - cd "${packageName}" - ${pinpointDependencies { inherit dependencies production; }} - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - fi - ''; - - # Extract the Node.js source code which is used to compile packages with - # native bindings - nodeSources = runCommand "node-sources" {} '' - tar --no-same-owner --no-same-permissions -xf ${nodejs.src} - mv node-* $out - ''; - - # Script that adds _integrity fields to all package.json files to prevent NPM from consulting the cache (that is empty) - addIntegrityFieldsScript = writeTextFile { - name = "addintegrityfields.js"; - text = '' - var fs = require('fs'); - var path = require('path'); - - function augmentDependencies(baseDir, dependencies) { - for(var dependencyName in dependencies) { - var dependency = dependencies[dependencyName]; - - // Open package.json and augment metadata fields - var packageJSONDir = path.join(baseDir, "node_modules", dependencyName); - var packageJSONPath = path.join(packageJSONDir, "package.json"); - - if(fs.existsSync(packageJSONPath)) { // Only augment packages that exist. Sometimes we may have production installs in which development dependencies can be ignored - console.log("Adding metadata fields to: "+packageJSONPath); - var packageObj = JSON.parse(fs.readFileSync(packageJSONPath)); - - if(dependency.integrity) { - packageObj["_integrity"] = dependency.integrity; - } else { - packageObj["_integrity"] = "sha1-000000000000000000000000000="; // When no _integrity string has been provided (e.g. by Git dependencies), add a dummy one. It does not seem to harm and it bypasses downloads. - } - - if(dependency.resolved) { - packageObj["_resolved"] = dependency.resolved; // Adopt the resolved property if one has been provided - } else { - packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories. - } - - if(dependency.from !== undefined) { // Adopt from property if one has been provided - packageObj["_from"] = dependency.from; - } - - fs.writeFileSync(packageJSONPath, JSON.stringify(packageObj, null, 2)); - } - - // Augment transitive dependencies - if(dependency.dependencies !== undefined) { - augmentDependencies(packageJSONDir, dependency.dependencies); - } - } - } - - if(fs.existsSync("./package-lock.json")) { - var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); - - if(![1, 2].includes(packageLock.lockfileVersion)) { - process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); - process.exit(1); - } - - if(packageLock.dependencies !== undefined) { - augmentDependencies(".", packageLock.dependencies); - } - } - ''; - }; - - # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes - reconstructPackageLock = writeTextFile { - name = "addintegrityfields.js"; - text = '' - var fs = require('fs'); - var path = require('path'); - - var packageObj = JSON.parse(fs.readFileSync("package.json")); - - var lockObj = { - name: packageObj.name, - version: packageObj.version, - lockfileVersion: 1, - requires: true, - dependencies: {} - }; - - function augmentPackageJSON(filePath, dependencies) { - var packageJSON = path.join(filePath, "package.json"); - if(fs.existsSync(packageJSON)) { - var packageObj = JSON.parse(fs.readFileSync(packageJSON)); - dependencies[packageObj.name] = { - version: packageObj.version, - integrity: "sha1-000000000000000000000000000=", - dependencies: {} - }; - processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies); - } - } - - function processDependencies(dir, dependencies) { - if(fs.existsSync(dir)) { - var files = fs.readdirSync(dir); - - files.forEach(function(entry) { - var filePath = path.join(dir, entry); - var stats = fs.statSync(filePath); - - if(stats.isDirectory()) { - if(entry.substr(0, 1) == "@") { - // When we encounter a namespace folder, augment all packages belonging to the scope - var pkgFiles = fs.readdirSync(filePath); - - pkgFiles.forEach(function(entry) { - if(stats.isDirectory()) { - var pkgFilePath = path.join(filePath, entry); - augmentPackageJSON(pkgFilePath, dependencies); - } - }); - } else { - augmentPackageJSON(filePath, dependencies); - } - } - }); - } - } - - processDependencies("node_modules", lockObj.dependencies); - - fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); - ''; - }; - - prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}: - let - forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; - in - '' - # Pinpoint the versions of all dependencies to the ones that are actually being used - echo "pinpointing versions of dependencies..." - source $pinpointDependenciesScriptPath - - # Patch the shebangs of the bundled modules to prevent them from - # calling executables outside the Nix store as much as possible - patchShebangs . - - # Deploy the Node.js package by running npm install. Since the - # dependencies have been provided already by ourselves, it should not - # attempt to install them again, which is good, because we want to make - # it Nix's responsibility. If it needs to install any dependencies - # anyway (e.g. because the dependency parameters are - # incomplete/incorrect), it fails. - # - # The other responsibilities of NPM are kept -- version checks, build - # steps, postprocessing etc. - - export HOME=$TMPDIR - cd "${packageName}" - runHook preRebuild - - ${lib.optionalString bypassCache '' - ${lib.optionalString reconstructLock '' - if [ -f package-lock.json ] - then - echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" - echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!" - rm package-lock.json - else - echo "No package-lock.json file found, reconstructing..." - fi - - node ${reconstructPackageLock} - ''} - - node ${addIntegrityFieldsScript} - ''} - - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild - - if [ "''${dontNpmInstall-}" != "1" ] - then - # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. - rm -f npm-shrinkwrap.json - - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install - fi - ''; - - # Builds and composes an NPM package including all its dependencies - buildNodePackage = - { name - , packageName - , version - , dependencies ? [] - , buildInputs ? [] - , production ? true - , npmFlags ? "" - , dontNpmInstall ? false - , bypassCache ? false - , reconstructLock ? false - , preRebuild ? "" - , dontStrip ? true - , unpackPhase ? "true" - , buildPhase ? "true" - , meta ? {} - , ... }@args: - - let - extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ]; - in - stdenv.mkDerivation ({ - name = "${name}-${version}"; - buildInputs = [ tarWrapper python nodejs ] - ++ lib.optional (stdenv.isLinux) utillinux - ++ lib.optional (stdenv.isDarwin) libtool - ++ buildInputs; - - inherit nodejs; - - inherit dontStrip; # Stripping may fail a build for some package deployments - inherit dontNpmInstall preRebuild unpackPhase buildPhase; - - compositionScript = composePackage args; - pinpointDependenciesScript = pinpointDependenciesOfPackage args; - - passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; - - installPhase = '' - source ${installPackage} - - # Create and enter a root node_modules/ folder - mkdir -p $out/lib/node_modules - cd $out/lib/node_modules - - # Compose the package and all its dependencies - source $compositionScriptPath - - ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} - - # Create symlink to the deployed executable folder, if applicable - if [ -d "$out/lib/node_modules/.bin" ] - then - ln -s $out/lib/node_modules/.bin $out/bin - fi - - # Create symlinks to the deployed manual page folders, if applicable - if [ -d "$out/lib/node_modules/${packageName}/man" ] - then - mkdir -p $out/share - for dir in "$out/lib/node_modules/${packageName}/man/"* - do - mkdir -p $out/share/man/$(basename "$dir") - for page in "$dir"/* - do - ln -s $page $out/share/man/$(basename "$dir") - done - done - fi - - # Run post install hook, if provided - runHook postInstall - ''; - - meta = { - # default to Node.js' platforms - platforms = nodejs.meta.platforms; - } // meta; - } // extraArgs); - - # Builds a node environment (a node_modules folder and a set of binaries) - buildNodeDependencies = - { name - , packageName - , version - , src - , dependencies ? [] - , buildInputs ? [] - , production ? true - , npmFlags ? "" - , dontNpmInstall ? false - , bypassCache ? false - , reconstructLock ? false - , dontStrip ? true - , unpackPhase ? "true" - , buildPhase ? "true" - , ... }@args: - - let - extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; - in - stdenv.mkDerivation ({ - name = "node-dependencies-${name}-${version}"; - - buildInputs = [ tarWrapper python nodejs ] - ++ lib.optional (stdenv.isLinux) utillinux - ++ lib.optional (stdenv.isDarwin) libtool - ++ buildInputs; - - inherit dontStrip; # Stripping may fail a build for some package deployments - inherit dontNpmInstall unpackPhase buildPhase; - - includeScript = includeDependencies { inherit dependencies; }; - pinpointDependenciesScript = pinpointDependenciesOfPackage args; - - passAsFile = [ "includeScript" "pinpointDependenciesScript" ]; - - installPhase = '' - source ${installPackage} - - mkdir -p $out/${packageName} - cd $out/${packageName} - - source $includeScriptPath - - # Create fake package.json to make the npm commands work properly - cp ${src}/package.json . - chmod 644 package.json - ${lib.optionalString bypassCache '' - if [ -f ${src}/package-lock.json ] - then - cp ${src}/package-lock.json . - fi - ''} - - # Go to the parent folder to make sure that all packages are pinpointed - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - - ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} - - # Expose the executables that were installed - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - - mv ${packageName} lib - ln -s $out/lib/node_modules/.bin $out/bin - ''; - } // extraArgs); - - # Builds a development shell - buildNodeShell = - { name - , packageName - , version - , src - , dependencies ? [] - , buildInputs ? [] - , production ? true - , npmFlags ? "" - , dontNpmInstall ? false - , bypassCache ? false - , reconstructLock ? false - , dontStrip ? true - , unpackPhase ? "true" - , buildPhase ? "true" - , ... }@args: - - let - nodeDependencies = buildNodeDependencies args; - in - stdenv.mkDerivation { - name = "node-shell-${name}-${version}"; - - buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs; - buildCommand = '' - mkdir -p $out/bin - cat > $out/bin/shell < { + inherit system; + }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_18"}: + +let + nodeEnv = import ./node-env.nix { + inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; + inherit pkgs nodejs; + libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; + }; +in +import ./node-packages.nix { + inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; + inherit nodeEnv; +} diff --git a/pulp/default.nix b/pulp/default.nix new file mode 100644 index 0000000..4ed244c --- /dev/null +++ b/pulp/default.nix @@ -0,0 +1,8 @@ +# How to generate the files in this directory: +# +# nix run nixpkgs#node2nix -- -i <(echo '["pulp"]') -c composition.nix -18 +# + +{ pkgs ? import { } }: + +(import ./composition.nix { inherit pkgs; }).pulp diff --git a/pulp/latest/default.nix b/pulp/latest/default.nix deleted file mode 100644 index 23ca2fc..0000000 --- a/pulp/latest/default.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ pkgs ? import { } }: - -(import ./composition.nix { inherit pkgs; })."pulp" diff --git a/pulp/latest/generate.bash b/pulp/latest/generate.bash deleted file mode 100755 index 8c73756..0000000 --- a/pulp/latest/generate.bash +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell -p node2nix -i bash - -node2nix -i node-packages.json -c composition.nix -14 diff --git a/pulp/latest/node-packages.json b/pulp/latest/node-packages.json deleted file mode 100644 index 0127e82..0000000 --- a/pulp/latest/node-packages.json +++ /dev/null @@ -1 +0,0 @@ -["pulp"] diff --git a/pulp/latest/node-env.nix b/pulp/node-env.nix similarity index 83% rename from pulp/latest/node-env.nix rename to pulp/node-env.nix index 2590dd2..bc1e366 100644 --- a/pulp/latest/node-env.nix +++ b/pulp/node-env.nix @@ -165,7 +165,11 @@ let if(process.argv[2] == "development") { replaceDependencies(packageObj.devDependencies); } + else { + packageObj.devDependencies = {}; + } replaceDependencies(packageObj.optionalDependencies); + replaceDependencies(packageObj.peerDependencies); /* Write the fixed package.json file */ fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); @@ -270,7 +274,7 @@ let # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes reconstructPackageLock = writeTextFile { - name = "addintegrityfields.js"; + name = "reconstructpackagelock.js"; text = '' var fs = require('fs'); var path = require('path'); @@ -280,25 +284,43 @@ let var lockObj = { name: packageObj.name, version: packageObj.version, - lockfileVersion: 1, + lockfileVersion: 2, requires: true, + packages: { + "": { + name: packageObj.name, + version: packageObj.version, + license: packageObj.license, + bin: packageObj.bin, + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + } + }, dependencies: {} }; - function augmentPackageJSON(filePath, dependencies) { + function augmentPackageJSON(filePath, packages, dependencies) { var packageJSON = path.join(filePath, "package.json"); if(fs.existsSync(packageJSON)) { var packageObj = JSON.parse(fs.readFileSync(packageJSON)); + packages[filePath] = { + version: packageObj.version, + integrity: "sha1-000000000000000000000000000=", + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + }; dependencies[packageObj.name] = { version: packageObj.version, integrity: "sha1-000000000000000000000000000=", dependencies: {} }; - processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies); + processDependencies(path.join(filePath, "node_modules"), packages, dependencies[packageObj.name].dependencies); } } - function processDependencies(dir, dependencies) { + function processDependencies(dir, packages, dependencies) { if(fs.existsSync(dir)) { var files = fs.readdirSync(dir); @@ -314,23 +336,84 @@ let pkgFiles.forEach(function(entry) { if(stats.isDirectory()) { var pkgFilePath = path.join(filePath, entry); - augmentPackageJSON(pkgFilePath, dependencies); + augmentPackageJSON(pkgFilePath, packages, dependencies); } }); } else { - augmentPackageJSON(filePath, dependencies); + augmentPackageJSON(filePath, packages, dependencies); } } }); } } - processDependencies("node_modules", lockObj.dependencies); + processDependencies("node_modules", lockObj.packages, lockObj.dependencies); fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); ''; }; + # Script that links bins defined in package.json to the node_modules bin directory + # NPM does not do this for top-level packages itself anymore as of v7 + linkBinsScript = writeTextFile { + name = "linkbins.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + var packageObj = JSON.parse(fs.readFileSync("package.json")); + + var nodeModules = Array(packageObj.name.split("/").length).fill("..").join(path.sep); + + if(packageObj.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + if(typeof packageObj.bin == "object") { + Object.keys(packageObj.bin).forEach(function(exe) { + if(fs.existsSync(packageObj.bin[exe])) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin[exe]), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + else { + if(fs.existsSync(packageObj.bin)) { + console.log("linking bin '" + packageObj.bin + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin), + path.join(nodeModules, ".bin", packageObj.name.split("/").pop()) + ); + } + else { + console.log("skipping non-existent bin '" + packageObj.bin + "'"); + } + } + } + else if(packageObj.directories !== undefined && packageObj.directories.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + fs.readdirSync(packageObj.directories.bin).forEach(function(exe) { + if(fs.existsSync(path.join(packageObj.directories.bin, exe))) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.directories.bin, exe), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + ''; + }; + prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}: let forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; @@ -377,13 +460,18 @@ let npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild + runHook postRebuild + if [ "''${dontNpmInstall-}" != "1" ] then # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. rm -f npm-shrinkwrap.json - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install + npm ${forceOfflineFlag} --nodedir=${nodeSources} --no-bin-links --ignore-scripts ${npmFlags} ${lib.optionalString production "--production"} install fi + + # Link executables defined in package.json + node ${linkBinsScript} ''; # Builds and composes an NPM package including all its dependencies @@ -442,12 +530,15 @@ let then ln -s $out/lib/node_modules/.bin $out/bin - # Patch the shebang lines of all the executables + # Fixup all executables ls $out/bin/* | while read i do file="$(readlink -f "$i")" chmod u+rwx "$file" - patchShebangs "$file" + if isScript "$file" + then + sed -i 's/\r$//' "$file" # convert crlf to lf + fi done fi diff --git a/pulp/latest/node-packages.nix b/pulp/node-packages.nix similarity index 96% rename from pulp/latest/node-packages.nix rename to pulp/node-packages.nix index 0975b4c..ca97e9d 100644 --- a/pulp/latest/node-packages.nix +++ b/pulp/node-packages.nix @@ -418,13 +418,13 @@ let sha512 = "Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA=="; }; }; - "defined-1.0.0" = { + "defined-1.0.1" = { name = "defined"; packageName = "defined"; - version = "1.0.0"; + version = "1.0.1"; src = fetchurl { - url = "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz"; - sha512 = "Y2caI5+ZwS5c3RiNDJ6u53VhQHv+hHKwhkI1iHvceKUHw9Df6EK2zRLfjejRgMuCuxK7PfSWIMwWecceVvThjQ=="; + url = "https://registry.npmjs.org/defined/-/defined-1.0.1.tgz"; + sha512 = "hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q=="; }; }; "deps-sort-2.0.1" = { @@ -436,13 +436,13 @@ let sha512 = "1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw=="; }; }; - "des.js-1.0.1" = { + "des.js-1.1.0" = { name = "des.js"; packageName = "des.js"; - version = "1.0.1"; + version = "1.1.0"; src = fetchurl { - url = "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz"; - sha512 = "Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA=="; + url = "https://registry.npmjs.org/des.js/-/des.js-1.1.0.tgz"; + sha512 = "r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg=="; }; }; "detective-5.2.1" = { @@ -589,13 +589,13 @@ let sha512 = "OPTIfhMBh7JbBYDpa5b+Q5ptmMWKwcNcFSR/0c6t8V4f3ZAVBEsKNY37QdVqmLRYSMhOUGYrY0QhSoEpzGr/Eg=="; }; }; - "graceful-fs-4.2.10" = { + "graceful-fs-4.2.11" = { name = "graceful-fs"; packageName = "graceful-fs"; - version = "4.2.10"; + version = "4.2.11"; src = fetchurl { - url = "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz"; - sha512 = "9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA=="; + url = "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz"; + sha512 = "RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="; }; }; "has-1.0.3" = { @@ -724,13 +724,13 @@ let sha512 = "NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="; }; }; - "is-core-module-2.10.0" = { + "is-core-module-2.12.1" = { name = "is-core-module"; packageName = "is-core-module"; - version = "2.10.0"; + version = "2.12.1"; src = fetchurl { - url = "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz"; - sha512 = "Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg=="; + url = "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz"; + sha512 = "Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg=="; }; }; "isarray-1.0.0" = { @@ -760,13 +760,13 @@ let sha512 = "nKtD/Qxm7tWdZqJoldEC7fF0S41v0mWbeaXG3637stOWfyGxTgWTYE2wtfKmjzpvxv2MA2xzxsXOIiwUpkX6Qw=="; }; }; - "jsonify-0.0.0" = { + "jsonify-0.0.1" = { name = "jsonify"; packageName = "jsonify"; - version = "0.0.0"; + version = "0.0.1"; src = fetchurl { - url = "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz"; - sha512 = "trvBk1ki43VZptdBI5rIlG4YOzyeH/WefQt5rj1grasPn4iiZWKet8nkgc4GlsAylaztn0qZfUYOiTsASJFdNA=="; + url = "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz"; + sha512 = "2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg=="; }; }; "jsonparse-0.0.5" = { @@ -886,13 +886,13 @@ let sha512 = "iotkTvxc+TwOm5Ieim8VnSNvCDjCK9S8G3scJ50ZthspSxa7jx50jkhYduuAtAjvfDUwSgOwf8+If99AlOEhyw=="; }; }; - "minimist-1.2.6" = { + "minimist-1.2.8" = { name = "minimist"; packageName = "minimist"; - version = "1.2.6"; + version = "1.2.8"; src = fetchurl { - url = "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz"; - sha512 = "Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="; + url = "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz"; + sha512 = "2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="; }; }; "mkdirp-0.5.6" = { @@ -922,13 +922,13 @@ let sha512 = "fg7OZaQBcL4/L+AK5f4iVqf9OMbCclXfy/znXRxTVhJSeW5AIlS9AwheYwDaXM3lVW7OBeaeUEY3gbaC6cLlSA=="; }; }; - "mold-source-map-0.4.0" = { + "mold-source-map-0.4.1" = { name = "mold-source-map"; packageName = "mold-source-map"; - version = "0.4.0"; + version = "0.4.1"; src = fetchurl { - url = "https://registry.npmjs.org/mold-source-map/-/mold-source-map-0.4.0.tgz"; - sha512 = "Y0uA/sDKVuPgLd7BmaJOai+fqzjrOlR6vZgx5cJIvturI/xOPQPgbf3X7ZbzJd6MvqQ6ucIfK8dSteFyc2Mw2w=="; + url = "https://registry.npmjs.org/mold-source-map/-/mold-source-map-0.4.1.tgz"; + sha512 = "oPowVpTm8p3jsK2AKI+NzoS6TBKv7gWY/Hj4ZNh5YWiB3S4eP54y8vSEEgVUdrqgTbjwEzIunNAVQJGRW0bakQ=="; }; }; "mute-stream-0.0.8" = { @@ -1156,31 +1156,31 @@ let sha512 = "3ALe0bjBVZtkdWKIcThYpQCLbBMd/+Tbh2CDSrAIDO3UsZ4Xs+tnyjv2MjCOMMgBG+AsUOeuP1cgtY1INISc8w=="; }; }; - "readable-stream-2.3.7" = { + "readable-stream-2.3.8" = { name = "readable-stream"; packageName = "readable-stream"; - version = "2.3.7"; + version = "2.3.8"; src = fetchurl { - url = "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz"; - sha512 = "Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw=="; + url = "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz"; + sha512 = "8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="; }; }; - "readable-stream-3.6.0" = { + "readable-stream-3.6.2" = { name = "readable-stream"; packageName = "readable-stream"; - version = "3.6.0"; + version = "3.6.2"; src = fetchurl { - url = "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz"; - sha512 = "BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA=="; + url = "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz"; + sha512 = "9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="; }; }; - "resolve-1.22.1" = { + "resolve-1.22.3" = { name = "resolve"; packageName = "resolve"; - version = "1.22.1"; + version = "1.22.3"; src = fetchurl { - url = "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz"; - sha512 = "nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw=="; + url = "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz"; + sha512 = "P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw=="; }; }; "rimraf-2.6.3" = { @@ -1273,13 +1273,13 @@ let sha512 = "Iqo5rp/3xVi6M4YheapzZhhGPVs0yZwHj7wvwQ1B9z8H6zk+FEnI7y3Teq7qwnekfEhu8WmG2z0z4iWZaxLWVg=="; }; }; - "shell-quote-1.7.3" = { + "shell-quote-1.8.1" = { name = "shell-quote"; packageName = "shell-quote"; - version = "1.7.3"; + version = "1.8.1"; src = fetchurl { - url = "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz"; - sha512 = "Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw=="; + url = "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz"; + sha512 = "6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA=="; }; }; "simple-concat-1.0.1" = { @@ -1632,7 +1632,7 @@ in sources."browserify-rsa-4.1.0" (sources."browserify-sign-4.2.1" // { dependencies = [ - sources."readable-stream-3.6.0" + sources."readable-stream-3.6.2" ]; }) sources."browserify-zlib-0.2.0" @@ -1648,7 +1648,7 @@ in sources."concat-map-0.0.1" (sources."concat-stream-2.0.0" // { dependencies = [ - sources."readable-stream-3.6.0" + sources."readable-stream-3.6.2" ]; }) sources."console-browserify-1.2.0" @@ -1664,9 +1664,9 @@ in sources."create-hmac-1.1.7" sources."crypto-browserify-3.12.0" sources."dash-ast-1.0.0" - sources."defined-1.0.0" + sources."defined-1.0.1" sources."deps-sort-2.0.1" - sources."des.js-1.0.1" + sources."des.js-1.1.0" sources."detective-5.2.1" (sources."diffie-hellman-5.0.3" // { dependencies = [ @@ -1698,11 +1698,11 @@ in sources."glob-7.1.7" ]; }) - sources."graceful-fs-4.2.10" + sources."graceful-fs-4.2.11" sources."has-1.0.3" (sources."hash-base-3.1.0" // { dependencies = [ - sources."readable-stream-3.6.0" + sources."readable-stream-3.6.2" ]; }) sources."hash.js-1.1.7" @@ -1719,11 +1719,11 @@ in ]; }) sources."is-buffer-1.1.6" - sources."is-core-module-2.10.0" + sources."is-core-module-2.12.1" sources."isarray-1.0.0" sources."isexe-2.0.0" sources."json-stable-stringify-0.0.1" - sources."jsonify-0.0.0" + sources."jsonify-0.0.1" sources."jsonparse-1.3.1" sources."labeled-stream-splicer-2.0.2" sources."lodash-4.17.21" @@ -1738,7 +1738,7 @@ in sources."minimalistic-assert-1.0.1" sources."minimalistic-crypto-utils-1.0.1" sources."minimatch-3.0.8" - sources."minimist-1.2.6" + sources."minimist-1.2.8" sources."mkdirp-0.5.6" sources."mkdirp-classic-0.5.3" (sources."module-deps-6.2.3" // { @@ -1746,7 +1746,7 @@ in sources."concat-stream-1.6.2" ]; }) - (sources."mold-source-map-0.4.0" // { + (sources."mold-source-map-0.4.1" // { dependencies = [ sources."through-2.2.7" ]; @@ -1784,13 +1784,13 @@ in sources."randomfill-1.0.4" sources."read-1.0.7" sources."read-only-stream-2.0.0" - (sources."readable-stream-2.3.7" // { + (sources."readable-stream-2.3.8" // { dependencies = [ sources."safe-buffer-5.1.2" sources."string_decoder-1.1.1" ]; }) - sources."resolve-1.22.1" + sources."resolve-1.22.3" sources."rimraf-2.7.1" sources."ripemd160-2.0.2" sources."safe-buffer-5.2.1" @@ -1799,7 +1799,7 @@ in sources."sha.js-2.4.11" sources."shasum-1.0.2" sources."shasum-object-1.0.0" - sources."shell-quote-1.7.3" + sources."shell-quote-1.8.1" sources."simple-concat-1.0.1" sources."sorcery-0.10.0" sources."source-map-0.5.7" @@ -1808,7 +1808,7 @@ in sources."stream-combiner2-1.1.1" (sources."stream-http-3.2.0" // { dependencies = [ - sources."readable-stream-3.6.0" + sources."readable-stream-3.6.2" ]; }) sources."stream-splicer-2.0.1" diff --git a/purescript-language-server/composition.nix b/purescript-language-server/composition.nix new file mode 100644 index 0000000..d9c0dae --- /dev/null +++ b/purescript-language-server/composition.nix @@ -0,0 +1,17 @@ +# This file has been generated by node2nix 1.11.1. Do not edit! + +{pkgs ? import { + inherit system; + }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_18"}: + +let + nodeEnv = import ./node-env.nix { + inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; + inherit pkgs nodejs; + libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; + }; +in +import ./node-packages.nix { + inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; + inherit nodeEnv; +} diff --git a/purescript-language-server/default.nix b/purescript-language-server/default.nix index 169b66d..36451a5 100644 --- a/purescript-language-server/default.nix +++ b/purescript-language-server/default.nix @@ -1,22 +1,7 @@ -{ pkgs ? import { inherit system; } -, system ? builtins.currentSystem -, nodejs ? pkgs."nodejs-14_x" -}: +# How to generate the files in this directory: +# +# nix run nixpkgs#node2nix -- -i <(echo '["purescript-language-server"]') -c composition.nix -18 +# +{ pkgs ? import { } }: -let - version = "0.16.6"; - - nodeEnv = import ./node-env.nix { - inherit (pkgs) stdenv lib python2 runCommand writeTextFile; - inherit pkgs nodejs; - libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; - }; - - nodePackage = import ./node-packages.nix { - inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; - inherit nodeEnv; - }; - - source = nodePackage.sources."purescript-language-server-${version}".src; -in -nodeEnv.buildNodePackage (nodePackage.args // { src = source; }) +(import ./composition.nix { inherit pkgs; }).purescript-language-server diff --git a/purescript-language-server/node-env.nix b/purescript-language-server/node-env.nix index c2b7231..bc1e366 100644 --- a/purescript-language-server/node-env.nix +++ b/purescript-language-server/node-env.nix @@ -1,6 +1,6 @@ # This file originates from node2nix -{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile}: +{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}: let # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master @@ -40,36 +40,22 @@ let ''; }; - includeDependencies = {dependencies}: - lib.optionalString (dependencies != []) - (lib.concatMapStrings (dependency: - '' - # Bundle the dependencies of the package - mkdir -p node_modules - cd node_modules - - # Only include dependencies if they don't exist. They may also be bundled in the package. - if [ ! -e "${dependency.name}" ] - then - ${composePackage dependency} - fi + # Common shell logic + installPackage = writeShellScript "install-package" '' + installPackage() { + local packageName=$1 src=$2 - cd .. - '' - ) dependencies); + local strippedName - # Recursively composes the dependencies of a package - composePackage = { name, packageName, src, dependencies ? [], ... }@args: - builtins.addErrorContext "while evaluating node package '${packageName}'" '' - DIR=$(pwd) + local DIR=$PWD cd $TMPDIR - unpackFile ${src} + unpackFile $src # Make the base dir in which the target dependency resides first - mkdir -p "$(dirname "$DIR/${packageName}")" + mkdir -p "$(dirname "$DIR/$packageName")" - if [ -f "${src}" ] + if [ -f "$src" ] then # Figure out what directory has been unpacked packageDir="$(find . -maxdepth 1 -type d | tail -1)" @@ -79,28 +65,53 @@ let chmod -R u+w "$packageDir" # Move the extracted tarball into the output folder - mv "$packageDir" "$DIR/${packageName}" - elif [ -d "${src}" ] + mv "$packageDir" "$DIR/$packageName" + elif [ -d "$src" ] then # Get a stripped name (without hash) of the source directory. # On old nixpkgs it's already set internally. if [ -z "$strippedName" ] then - strippedName="$(stripHash ${src})" + strippedName="$(stripHash $src)" fi # Restore write permissions to make building work chmod -R u+w "$strippedName" # Move the extracted directory into the output folder - mv "$strippedName" "$DIR/${packageName}" + mv "$strippedName" "$DIR/$packageName" fi - # Unset the stripped name to not confuse the next unpack step - unset strippedName + # Change to the package directory to install dependencies + cd "$DIR/$packageName" + } + ''; - # Include the dependencies of the package - cd "$DIR/${packageName}" + # Bundle the dependencies of the package + # + # Only include dependencies if they don't exist. They may also be bundled in the package. + includeDependencies = {dependencies}: + lib.optionalString (dependencies != []) ( + '' + mkdir -p node_modules + cd node_modules + '' + + (lib.concatMapStrings (dependency: + '' + if [ ! -e "${dependency.packageName}" ]; then + ${composePackage dependency} + fi + '' + ) dependencies) + + '' + cd .. + '' + ); + + # Recursively composes the dependencies of a package + composePackage = { name, packageName, src, dependencies ? [], ... }@args: + builtins.addErrorContext "while evaluating node package '${packageName}'" '' + installPackage "${packageName}" "${src}" ${includeDependencies { inherit dependencies; }} cd .. ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} @@ -154,7 +165,11 @@ let if(process.argv[2] == "development") { replaceDependencies(packageObj.devDependencies); } + else { + packageObj.devDependencies = {}; + } replaceDependencies(packageObj.optionalDependencies); + replaceDependencies(packageObj.peerDependencies); /* Write the fixed package.json file */ fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); @@ -246,8 +261,8 @@ let var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); if(![1, 2].includes(packageLock.lockfileVersion)) { - process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); - process.exit(1); + process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); + process.exit(1); } if(packageLock.dependencies !== undefined) { @@ -259,7 +274,7 @@ let # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes reconstructPackageLock = writeTextFile { - name = "addintegrityfields.js"; + name = "reconstructpackagelock.js"; text = '' var fs = require('fs'); var path = require('path'); @@ -269,25 +284,43 @@ let var lockObj = { name: packageObj.name, version: packageObj.version, - lockfileVersion: 1, + lockfileVersion: 2, requires: true, + packages: { + "": { + name: packageObj.name, + version: packageObj.version, + license: packageObj.license, + bin: packageObj.bin, + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + } + }, dependencies: {} }; - function augmentPackageJSON(filePath, dependencies) { + function augmentPackageJSON(filePath, packages, dependencies) { var packageJSON = path.join(filePath, "package.json"); if(fs.existsSync(packageJSON)) { var packageObj = JSON.parse(fs.readFileSync(packageJSON)); + packages[filePath] = { + version: packageObj.version, + integrity: "sha1-000000000000000000000000000=", + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + }; dependencies[packageObj.name] = { version: packageObj.version, integrity: "sha1-000000000000000000000000000=", dependencies: {} }; - processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies); + processDependencies(path.join(filePath, "node_modules"), packages, dependencies[packageObj.name].dependencies); } } - function processDependencies(dir, dependencies) { + function processDependencies(dir, packages, dependencies) { if(fs.existsSync(dir)) { var files = fs.readdirSync(dir); @@ -303,23 +336,84 @@ let pkgFiles.forEach(function(entry) { if(stats.isDirectory()) { var pkgFilePath = path.join(filePath, entry); - augmentPackageJSON(pkgFilePath, dependencies); + augmentPackageJSON(pkgFilePath, packages, dependencies); } }); } else { - augmentPackageJSON(filePath, dependencies); + augmentPackageJSON(filePath, packages, dependencies); } } }); } } - processDependencies("node_modules", lockObj.dependencies); + processDependencies("node_modules", lockObj.packages, lockObj.dependencies); fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); ''; }; + # Script that links bins defined in package.json to the node_modules bin directory + # NPM does not do this for top-level packages itself anymore as of v7 + linkBinsScript = writeTextFile { + name = "linkbins.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + var packageObj = JSON.parse(fs.readFileSync("package.json")); + + var nodeModules = Array(packageObj.name.split("/").length).fill("..").join(path.sep); + + if(packageObj.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + if(typeof packageObj.bin == "object") { + Object.keys(packageObj.bin).forEach(function(exe) { + if(fs.existsSync(packageObj.bin[exe])) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin[exe]), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + else { + if(fs.existsSync(packageObj.bin)) { + console.log("linking bin '" + packageObj.bin + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin), + path.join(nodeModules, ".bin", packageObj.name.split("/").pop()) + ); + } + else { + console.log("skipping non-existent bin '" + packageObj.bin + "'"); + } + } + } + else if(packageObj.directories !== undefined && packageObj.directories.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + fs.readdirSync(packageObj.directories.bin).forEach(function(exe) { + if(fs.existsSync(path.join(packageObj.directories.bin, exe))) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.directories.bin, exe), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + ''; + }; + prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}: let forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; @@ -366,20 +460,25 @@ let npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild + runHook postRebuild + if [ "''${dontNpmInstall-}" != "1" ] then # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. rm -f npm-shrinkwrap.json - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install + npm ${forceOfflineFlag} --nodedir=${nodeSources} --no-bin-links --ignore-scripts ${npmFlags} ${lib.optionalString production "--production"} install fi + + # Link executables defined in package.json + node ${linkBinsScript} ''; # Builds and composes an NPM package including all its dependencies buildNodePackage = { name , packageName - , version + , version ? null , dependencies ? [] , buildInputs ? [] , production ? true @@ -391,13 +490,14 @@ let , dontStrip ? true , unpackPhase ? "true" , buildPhase ? "true" + , meta ? {} , ... }@args: let - extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ]; + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ]; in stdenv.mkDerivation ({ - name = "node_${name}-${version}"; + name = "${name}${if version == null then "" else "-${version}"}"; buildInputs = [ tarWrapper python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ lib.optional (stdenv.isDarwin) libtool @@ -414,6 +514,8 @@ let passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; installPhase = '' + source ${installPackage} + # Create and enter a root node_modules/ folder mkdir -p $out/lib/node_modules cd $out/lib/node_modules @@ -427,6 +529,17 @@ let if [ -d "$out/lib/node_modules/.bin" ] then ln -s $out/lib/node_modules/.bin $out/bin + + # Fixup all executables + ls $out/bin/* | while read i + do + file="$(readlink -f "$i")" + chmod u+rwx "$file" + if isScript "$file" + then + sed -i 's/\r$//' "$file" # convert crlf to lf + fi + done fi # Create symlinks to the deployed manual page folders, if applicable @@ -446,13 +559,18 @@ let # Run post install hook, if provided runHook postInstall ''; + + meta = { + # default to Node.js' platforms + platforms = nodejs.meta.platforms; + } // meta; } // extraArgs); # Builds a node environment (a node_modules folder and a set of binaries) buildNodeDependencies = { name , packageName - , version + , version ? null , src , dependencies ? [] , buildInputs ? [] @@ -470,7 +588,7 @@ let extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; in stdenv.mkDerivation ({ - name = "node-dependencies-${name}-${version}"; + name = "node-dependencies-${name}${if version == null then "" else "-${version}"}"; buildInputs = [ tarWrapper python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux @@ -486,6 +604,8 @@ let passAsFile = [ "includeScript" "pinpointDependenciesScript" ]; installPhase = '' + source ${installPackage} + mkdir -p $out/${packageName} cd $out/${packageName} @@ -498,6 +618,7 @@ let if [ -f ${src}/package-lock.json ] then cp ${src}/package-lock.json . + chmod 644 package-lock.json fi ''} @@ -520,7 +641,7 @@ let buildNodeShell = { name , packageName - , version + , version ? null , src , dependencies ? [] , buildInputs ? [] @@ -536,9 +657,10 @@ let let nodeDependencies = buildNodeDependencies args; + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "unpackPhase" "buildPhase" ]; in - stdenv.mkDerivation { - name = "node-shell-${name}-${version}"; + stdenv.mkDerivation ({ + name = "node-shell-${name}${if version == null then "" else "-${version}"}"; buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs; buildCommand = '' @@ -557,7 +679,7 @@ let export NODE_PATH=${nodeDependencies}/lib/node_modules export PATH="${nodeDependencies}/bin:$PATH" ''; - }; + } // extraArgs); in { buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist; diff --git a/purescript-language-server/node-packages.nix b/purescript-language-server/node-packages.nix index ff763f5..1c9c95f 100644 --- a/purescript-language-server/node-packages.nix +++ b/purescript-language-server/node-packages.nix @@ -1,4 +1,4 @@ -# This file has been generated by node2nix 1.9.0. Do not edit! +# This file has been generated by node2nix 1.11.1. Do not edit! {nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}: @@ -10,25 +10,16 @@ let version = "2.0.0"; src = fetchurl { url = "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz"; - sha1 = "e8fbf374dc556ff8947a10dcb0572d633f2cfa10"; + sha512 = "RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="; }; }; - "purescript-language-server-0.16.6" = { - name = "purescript-language-server"; - packageName = "purescript-language-server"; - version = "0.16.6"; - src = fetchurl { - url = "https://registry.npmjs.org/purescript-language-server/-/purescript-language-server-0.16.6.tgz"; - sha512 = "oFxJ0Q59ZmEAwfwgf0nHn5twogTYNqrLDi8mNDnxQcu6Q9XhhagNgLNvPyZNvhO8ELL5UvURG7xZk+GKCKkxOg=="; - }; - }; - "shell-quote-1.7.3" = { + "shell-quote-1.8.1" = { name = "shell-quote"; packageName = "shell-quote"; - version = "1.7.3"; + version = "1.8.1"; src = fetchurl { - url = "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz"; - sha512 = "Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw=="; + url = "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz"; + sha512 = "6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA=="; }; }; "uuid-3.4.0" = { @@ -40,49 +31,49 @@ let sha512 = "HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="; }; }; - "vscode-jsonrpc-8.0.0-next.8" = { + "vscode-jsonrpc-8.1.0" = { name = "vscode-jsonrpc"; packageName = "vscode-jsonrpc"; - version = "8.0.0-next.8"; + version = "8.1.0"; src = fetchurl { - url = "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.0.0-next.8.tgz"; - sha512 = "2eh7v+rzttUG6wg21xnm3U4IaR/i8cU9vHI9ZntRXuBtCcyR3RrPBvl86Ffm91m/Cio45kmn/LskHK3BAKZILA=="; + url = "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.1.0.tgz"; + sha512 = "6TDy/abTQk+zDGYazgbIPc+4JoXdwC8NHU9Pbn4UJP1fehUyZmM4RHp5IthX7A6L5KS30PRui+j+tbbMMMafdw=="; }; }; - "vscode-languageserver-8.0.0-next.14" = { + "vscode-languageserver-8.1.0" = { name = "vscode-languageserver"; packageName = "vscode-languageserver"; - version = "8.0.0-next.14"; + version = "8.1.0"; src = fetchurl { - url = "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-8.0.0-next.14.tgz"; - sha512 = "8CjwnSuKuIs71E9dCtx8MBTCKmH7KvWZHgTf2KN9Pa03IshdNU3zcFs/yfifpDSWpE1EcLeWYCvZwir/1Jt5kA=="; + url = "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-8.1.0.tgz"; + sha512 = "eUt8f1z2N2IEUDBsKaNapkz7jl5QpskN2Y0G01T/ItMxBxw1fJwvtySGB9QMecatne8jFIWJGWI61dWjyTLQsw=="; }; }; - "vscode-languageserver-protocol-3.17.0-next.20" = { + "vscode-languageserver-protocol-3.17.3" = { name = "vscode-languageserver-protocol"; packageName = "vscode-languageserver-protocol"; - version = "3.17.0-next.20"; + version = "3.17.3"; src = fetchurl { - url = "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.0-next.20.tgz"; - sha512 = "uQSgoKsxFH+74NRwoWGYWr/FwmtN0XGesh+jHqTGhmVsMco9I5Li8kAc5et6zA7yt1RQcUAW3Jqim7Uvb0Npfg=="; + url = "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.3.tgz"; + sha512 = "924/h0AqsMtA5yK22GgMtCYiMdCOtWTSGgUOkgEDX+wk2b0x4sAfLiO4NxBxqbiVtz7K7/1/RgVrVI0NClZwqA=="; }; }; - "vscode-languageserver-textdocument-1.0.4" = { + "vscode-languageserver-textdocument-1.0.10" = { name = "vscode-languageserver-textdocument"; packageName = "vscode-languageserver-textdocument"; - version = "1.0.4"; + version = "1.0.10"; src = fetchurl { - url = "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.4.tgz"; - sha512 = "/xhqXP/2A2RSs+J8JNXpiiNVvvNM0oTosNVmQnunlKvq9o4mupHOBAnnzH0lwIPKazXKvAKsVp1kr+H/K4lgoQ=="; + url = "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.10.tgz"; + sha512 = "dPA6WqtAQJ/Iopm0Hrj11VvaKxsEcm62jpqyaYbY0xuvUffeWAn77f3VKr2SCsJphSyEw4Fjkjqm2gQ24KQfrA=="; }; }; - "vscode-languageserver-types-3.17.0-next.12" = { + "vscode-languageserver-types-3.17.3" = { name = "vscode-languageserver-types"; packageName = "vscode-languageserver-types"; - version = "3.17.0-next.12"; + version = "3.17.3"; src = fetchurl { - url = "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.0-next.12.tgz"; - sha512 = "kaXEKkIrkd8UaQzkwUYSMgG6VVr8lplvng+/UKPb6rPYdOJ5a6JqNd87ohgIIWFE/tDWPiFM8TTGIQ2IJe02eg=="; + url = "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.3.tgz"; + sha512 = "SYU4z1dL0PyIMd4Vj8YOqFvHu7Hz/enbWtpfnVbJHU4Nd1YNYx8u0ennumc6h48GQNeOLxmwySmnADouT/AuZA=="; }; }; "vscode-uri-2.1.2" = { @@ -104,48 +95,36 @@ let }; }; }; - args = { +in +{ + purescript-language-server = nodeEnv.buildNodePackage { name = "purescript-language-server"; packageName = "purescript-language-server"; - version = "0.16.6"; - src = ./.; + version = "0.17.1"; + src = fetchurl { + url = "https://registry.npmjs.org/purescript-language-server/-/purescript-language-server-0.17.1.tgz"; + sha512 = "o/YpvFMOXp5/UqfFjed8+pwZwttg1QpI3iqkHlMB16AW8MRYGVwTAw1zV8MGqazFFat5j3+IJEUHhaeFON0EfA=="; + }; dependencies = [ sources."isexe-2.0.0" - sources."purescript-language-server-0.16.6" - sources."shell-quote-1.7.3" + sources."shell-quote-1.8.1" sources."uuid-3.4.0" - sources."vscode-jsonrpc-8.0.0-next.8" - sources."vscode-languageserver-8.0.0-next.14" - sources."vscode-languageserver-protocol-3.17.0-next.20" - sources."vscode-languageserver-textdocument-1.0.4" - sources."vscode-languageserver-types-3.17.0-next.12" + sources."vscode-jsonrpc-8.1.0" + sources."vscode-languageserver-8.1.0" + sources."vscode-languageserver-protocol-3.17.3" + sources."vscode-languageserver-textdocument-1.0.10" + sources."vscode-languageserver-types-3.17.3" sources."vscode-uri-2.1.2" sources."which-2.0.2" ]; buildInputs = globalBuildInputs; meta = { + description = "Language Server Protocol server for PureScript wrapping purs ide server functionality"; + homepage = "https://github.com/nwolverson/purescript-language-server"; + license = "MIT"; }; production = true; bypassCache = true; reconstructLock = true; }; -in -{ - args = args; - sources = sources; - tarball = nodeEnv.buildNodeSourceDist args; - package = nodeEnv.buildNodePackage args; - shell = nodeEnv.buildNodeShell args; - nodeDependencies = nodeEnv.buildNodeDependencies (lib.overrideExisting args { - src = stdenv.mkDerivation { - name = args.name + "-package-json"; - src = nix-gitignore.gitignoreSourcePure [ - "*" - "!package.json" - "!package-lock.json" - ] args.src; - dontBuild = true; - installPhase = "mkdir -p $out; cp -r ./* $out;"; - }; - }); } diff --git a/purs-backend-es/1.1.0/default.nix b/purs-backend-es/1.1.0/default.nix deleted file mode 100644 index 222e81e..0000000 --- a/purs-backend-es/1.1.0/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -# This file was not generated, it was actually copied from ../../pulp/16.0.2/default.nix -# This file has been generated by node2nix 1.9.0. Do not edit! - -{ pkgs ? import { - inherit system; - } -, system ? builtins.currentSystem -, nodejs ? pkgs."nodejs-14_x" -}: - -let - nodeEnv = import ./node-env.nix { - inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; - inherit pkgs nodejs; - libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; - }; - - nodePackage = import ./node-packages.nix - { - inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; - inherit nodeEnv; - }; - - source = nodePackage.sources."purs-backend-es-1.1.0".src; -in -nodeEnv.buildNodePackage (nodePackage.args // { src = source; }) diff --git a/purs-backend-es/1.1.0/node-env.nix b/purs-backend-es/1.1.0/node-env.nix deleted file mode 100644 index 5f05578..0000000 --- a/purs-backend-es/1.1.0/node-env.nix +++ /dev/null @@ -1,588 +0,0 @@ -# This file originates from node2nix - -{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}: - -let - # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master - utillinux = if pkgs ? utillinux then pkgs.utillinux else pkgs.util-linux; - - python = if nodejs ? python then nodejs.python else python2; - - # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise - tarWrapper = runCommand "tarWrapper" {} '' - mkdir -p $out/bin - - cat > $out/bin/tar <> $out/nix-support/hydra-build-products - ''; - }; - - # Common shell logic - installPackage = writeShellScript "install-package" '' - installPackage() { - local packageName=$1 src=$2 - - local strippedName - - local DIR=$PWD - cd $TMPDIR - - unpackFile $src - - # Make the base dir in which the target dependency resides first - mkdir -p "$(dirname "$DIR/$packageName")" - - if [ -f "$src" ] - then - # Figure out what directory has been unpacked - packageDir="$(find . -maxdepth 1 -type d | tail -1)" - - # Restore write permissions to make building work - find "$packageDir" -type d -exec chmod u+x {} \; - chmod -R u+w "$packageDir" - - # Move the extracted tarball into the output folder - mv "$packageDir" "$DIR/$packageName" - elif [ -d "$src" ] - then - # Get a stripped name (without hash) of the source directory. - # On old nixpkgs it's already set internally. - if [ -z "$strippedName" ] - then - strippedName="$(stripHash $src)" - fi - - # Restore write permissions to make building work - chmod -R u+w "$strippedName" - - # Move the extracted directory into the output folder - mv "$strippedName" "$DIR/$packageName" - fi - - # Change to the package directory to install dependencies - cd "$DIR/$packageName" - } - ''; - - # Bundle the dependencies of the package - # - # Only include dependencies if they don't exist. They may also be bundled in the package. - includeDependencies = {dependencies}: - lib.optionalString (dependencies != []) ( - '' - mkdir -p node_modules - cd node_modules - '' - + (lib.concatMapStrings (dependency: - '' - if [ ! -e "${dependency.name}" ]; then - ${composePackage dependency} - fi - '' - ) dependencies) - + '' - cd .. - '' - ); - - # Recursively composes the dependencies of a package - composePackage = { name, packageName, src, dependencies ? [], ... }@args: - builtins.addErrorContext "while evaluating node package '${packageName}'" '' - installPackage "${packageName}" "${src}" - ${includeDependencies { inherit dependencies; }} - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - ''; - - pinpointDependencies = {dependencies, production}: - let - pinpointDependenciesFromPackageJSON = writeTextFile { - name = "pinpointDependencies.js"; - text = '' - var fs = require('fs'); - var path = require('path'); - - function resolveDependencyVersion(location, name) { - if(location == process.env['NIX_STORE']) { - return null; - } else { - var dependencyPackageJSON = path.join(location, "node_modules", name, "package.json"); - - if(fs.existsSync(dependencyPackageJSON)) { - var dependencyPackageObj = JSON.parse(fs.readFileSync(dependencyPackageJSON)); - - if(dependencyPackageObj.name == name) { - return dependencyPackageObj.version; - } - } else { - return resolveDependencyVersion(path.resolve(location, ".."), name); - } - } - } - - function replaceDependencies(dependencies) { - if(typeof dependencies == "object" && dependencies !== null) { - for(var dependency in dependencies) { - var resolvedVersion = resolveDependencyVersion(process.cwd(), dependency); - - if(resolvedVersion === null) { - process.stderr.write("WARNING: cannot pinpoint dependency: "+dependency+", context: "+process.cwd()+"\n"); - } else { - dependencies[dependency] = resolvedVersion; - } - } - } - } - - /* Read the package.json configuration */ - var packageObj = JSON.parse(fs.readFileSync('./package.json')); - - /* Pinpoint all dependencies */ - replaceDependencies(packageObj.dependencies); - if(process.argv[2] == "development") { - replaceDependencies(packageObj.devDependencies); - } - replaceDependencies(packageObj.optionalDependencies); - - /* Write the fixed package.json file */ - fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); - ''; - }; - in - '' - node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} - - ${lib.optionalString (dependencies != []) - '' - if [ -d node_modules ] - then - cd node_modules - ${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} - cd .. - fi - ''} - ''; - - # Recursively traverses all dependencies of a package and pinpoints all - # dependencies in the package.json file to the versions that are actually - # being used. - - pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args: - '' - if [ -d "${packageName}" ] - then - cd "${packageName}" - ${pinpointDependencies { inherit dependencies production; }} - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - fi - ''; - - # Extract the Node.js source code which is used to compile packages with - # native bindings - nodeSources = runCommand "node-sources" {} '' - tar --no-same-owner --no-same-permissions -xf ${nodejs.src} - mv node-* $out - ''; - - # Script that adds _integrity fields to all package.json files to prevent NPM from consulting the cache (that is empty) - addIntegrityFieldsScript = writeTextFile { - name = "addintegrityfields.js"; - text = '' - var fs = require('fs'); - var path = require('path'); - - function augmentDependencies(baseDir, dependencies) { - for(var dependencyName in dependencies) { - var dependency = dependencies[dependencyName]; - - // Open package.json and augment metadata fields - var packageJSONDir = path.join(baseDir, "node_modules", dependencyName); - var packageJSONPath = path.join(packageJSONDir, "package.json"); - - if(fs.existsSync(packageJSONPath)) { // Only augment packages that exist. Sometimes we may have production installs in which development dependencies can be ignored - console.log("Adding metadata fields to: "+packageJSONPath); - var packageObj = JSON.parse(fs.readFileSync(packageJSONPath)); - - if(dependency.integrity) { - packageObj["_integrity"] = dependency.integrity; - } else { - packageObj["_integrity"] = "sha1-000000000000000000000000000="; // When no _integrity string has been provided (e.g. by Git dependencies), add a dummy one. It does not seem to harm and it bypasses downloads. - } - - if(dependency.resolved) { - packageObj["_resolved"] = dependency.resolved; // Adopt the resolved property if one has been provided - } else { - packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories. - } - - if(dependency.from !== undefined) { // Adopt from property if one has been provided - packageObj["_from"] = dependency.from; - } - - fs.writeFileSync(packageJSONPath, JSON.stringify(packageObj, null, 2)); - } - - // Augment transitive dependencies - if(dependency.dependencies !== undefined) { - augmentDependencies(packageJSONDir, dependency.dependencies); - } - } - } - - if(fs.existsSync("./package-lock.json")) { - var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); - - if(![1, 2].includes(packageLock.lockfileVersion)) { - process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); - process.exit(1); - } - - if(packageLock.dependencies !== undefined) { - augmentDependencies(".", packageLock.dependencies); - } - } - ''; - }; - - # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes - reconstructPackageLock = writeTextFile { - name = "addintegrityfields.js"; - text = '' - var fs = require('fs'); - var path = require('path'); - - var packageObj = JSON.parse(fs.readFileSync("package.json")); - - var lockObj = { - name: packageObj.name, - version: packageObj.version, - lockfileVersion: 1, - requires: true, - dependencies: {} - }; - - function augmentPackageJSON(filePath, dependencies) { - var packageJSON = path.join(filePath, "package.json"); - if(fs.existsSync(packageJSON)) { - var packageObj = JSON.parse(fs.readFileSync(packageJSON)); - dependencies[packageObj.name] = { - version: packageObj.version, - integrity: "sha1-000000000000000000000000000=", - dependencies: {} - }; - processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies); - } - } - - function processDependencies(dir, dependencies) { - if(fs.existsSync(dir)) { - var files = fs.readdirSync(dir); - - files.forEach(function(entry) { - var filePath = path.join(dir, entry); - var stats = fs.statSync(filePath); - - if(stats.isDirectory()) { - if(entry.substr(0, 1) == "@") { - // When we encounter a namespace folder, augment all packages belonging to the scope - var pkgFiles = fs.readdirSync(filePath); - - pkgFiles.forEach(function(entry) { - if(stats.isDirectory()) { - var pkgFilePath = path.join(filePath, entry); - augmentPackageJSON(pkgFilePath, dependencies); - } - }); - } else { - augmentPackageJSON(filePath, dependencies); - } - } - }); - } - } - - processDependencies("node_modules", lockObj.dependencies); - - fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); - ''; - }; - - prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}: - let - forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; - in - '' - # Pinpoint the versions of all dependencies to the ones that are actually being used - echo "pinpointing versions of dependencies..." - source $pinpointDependenciesScriptPath - - # Patch the shebangs of the bundled modules to prevent them from - # calling executables outside the Nix store as much as possible - patchShebangs . - - # Deploy the Node.js package by running npm install. Since the - # dependencies have been provided already by ourselves, it should not - # attempt to install them again, which is good, because we want to make - # it Nix's responsibility. If it needs to install any dependencies - # anyway (e.g. because the dependency parameters are - # incomplete/incorrect), it fails. - # - # The other responsibilities of NPM are kept -- version checks, build - # steps, postprocessing etc. - - export HOME=$TMPDIR - cd "${packageName}" - runHook preRebuild - - ${lib.optionalString bypassCache '' - ${lib.optionalString reconstructLock '' - if [ -f package-lock.json ] - then - echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" - echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!" - rm package-lock.json - else - echo "No package-lock.json file found, reconstructing..." - fi - - node ${reconstructPackageLock} - ''} - - node ${addIntegrityFieldsScript} - ''} - - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild - - if [ "''${dontNpmInstall-}" != "1" ] - then - # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. - rm -f npm-shrinkwrap.json - - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install - fi - ''; - - # Builds and composes an NPM package including all its dependencies - buildNodePackage = - { name - , packageName - , version - , dependencies ? [] - , buildInputs ? [] - , production ? true - , npmFlags ? "" - , dontNpmInstall ? false - , bypassCache ? false - , reconstructLock ? false - , preRebuild ? "" - , dontStrip ? true - , unpackPhase ? "true" - , buildPhase ? "true" - , meta ? {} - , ... }@args: - - let - extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ]; - in - stdenv.mkDerivation ({ - name = "${name}-${version}"; - buildInputs = [ tarWrapper python nodejs ] - ++ lib.optional (stdenv.isLinux) utillinux - ++ lib.optional (stdenv.isDarwin) libtool - ++ buildInputs; - - inherit nodejs; - - inherit dontStrip; # Stripping may fail a build for some package deployments - inherit dontNpmInstall preRebuild unpackPhase buildPhase; - - compositionScript = composePackage args; - pinpointDependenciesScript = pinpointDependenciesOfPackage args; - - passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; - - installPhase = '' - source ${installPackage} - - # Create and enter a root node_modules/ folder - mkdir -p $out/lib/node_modules - cd $out/lib/node_modules - - # Compose the package and all its dependencies - source $compositionScriptPath - - ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} - - # Create symlink to the deployed executable folder, if applicable - if [ -d "$out/lib/node_modules/.bin" ] - then - ln -s $out/lib/node_modules/.bin $out/bin - fi - - # Create symlinks to the deployed manual page folders, if applicable - if [ -d "$out/lib/node_modules/${packageName}/man" ] - then - mkdir -p $out/share - for dir in "$out/lib/node_modules/${packageName}/man/"* - do - mkdir -p $out/share/man/$(basename "$dir") - for page in "$dir"/* - do - ln -s $page $out/share/man/$(basename "$dir") - done - done - fi - - # Run post install hook, if provided - runHook postInstall - ''; - - meta = { - # default to Node.js' platforms - platforms = nodejs.meta.platforms; - } // meta; - } // extraArgs); - - # Builds a node environment (a node_modules folder and a set of binaries) - buildNodeDependencies = - { name - , packageName - , version - , src - , dependencies ? [] - , buildInputs ? [] - , production ? true - , npmFlags ? "" - , dontNpmInstall ? false - , bypassCache ? false - , reconstructLock ? false - , dontStrip ? true - , unpackPhase ? "true" - , buildPhase ? "true" - , ... }@args: - - let - extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; - in - stdenv.mkDerivation ({ - name = "node-dependencies-${name}-${version}"; - - buildInputs = [ tarWrapper python nodejs ] - ++ lib.optional (stdenv.isLinux) utillinux - ++ lib.optional (stdenv.isDarwin) libtool - ++ buildInputs; - - inherit dontStrip; # Stripping may fail a build for some package deployments - inherit dontNpmInstall unpackPhase buildPhase; - - includeScript = includeDependencies { inherit dependencies; }; - pinpointDependenciesScript = pinpointDependenciesOfPackage args; - - passAsFile = [ "includeScript" "pinpointDependenciesScript" ]; - - installPhase = '' - source ${installPackage} - - mkdir -p $out/${packageName} - cd $out/${packageName} - - source $includeScriptPath - - # Create fake package.json to make the npm commands work properly - cp ${src}/package.json . - chmod 644 package.json - ${lib.optionalString bypassCache '' - if [ -f ${src}/package-lock.json ] - then - cp ${src}/package-lock.json . - fi - ''} - - # Go to the parent folder to make sure that all packages are pinpointed - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - - ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} - - # Expose the executables that were installed - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - - mv ${packageName} lib - ln -s $out/lib/node_modules/.bin $out/bin - ''; - } // extraArgs); - - # Builds a development shell - buildNodeShell = - { name - , packageName - , version - , src - , dependencies ? [] - , buildInputs ? [] - , production ? true - , npmFlags ? "" - , dontNpmInstall ? false - , bypassCache ? false - , reconstructLock ? false - , dontStrip ? true - , unpackPhase ? "true" - , buildPhase ? "true" - , ... }@args: - - let - nodeDependencies = buildNodeDependencies args; - in - stdenv.mkDerivation { - name = "node-shell-${name}-${version}"; - - buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs; - buildCommand = '' - mkdir -p $out/bin - cat > $out/bin/shell < { + inherit system; + }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_18"}: + +let + nodeEnv = import ./node-env.nix { + inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; + inherit pkgs nodejs; + libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; + }; +in +import ./node-packages.nix { + inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; + inherit nodeEnv; +} diff --git a/purs-backend-es/default.nix b/purs-backend-es/default.nix new file mode 100644 index 0000000..d74f0b7 --- /dev/null +++ b/purs-backend-es/default.nix @@ -0,0 +1,8 @@ +# How to generate the files in this directory: +# +# nix run nixpkgs#node2nix -- -i <(echo '["purs-backend-es"]') -c composition.nix -18 +# + +{ pkgs ? import { } }: + +(import ./composition.nix { inherit pkgs; }).purs-backend-es diff --git a/pulp/16.0.0-0/node-env.nix b/purs-backend-es/node-env.nix similarity index 79% rename from pulp/16.0.0-0/node-env.nix rename to purs-backend-es/node-env.nix index 5f05578..bc1e366 100644 --- a/pulp/16.0.0-0/node-env.nix +++ b/purs-backend-es/node-env.nix @@ -98,7 +98,7 @@ let '' + (lib.concatMapStrings (dependency: '' - if [ ! -e "${dependency.name}" ]; then + if [ ! -e "${dependency.packageName}" ]; then ${composePackage dependency} fi '' @@ -165,7 +165,11 @@ let if(process.argv[2] == "development") { replaceDependencies(packageObj.devDependencies); } + else { + packageObj.devDependencies = {}; + } replaceDependencies(packageObj.optionalDependencies); + replaceDependencies(packageObj.peerDependencies); /* Write the fixed package.json file */ fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); @@ -257,8 +261,8 @@ let var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); if(![1, 2].includes(packageLock.lockfileVersion)) { - process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); - process.exit(1); + process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); + process.exit(1); } if(packageLock.dependencies !== undefined) { @@ -270,7 +274,7 @@ let # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes reconstructPackageLock = writeTextFile { - name = "addintegrityfields.js"; + name = "reconstructpackagelock.js"; text = '' var fs = require('fs'); var path = require('path'); @@ -280,25 +284,43 @@ let var lockObj = { name: packageObj.name, version: packageObj.version, - lockfileVersion: 1, + lockfileVersion: 2, requires: true, + packages: { + "": { + name: packageObj.name, + version: packageObj.version, + license: packageObj.license, + bin: packageObj.bin, + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + } + }, dependencies: {} }; - function augmentPackageJSON(filePath, dependencies) { + function augmentPackageJSON(filePath, packages, dependencies) { var packageJSON = path.join(filePath, "package.json"); if(fs.existsSync(packageJSON)) { var packageObj = JSON.parse(fs.readFileSync(packageJSON)); + packages[filePath] = { + version: packageObj.version, + integrity: "sha1-000000000000000000000000000=", + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + }; dependencies[packageObj.name] = { version: packageObj.version, integrity: "sha1-000000000000000000000000000=", dependencies: {} }; - processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies); + processDependencies(path.join(filePath, "node_modules"), packages, dependencies[packageObj.name].dependencies); } } - function processDependencies(dir, dependencies) { + function processDependencies(dir, packages, dependencies) { if(fs.existsSync(dir)) { var files = fs.readdirSync(dir); @@ -314,23 +336,84 @@ let pkgFiles.forEach(function(entry) { if(stats.isDirectory()) { var pkgFilePath = path.join(filePath, entry); - augmentPackageJSON(pkgFilePath, dependencies); + augmentPackageJSON(pkgFilePath, packages, dependencies); } }); } else { - augmentPackageJSON(filePath, dependencies); + augmentPackageJSON(filePath, packages, dependencies); } } }); } } - processDependencies("node_modules", lockObj.dependencies); + processDependencies("node_modules", lockObj.packages, lockObj.dependencies); fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); ''; }; + # Script that links bins defined in package.json to the node_modules bin directory + # NPM does not do this for top-level packages itself anymore as of v7 + linkBinsScript = writeTextFile { + name = "linkbins.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + var packageObj = JSON.parse(fs.readFileSync("package.json")); + + var nodeModules = Array(packageObj.name.split("/").length).fill("..").join(path.sep); + + if(packageObj.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + if(typeof packageObj.bin == "object") { + Object.keys(packageObj.bin).forEach(function(exe) { + if(fs.existsSync(packageObj.bin[exe])) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin[exe]), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + else { + if(fs.existsSync(packageObj.bin)) { + console.log("linking bin '" + packageObj.bin + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin), + path.join(nodeModules, ".bin", packageObj.name.split("/").pop()) + ); + } + else { + console.log("skipping non-existent bin '" + packageObj.bin + "'"); + } + } + } + else if(packageObj.directories !== undefined && packageObj.directories.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + fs.readdirSync(packageObj.directories.bin).forEach(function(exe) { + if(fs.existsSync(path.join(packageObj.directories.bin, exe))) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.directories.bin, exe), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + ''; + }; + prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}: let forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; @@ -377,20 +460,25 @@ let npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild + runHook postRebuild + if [ "''${dontNpmInstall-}" != "1" ] then # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. rm -f npm-shrinkwrap.json - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install + npm ${forceOfflineFlag} --nodedir=${nodeSources} --no-bin-links --ignore-scripts ${npmFlags} ${lib.optionalString production "--production"} install fi + + # Link executables defined in package.json + node ${linkBinsScript} ''; # Builds and composes an NPM package including all its dependencies buildNodePackage = { name , packageName - , version + , version ? null , dependencies ? [] , buildInputs ? [] , production ? true @@ -409,7 +497,7 @@ let extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ]; in stdenv.mkDerivation ({ - name = "${name}-${version}"; + name = "${name}${if version == null then "" else "-${version}"}"; buildInputs = [ tarWrapper python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ lib.optional (stdenv.isDarwin) libtool @@ -441,6 +529,17 @@ let if [ -d "$out/lib/node_modules/.bin" ] then ln -s $out/lib/node_modules/.bin $out/bin + + # Fixup all executables + ls $out/bin/* | while read i + do + file="$(readlink -f "$i")" + chmod u+rwx "$file" + if isScript "$file" + then + sed -i 's/\r$//' "$file" # convert crlf to lf + fi + done fi # Create symlinks to the deployed manual page folders, if applicable @@ -471,7 +570,7 @@ let buildNodeDependencies = { name , packageName - , version + , version ? null , src , dependencies ? [] , buildInputs ? [] @@ -489,7 +588,7 @@ let extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; in stdenv.mkDerivation ({ - name = "node-dependencies-${name}-${version}"; + name = "node-dependencies-${name}${if version == null then "" else "-${version}"}"; buildInputs = [ tarWrapper python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux @@ -519,6 +618,7 @@ let if [ -f ${src}/package-lock.json ] then cp ${src}/package-lock.json . + chmod 644 package-lock.json fi ''} @@ -541,7 +641,7 @@ let buildNodeShell = { name , packageName - , version + , version ? null , src , dependencies ? [] , buildInputs ? [] @@ -557,9 +657,10 @@ let let nodeDependencies = buildNodeDependencies args; + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "unpackPhase" "buildPhase" ]; in - stdenv.mkDerivation { - name = "node-shell-${name}-${version}"; + stdenv.mkDerivation ({ + name = "node-shell-${name}${if version == null then "" else "-${version}"}"; buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs; buildCommand = '' @@ -578,7 +679,7 @@ let export NODE_PATH=${nodeDependencies}/lib/node_modules export PATH="${nodeDependencies}/bin:$PATH" ''; - }; + } // extraArgs); in { buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist; diff --git a/purs-backend-es/node-packages.nix b/purs-backend-es/node-packages.nix new file mode 100644 index 0000000..7450f21 --- /dev/null +++ b/purs-backend-es/node-packages.nix @@ -0,0 +1,27 @@ +# This file has been generated by node2nix 1.11.1. Do not edit! + +{nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}: + +let + sources = {}; +in +{ + purs-backend-es = nodeEnv.buildNodePackage { + name = "purs-backend-es"; + packageName = "purs-backend-es"; + version = "1.3.2"; + src = fetchurl { + url = "https://registry.npmjs.org/purs-backend-es/-/purs-backend-es-1.3.2.tgz"; + sha512 = "ujfo3eb+fnLvNR9wpa0ep/grSAZMybZB4aibdzBYLrm6PjRGJP7sDg0Nw/zMOAeMOYXFJtzVlxNbrsWjzKxWqQ=="; + }; + buildInputs = globalBuildInputs; + meta = { + description = "A modern ECMAScript optimizing backend for PureScript"; + homepage = "https://github.com/aristanetworks/purescript-backend-optimizer#readme"; + license = "MIT"; + }; + production = true; + bypassCache = true; + reconstructLock = true; + }; +} diff --git a/purs-tidy/composition.nix b/purs-tidy/composition.nix new file mode 100644 index 0000000..d9c0dae --- /dev/null +++ b/purs-tidy/composition.nix @@ -0,0 +1,17 @@ +# This file has been generated by node2nix 1.11.1. Do not edit! + +{pkgs ? import { + inherit system; + }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_18"}: + +let + nodeEnv = import ./node-env.nix { + inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; + inherit pkgs nodejs; + libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; + }; +in +import ./node-packages.nix { + inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; + inherit nodeEnv; +} diff --git a/purs-tidy/default.nix b/purs-tidy/default.nix index f058e4d..7ee2ffd 100644 --- a/purs-tidy/default.nix +++ b/purs-tidy/default.nix @@ -1,22 +1,7 @@ -{ pkgs ? import { inherit system; } -, system ? builtins.currentSystem -, nodejs ? pkgs."nodejs-14_x" -}: +# How to generate the files in this directory: +# +# nix run nixpkgs#node2nix -- -i <(echo '["purs-tidy"]') -c composition.nix -18 +# +{ pkgs ? import { } }: -let - version = "0.9.2"; - - nodeEnv = import ./node-env.nix { - inherit (pkgs) stdenv lib python2 runCommand writeTextFile; - inherit pkgs nodejs; - libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; - }; - - nodePackage = import ./node-packages.nix { - inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; - inherit nodeEnv; - }; - - source = nodePackage.sources."purs-tidy-${version}".src; -in -nodeEnv.buildNodePackage (nodePackage.args // { src = source; }) +(import ./composition.nix { inherit pkgs; }).purs-tidy diff --git a/purs-tidy/node-env.nix b/purs-tidy/node-env.nix index c2b7231..bc1e366 100644 --- a/purs-tidy/node-env.nix +++ b/purs-tidy/node-env.nix @@ -1,6 +1,6 @@ # This file originates from node2nix -{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile}: +{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}: let # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master @@ -40,36 +40,22 @@ let ''; }; - includeDependencies = {dependencies}: - lib.optionalString (dependencies != []) - (lib.concatMapStrings (dependency: - '' - # Bundle the dependencies of the package - mkdir -p node_modules - cd node_modules - - # Only include dependencies if they don't exist. They may also be bundled in the package. - if [ ! -e "${dependency.name}" ] - then - ${composePackage dependency} - fi + # Common shell logic + installPackage = writeShellScript "install-package" '' + installPackage() { + local packageName=$1 src=$2 - cd .. - '' - ) dependencies); + local strippedName - # Recursively composes the dependencies of a package - composePackage = { name, packageName, src, dependencies ? [], ... }@args: - builtins.addErrorContext "while evaluating node package '${packageName}'" '' - DIR=$(pwd) + local DIR=$PWD cd $TMPDIR - unpackFile ${src} + unpackFile $src # Make the base dir in which the target dependency resides first - mkdir -p "$(dirname "$DIR/${packageName}")" + mkdir -p "$(dirname "$DIR/$packageName")" - if [ -f "${src}" ] + if [ -f "$src" ] then # Figure out what directory has been unpacked packageDir="$(find . -maxdepth 1 -type d | tail -1)" @@ -79,28 +65,53 @@ let chmod -R u+w "$packageDir" # Move the extracted tarball into the output folder - mv "$packageDir" "$DIR/${packageName}" - elif [ -d "${src}" ] + mv "$packageDir" "$DIR/$packageName" + elif [ -d "$src" ] then # Get a stripped name (without hash) of the source directory. # On old nixpkgs it's already set internally. if [ -z "$strippedName" ] then - strippedName="$(stripHash ${src})" + strippedName="$(stripHash $src)" fi # Restore write permissions to make building work chmod -R u+w "$strippedName" # Move the extracted directory into the output folder - mv "$strippedName" "$DIR/${packageName}" + mv "$strippedName" "$DIR/$packageName" fi - # Unset the stripped name to not confuse the next unpack step - unset strippedName + # Change to the package directory to install dependencies + cd "$DIR/$packageName" + } + ''; - # Include the dependencies of the package - cd "$DIR/${packageName}" + # Bundle the dependencies of the package + # + # Only include dependencies if they don't exist. They may also be bundled in the package. + includeDependencies = {dependencies}: + lib.optionalString (dependencies != []) ( + '' + mkdir -p node_modules + cd node_modules + '' + + (lib.concatMapStrings (dependency: + '' + if [ ! -e "${dependency.packageName}" ]; then + ${composePackage dependency} + fi + '' + ) dependencies) + + '' + cd .. + '' + ); + + # Recursively composes the dependencies of a package + composePackage = { name, packageName, src, dependencies ? [], ... }@args: + builtins.addErrorContext "while evaluating node package '${packageName}'" '' + installPackage "${packageName}" "${src}" ${includeDependencies { inherit dependencies; }} cd .. ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} @@ -154,7 +165,11 @@ let if(process.argv[2] == "development") { replaceDependencies(packageObj.devDependencies); } + else { + packageObj.devDependencies = {}; + } replaceDependencies(packageObj.optionalDependencies); + replaceDependencies(packageObj.peerDependencies); /* Write the fixed package.json file */ fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); @@ -246,8 +261,8 @@ let var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); if(![1, 2].includes(packageLock.lockfileVersion)) { - process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); - process.exit(1); + process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); + process.exit(1); } if(packageLock.dependencies !== undefined) { @@ -259,7 +274,7 @@ let # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes reconstructPackageLock = writeTextFile { - name = "addintegrityfields.js"; + name = "reconstructpackagelock.js"; text = '' var fs = require('fs'); var path = require('path'); @@ -269,25 +284,43 @@ let var lockObj = { name: packageObj.name, version: packageObj.version, - lockfileVersion: 1, + lockfileVersion: 2, requires: true, + packages: { + "": { + name: packageObj.name, + version: packageObj.version, + license: packageObj.license, + bin: packageObj.bin, + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + } + }, dependencies: {} }; - function augmentPackageJSON(filePath, dependencies) { + function augmentPackageJSON(filePath, packages, dependencies) { var packageJSON = path.join(filePath, "package.json"); if(fs.existsSync(packageJSON)) { var packageObj = JSON.parse(fs.readFileSync(packageJSON)); + packages[filePath] = { + version: packageObj.version, + integrity: "sha1-000000000000000000000000000=", + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + }; dependencies[packageObj.name] = { version: packageObj.version, integrity: "sha1-000000000000000000000000000=", dependencies: {} }; - processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies); + processDependencies(path.join(filePath, "node_modules"), packages, dependencies[packageObj.name].dependencies); } } - function processDependencies(dir, dependencies) { + function processDependencies(dir, packages, dependencies) { if(fs.existsSync(dir)) { var files = fs.readdirSync(dir); @@ -303,23 +336,84 @@ let pkgFiles.forEach(function(entry) { if(stats.isDirectory()) { var pkgFilePath = path.join(filePath, entry); - augmentPackageJSON(pkgFilePath, dependencies); + augmentPackageJSON(pkgFilePath, packages, dependencies); } }); } else { - augmentPackageJSON(filePath, dependencies); + augmentPackageJSON(filePath, packages, dependencies); } } }); } } - processDependencies("node_modules", lockObj.dependencies); + processDependencies("node_modules", lockObj.packages, lockObj.dependencies); fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); ''; }; + # Script that links bins defined in package.json to the node_modules bin directory + # NPM does not do this for top-level packages itself anymore as of v7 + linkBinsScript = writeTextFile { + name = "linkbins.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + var packageObj = JSON.parse(fs.readFileSync("package.json")); + + var nodeModules = Array(packageObj.name.split("/").length).fill("..").join(path.sep); + + if(packageObj.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + if(typeof packageObj.bin == "object") { + Object.keys(packageObj.bin).forEach(function(exe) { + if(fs.existsSync(packageObj.bin[exe])) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin[exe]), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + else { + if(fs.existsSync(packageObj.bin)) { + console.log("linking bin '" + packageObj.bin + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin), + path.join(nodeModules, ".bin", packageObj.name.split("/").pop()) + ); + } + else { + console.log("skipping non-existent bin '" + packageObj.bin + "'"); + } + } + } + else if(packageObj.directories !== undefined && packageObj.directories.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + fs.readdirSync(packageObj.directories.bin).forEach(function(exe) { + if(fs.existsSync(path.join(packageObj.directories.bin, exe))) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.directories.bin, exe), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + ''; + }; + prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}: let forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; @@ -366,20 +460,25 @@ let npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild + runHook postRebuild + if [ "''${dontNpmInstall-}" != "1" ] then # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. rm -f npm-shrinkwrap.json - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install + npm ${forceOfflineFlag} --nodedir=${nodeSources} --no-bin-links --ignore-scripts ${npmFlags} ${lib.optionalString production "--production"} install fi + + # Link executables defined in package.json + node ${linkBinsScript} ''; # Builds and composes an NPM package including all its dependencies buildNodePackage = { name , packageName - , version + , version ? null , dependencies ? [] , buildInputs ? [] , production ? true @@ -391,13 +490,14 @@ let , dontStrip ? true , unpackPhase ? "true" , buildPhase ? "true" + , meta ? {} , ... }@args: let - extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ]; + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ]; in stdenv.mkDerivation ({ - name = "node_${name}-${version}"; + name = "${name}${if version == null then "" else "-${version}"}"; buildInputs = [ tarWrapper python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ lib.optional (stdenv.isDarwin) libtool @@ -414,6 +514,8 @@ let passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; installPhase = '' + source ${installPackage} + # Create and enter a root node_modules/ folder mkdir -p $out/lib/node_modules cd $out/lib/node_modules @@ -427,6 +529,17 @@ let if [ -d "$out/lib/node_modules/.bin" ] then ln -s $out/lib/node_modules/.bin $out/bin + + # Fixup all executables + ls $out/bin/* | while read i + do + file="$(readlink -f "$i")" + chmod u+rwx "$file" + if isScript "$file" + then + sed -i 's/\r$//' "$file" # convert crlf to lf + fi + done fi # Create symlinks to the deployed manual page folders, if applicable @@ -446,13 +559,18 @@ let # Run post install hook, if provided runHook postInstall ''; + + meta = { + # default to Node.js' platforms + platforms = nodejs.meta.platforms; + } // meta; } // extraArgs); # Builds a node environment (a node_modules folder and a set of binaries) buildNodeDependencies = { name , packageName - , version + , version ? null , src , dependencies ? [] , buildInputs ? [] @@ -470,7 +588,7 @@ let extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; in stdenv.mkDerivation ({ - name = "node-dependencies-${name}-${version}"; + name = "node-dependencies-${name}${if version == null then "" else "-${version}"}"; buildInputs = [ tarWrapper python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux @@ -486,6 +604,8 @@ let passAsFile = [ "includeScript" "pinpointDependenciesScript" ]; installPhase = '' + source ${installPackage} + mkdir -p $out/${packageName} cd $out/${packageName} @@ -498,6 +618,7 @@ let if [ -f ${src}/package-lock.json ] then cp ${src}/package-lock.json . + chmod 644 package-lock.json fi ''} @@ -520,7 +641,7 @@ let buildNodeShell = { name , packageName - , version + , version ? null , src , dependencies ? [] , buildInputs ? [] @@ -536,9 +657,10 @@ let let nodeDependencies = buildNodeDependencies args; + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "unpackPhase" "buildPhase" ]; in - stdenv.mkDerivation { - name = "node-shell-${name}-${version}"; + stdenv.mkDerivation ({ + name = "node-shell-${name}${if version == null then "" else "-${version}"}"; buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs; buildCommand = '' @@ -557,7 +679,7 @@ let export NODE_PATH=${nodeDependencies}/lib/node_modules export PATH="${nodeDependencies}/bin:$PATH" ''; - }; + } // extraArgs); in { buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist; diff --git a/purs-tidy/node-packages.nix b/purs-tidy/node-packages.nix index 6f88888..62db772 100644 --- a/purs-tidy/node-packages.nix +++ b/purs-tidy/node-packages.nix @@ -1,51 +1,27 @@ -# This file has been generated by node2nix 1.9.0. Do not edit! +# This file has been generated by node2nix 1.11.1. Do not edit! {nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}: let - sources = { - "purs-tidy-0.9.2" = { - name = "purs-tidy"; - packageName = "purs-tidy"; - version = "0.9.2"; - src = fetchurl { - url = "https://registry.npmjs.org/purs-tidy/-/purs-tidy-0.9.2.tgz"; - sha512 = "2jl64h8im6550gfk3m4390fbwpmla3gg1pr6j7bnphjgy0h8nb1xcx5c65835sgkfdw7572c1rd2617dmg2lmqj2am67isk9zhfic5z"; - }; - }; - }; - args = { + sources = {}; +in +{ + purs-tidy = nodeEnv.buildNodePackage { name = "purs-tidy"; packageName = "purs-tidy"; - version = "0.9.2"; - src = ./.; - dependencies = [ - sources."purs-tidy-0.9.2" - ]; + version = "0.10.0"; + src = fetchurl { + url = "https://registry.npmjs.org/purs-tidy/-/purs-tidy-0.10.0.tgz"; + sha512 = "ULbJfBHRngczYwcOzugytRiNy+Guy2VXoAG1jMtGaSFEaUZk1lZkKU11t8jIZTrDdOrkgqlWCZLi3mfcHvdimA=="; + }; buildInputs = globalBuildInputs; meta = { + description = "A syntax tidy-upper (formatter) for PureScript."; + homepage = "https://github.com/natefaubion/purescript-tidy#readme"; + license = "MIT"; }; production = true; bypassCache = true; reconstructLock = true; }; -in -{ - args = args; - sources = sources; - tarball = nodeEnv.buildNodeSourceDist args; - package = nodeEnv.buildNodePackage args; - shell = nodeEnv.buildNodeShell args; - nodeDependencies = nodeEnv.buildNodeDependencies (lib.overrideExisting args { - src = stdenv.mkDerivation { - name = args.name + "-package-json"; - src = nix-gitignore.gitignoreSourcePure [ - "*" - "!package.json" - "!package-lock.json" - ] args.src; - dontBuild = true; - installPhase = "mkdir -p $out; cp -r ./* $out;"; - }; - }); } diff --git a/spago2nix.nix b/spago2nix.nix index e7fe623..7a62b9f 100644 --- a/spago2nix.nix +++ b/spago2nix.nix @@ -1,5 +1,5 @@ { pkgs ? import { } -, nodejs ? pkgs."nodejs-14_x" +, nodejs ? pkgs."nodejs-18_x" }: import @@ -7,8 +7,8 @@ import pkgs.fetchFromGitHub { owner = "justinwoo"; repo = "spago2nix"; - rev = "da4a833b53f9139e596f89ad89d892f4f60fc179"; - sha256 = "sha256-oTBdCpCJmuMQ6nYR1+tamL9xDPm720dRVxsKtKOzTfs="; + rev = "1b8ec352bc7eac077b934d6b9f6efa0129926e59"; + sha256 = "sha256-h9r67pmvDuA3TV9299L4CN60XSm8RRtX1EwUoKu9Pyw="; } ) { -- 2.45.2