nodePackages: use latest node2nix

This commit is contained in:
happysalada 2022-05-02 00:46:16 -04:00
parent 005438b129
commit 91bbd5677d
5 changed files with 3310 additions and 3753 deletions

View File

@ -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!
{pkgs ? import <nixpkgs> {
inherit system;

View File

@ -247,44 +247,14 @@ let
node2nix = super.node2nix.override {
buildInputs = [ pkgs.makeWrapper ];
# We need to apply a patch to the source, but buildNodePackage doesn't allow patches.
# So we pin the patched commit instead. The commit actually contains two other newer commits
# since the last (1.9.0) release, but actually this is a good thing since one of them is a
# Hydra-specific fix.
src = applyPatches {
src = fetchFromGitHub {
owner = "svanderburg";
repo = "node2nix";
rev = "node2nix-1.9.0";
sha256 = "0l4wp1131nhl9c14cn8bwawb8f77h1nfbnswgi5lp5m3kzkb27jn";
};
patches = [
# remove node_ name prefix
(fetchpatch {
url = "https://github.com/svanderburg/node2nix/commit/b54d45207427ff46e90f16f2f32771fdc8bff5a4.patch";
sha256 = "sha256-ubUdF0q3l4xxqZ7f9EiQEUQzyqxi9Q6zsRPETHlfzh8=";
})
# set meta platform
(fetchpatch {
url = "https://github.com/svanderburg/node2nix/commit/58736093161f2d237c17e75a96529b018cd0ac64.patch";
sha256 = "0sif7803c9g6gjmmdniw5qxrq5igiz9nqdmdrcf1hxfi5x43a32h";
})
# Extract common logic from composePackage to a shell function
(fetchpatch {
url = "https://github.com/svanderburg/node2nix/commit/e4c951971df6c9f9584c7252971c13b55c369916.patch";
sha256 = "0w8fcyr12g2340rn06isv40jkmz2khmak81c95zpkjgipzx7hp7w";
})
# handle package alias in dependencies
# https://github.com/svanderburg/node2nix/pull/240
#
# TODO: remove after node2nix 1.10.0
(fetchpatch {
url = "https://github.com/svanderburg/node2nix/commit/644e90c0304038a446ed53efc97e9eb1e2831e71.patch";
sha256 = "sha256-sQgVf80H1ouUjzHq+2d9RO4a+o++kh+l+FOTNXfPBH0=";
})
];
# We need to use master because of a fix that replaces git:// url to https://.
src = fetchFromGitHub {
owner = "svanderburg";
repo = "node2nix";
rev = "68f5735f9a56737e3fedceb182705985e3ab8799";
sha256 = "sha256-NK6gDTkGx0GG7yPTwgtFC4ttQZPfcLaLp8W8OOMO6bg=";
};
postInstall = ''
wrapProgram "$out/bin/node2nix" --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.nix ]}
'';

View File

@ -98,7 +98,7 @@ let
''
+ (lib.concatMapStrings (dependency:
''
if [ ! -e "${dependency.name}" ]; then
if [ ! -e "${dependency.packageName}" ]; then
${composePackage dependency}
fi
''
@ -257,8 +257,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) {
@ -390,7 +390,7 @@ let
buildNodePackage =
{ name
, packageName
, version
, version ? null
, dependencies ? []
, buildInputs ? []
, production ? true
@ -409,7 +409,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 +441,14 @@ let
if [ -d "$out/lib/node_modules/.bin" ]
then
ln -s $out/lib/node_modules/.bin $out/bin
# Patch the shebang lines of all the executables
ls $out/bin/* | while read i
do
file="$(readlink -f "$i")"
chmod u+rwx "$file"
patchShebangs "$file"
done
fi
# Create symlinks to the deployed manual page folders, if applicable
@ -471,7 +479,7 @@ let
buildNodeDependencies =
{ name
, packageName
, version
, version ? null
, src
, dependencies ? []
, buildInputs ? []
@ -489,7 +497,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 +527,7 @@ let
if [ -f ${src}/package-lock.json ]
then
cp ${src}/package-lock.json .
chmod 644 package-lock.json
fi
''}
@ -541,7 +550,7 @@ let
buildNodeShell =
{ name
, packageName
, version
, version ? null
, src
, dependencies ? []
, buildInputs ? []
@ -557,9 +566,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 +588,7 @@ let
export NODE_PATH=${nodeDependencies}/lib/node_modules
export PATH="${nodeDependencies}/bin:$PATH"
'';
};
} // extraArgs);
in
{
buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist;

View File

@ -131,7 +131,7 @@
, "flood"
, "forever"
, "fx"
, "ganache-cli"
, "ganache"
, "gatsby-cli"
, "generator-code"
, "get-graphql-schema"
@ -223,7 +223,6 @@
, "npm"
, "npm-check-updates"
, "npm-merge-driver"
, {"npm2nix": "git://github.com/NixOS/npm2nix.git#5.12.0"}
, "nrm"
, "ocaml-language-server"
, "parcel-bundler"

File diff suppressed because it is too large Load Diff