mirror of
https://github.com/nix-community/dream2nix.git
synced 2025-01-05 13:29:29 +03:00
add inject
for lib2
This commit is contained in:
parent
6341f38026
commit
d0cfed18e7
@ -439,8 +439,7 @@
|
||||
(dreamOverrides."${dreamLock._generic.subsystem}" or {})
|
||||
(args.packageOverrides or {});
|
||||
|
||||
inject =
|
||||
utils.dreamLock.decompressDependencyGraph args.inject or {};
|
||||
inject = args.inject or {};
|
||||
};
|
||||
|
||||
allOutputs = builderOutputs;
|
||||
@ -587,6 +586,7 @@
|
||||
|
||||
# transform a list of resolved projects to buildable outputs
|
||||
realizeProjects = {
|
||||
inject ? {},
|
||||
translatedProjects ? translateProjects {inherit pname settings source;},
|
||||
# alternative way of calling (for debugging)
|
||||
pname ? null,
|
||||
@ -610,7 +610,7 @@
|
||||
# extends each package with a `.resolve` attribute
|
||||
outputsForProject = proj: let
|
||||
outputs = makeOutputsForDreamLock rec {
|
||||
inherit packageOverrides;
|
||||
inherit inject packageOverrides;
|
||||
dreamLock = proj.dreamLock;
|
||||
sourceOverrides = oldSources: (defaultSourceOverride proj.dreamLock);
|
||||
};
|
||||
|
@ -92,6 +92,7 @@
|
||||
};
|
||||
|
||||
makeFlakeOutputsFunc = {
|
||||
inject ? {},
|
||||
pname ? throw "Please pass `pname` to makeFlakeOutputs",
|
||||
pkgs ? null,
|
||||
packageOverrides ? {},
|
||||
@ -168,7 +169,7 @@
|
||||
};
|
||||
|
||||
realizedProjects = dream2nix.realizeProjects {
|
||||
inherit packageOverrides translatedProjects source;
|
||||
inherit inject packageOverrides translatedProjects source;
|
||||
};
|
||||
|
||||
allOutputs =
|
||||
|
@ -170,7 +170,7 @@
|
||||
versions)
|
||||
[
|
||||
oldDependencyGraph
|
||||
inject
|
||||
(decompressDependencyGraph inject)
|
||||
];
|
||||
in
|
||||
lib.recursiveUpdate lock {
|
||||
|
@ -15,5 +15,5 @@ in
|
||||
]
|
||||
''
|
||||
export dream2nixSrc=${dream2nixWithExternals}
|
||||
${python3.pkgs.pytest}/bin/pytest ${self}/tests/unit "$@"
|
||||
${python3.pkgs.pytest}/bin/pytest ${self}/tests/unit -v "$@"
|
||||
''
|
||||
|
33
tests/unit/test_dream_lock.py
Normal file
33
tests/unit/test_dream_lock.py
Normal file
@ -0,0 +1,33 @@
|
||||
import pytest
|
||||
import nix_ffi
|
||||
|
||||
exampleDreamLock = dict(
|
||||
_generic = dict(
|
||||
defaultPackage="example",
|
||||
packages=dict(
|
||||
example="1.2.3",
|
||||
),
|
||||
subsystem = "nodejs",
|
||||
_subsystemAttrs = {},
|
||||
),
|
||||
dependencies = {},
|
||||
cyclicDependencies = {},
|
||||
sources = {},
|
||||
)
|
||||
|
||||
def test_dream_lock_inject():
|
||||
result = nix_ffi.callNixFunction(
|
||||
'utils.dreamLock.injectDependencies',
|
||||
dreamLock=exampleDreamLock,
|
||||
inject=dict(
|
||||
example={
|
||||
"1.2.3": [
|
||||
[ "injected-package", "1.0.0" ]
|
||||
]
|
||||
}
|
||||
),
|
||||
)
|
||||
assert result['dependencies']['example']['1.2.3'] == [dict(
|
||||
name="injected-package",
|
||||
version="1.0.0",
|
||||
)]
|
Loading…
Reference in New Issue
Block a user