mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-08-16 18:00:30 +03:00
fix node2nix builder
This commit is contained in:
parent
35eeba24df
commit
e4b9717fa2
@ -54,6 +54,7 @@
|
||||
|
||||
devShell = forAllSystems (system: nixpkgsFor."${system}".mkShell {
|
||||
buildInputs = with nixpkgsFor."${system}"; [
|
||||
cntr
|
||||
nixUnstable
|
||||
];
|
||||
shellHook = ''
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
### Bad caching
|
||||
- packages are all unpacked at once inside a build instead of in individual derivations
|
||||
- packages are unpackged several times in different directories (symlinks could be used)
|
||||
|
||||
### Bad build performance
|
||||
- unpacking is done sequentially
|
||||
|
@ -3,7 +3,6 @@
|
||||
{
|
||||
externals,
|
||||
node2nix ? externals.node2nix,
|
||||
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
@ -24,29 +23,33 @@ let
|
||||
|
||||
node2nixEnv = node2nix nodejs;
|
||||
|
||||
# make node2nix compatible sources
|
||||
makeSource = name: {
|
||||
name = lib.head (lib.splitString "#" name);
|
||||
packageName = lib.head (lib.splitString "#" name);
|
||||
version = dreamLock.sources."${name}".version;
|
||||
src = fetchedSources."${name}";
|
||||
dependencies = lib.forEach dreamLock.generic.dependencyGraph."${name}" or [] (dependency:
|
||||
makeSource dependency
|
||||
);
|
||||
};
|
||||
node2nixDependencies =
|
||||
let
|
||||
makeSource = name: {
|
||||
name = lib.head (lib.splitString "#" name);
|
||||
packageName = lib.head (lib.splitString "#" name);
|
||||
version = dreamLock.sources."${name}".version;
|
||||
src = fetchedSources."${name}";
|
||||
dependencies =
|
||||
lib.forEach
|
||||
(lib.filter
|
||||
(depName: ! builtins.elem depName dreamLock.generic.dependencyGraph."${mainPackageName}")
|
||||
(dreamLock.generic.dependencyGraph."${name}" or []))
|
||||
(dependency:
|
||||
makeSource dependency
|
||||
);
|
||||
};
|
||||
in
|
||||
lib.forEach
|
||||
dreamLock.generic.dependencyGraph."${mainPackageName}"
|
||||
(dependency: makeSource dependency);
|
||||
|
||||
callNode2Nix = funcName: args:
|
||||
node2nixEnv."${funcName}" rec {
|
||||
name = mainPackageName;
|
||||
packageName = name;
|
||||
version = dreamLock.sources."${mainPackageName}".version;
|
||||
dependencies =
|
||||
lib.forEach
|
||||
(lib.filter
|
||||
(pname: pname != mainPackageName)
|
||||
(lib.attrNames dreamLock.generic.dependencyGraph)
|
||||
)
|
||||
(dependency: makeSource dependency);
|
||||
dependencies = node2nixDependencies;
|
||||
# buildInputs ? []
|
||||
# npmFlags ? ""
|
||||
# dontNpmInstall ? false
|
||||
|
@ -117,11 +117,20 @@
|
||||
producedBy = translatorName;
|
||||
mainPackage = parsed.name;
|
||||
dependencyGraph =
|
||||
{
|
||||
"${parsed.name}" =
|
||||
lib.mapAttrsToList
|
||||
(pname: pdata: "${pname}#${getVersion pdata}")
|
||||
(lib.filterAttrs
|
||||
(pname: pdata: ! (pdata.dev or false) || dev)
|
||||
parsed.dependencies);
|
||||
}
|
||||
//
|
||||
lib.listToAttrs
|
||||
(map
|
||||
(dep: lib.nameValuePair dep.name dep.depsExact )
|
||||
(lib.flatten (parseDependencies packageLockWithPinnedVersions))
|
||||
);
|
||||
(map
|
||||
(dep: lib.nameValuePair dep.name dep.depsExact)
|
||||
(lib.flatten (parseDependencies packageLockWithPinnedVersions))
|
||||
);
|
||||
sourcesCombinedHash = null;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user