Update nodePackages to latest npm2nix
This version has a much cleaner interface, should require fewer major version bumps Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
parent
7cda7d5fa7
commit
33575ab335
File diff suppressed because it is too large
Load Diff
@ -1,39 +1,6 @@
|
||||
{ pkgs, stdenv, nodejs, fetchurl, neededNatives, self }:
|
||||
|
||||
let
|
||||
inherit (self) buildNodePackage patchLatest;
|
||||
|
||||
importGeneratedPackages = generated: nativeDeps: self:
|
||||
let
|
||||
nativeDepsList = { name, spec }:
|
||||
let
|
||||
nameOr = if builtins.hasAttr name nativeDeps
|
||||
then builtins.getAttr name nativeDeps
|
||||
else {};
|
||||
depsOr = if builtins.hasAttr spec nameOr
|
||||
then builtins.getAttr spec nameOr
|
||||
else [];
|
||||
in depsOr;
|
||||
full = pkgs.lib.mapAttrs (name: specs: pkgs.lib.mapAttrs (spec: pkg:
|
||||
pkgs.lib.makeOverridable buildNodePackage {
|
||||
name = "${name}-${pkg.version}";
|
||||
src = (if pkg.patchLatest then patchLatest else fetchurl) {
|
||||
url = pkg.tarball;
|
||||
sha1 = pkg.sha1 or "";
|
||||
sha256 = pkg.sha256 or "";
|
||||
};
|
||||
deps = map (dep: builtins.getAttr dep.spec (builtins.getAttr dep.name self.full)) pkg.dependencies;
|
||||
peerDeps = map (dep: builtins.getAttr dep.spec (builtins.getAttr dep.name self.full)) pkg.peerDependencies;
|
||||
buildInputs = nativeDepsList { inherit name spec; };
|
||||
}
|
||||
) specs) (removeAttrs generated [ "#topLevel" ]);
|
||||
topLevel = pkgs.lib.mapAttrs (name: spec:
|
||||
builtins.getAttr spec (builtins.getAttr name self.full)
|
||||
) generated."#topLevel" or {};
|
||||
in topLevel // { inherit full; };
|
||||
in {
|
||||
inherit importGeneratedPackages;
|
||||
|
||||
{
|
||||
nativeDeps = {
|
||||
"node-expat"."*" = [ pkgs.expat ];
|
||||
"rbytes"."0.0.2" = [ pkgs.openssl ];
|
||||
@ -55,4 +22,4 @@ in {
|
||||
'';
|
||||
|
||||
/* Put manual packages below here (ideally eventually managed by npm2nix */
|
||||
} // importGeneratedPackages (import ./node-packages-generated.nix) self.nativeDeps self
|
||||
} // import ./node-packages-generated.nix { inherit self fetchurl; inherit (pkgs) lib; }
|
||||
|
Loading…
Reference in New Issue
Block a user