mirror of
https://github.com/nix-community/dream2nix.git
synced 2025-01-07 07:09:26 +03:00
add inject
for lib2
This commit is contained in:
parent
6341f38026
commit
d0cfed18e7
@ -439,8 +439,7 @@
|
|||||||
(dreamOverrides."${dreamLock._generic.subsystem}" or {})
|
(dreamOverrides."${dreamLock._generic.subsystem}" or {})
|
||||||
(args.packageOverrides or {});
|
(args.packageOverrides or {});
|
||||||
|
|
||||||
inject =
|
inject = args.inject or {};
|
||||||
utils.dreamLock.decompressDependencyGraph args.inject or {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
allOutputs = builderOutputs;
|
allOutputs = builderOutputs;
|
||||||
@ -587,6 +586,7 @@
|
|||||||
|
|
||||||
# transform a list of resolved projects to buildable outputs
|
# transform a list of resolved projects to buildable outputs
|
||||||
realizeProjects = {
|
realizeProjects = {
|
||||||
|
inject ? {},
|
||||||
translatedProjects ? translateProjects {inherit pname settings source;},
|
translatedProjects ? translateProjects {inherit pname settings source;},
|
||||||
# alternative way of calling (for debugging)
|
# alternative way of calling (for debugging)
|
||||||
pname ? null,
|
pname ? null,
|
||||||
@ -610,7 +610,7 @@
|
|||||||
# extends each package with a `.resolve` attribute
|
# extends each package with a `.resolve` attribute
|
||||||
outputsForProject = proj: let
|
outputsForProject = proj: let
|
||||||
outputs = makeOutputsForDreamLock rec {
|
outputs = makeOutputsForDreamLock rec {
|
||||||
inherit packageOverrides;
|
inherit inject packageOverrides;
|
||||||
dreamLock = proj.dreamLock;
|
dreamLock = proj.dreamLock;
|
||||||
sourceOverrides = oldSources: (defaultSourceOverride proj.dreamLock);
|
sourceOverrides = oldSources: (defaultSourceOverride proj.dreamLock);
|
||||||
};
|
};
|
||||||
|
@ -92,6 +92,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
makeFlakeOutputsFunc = {
|
makeFlakeOutputsFunc = {
|
||||||
|
inject ? {},
|
||||||
pname ? throw "Please pass `pname` to makeFlakeOutputs",
|
pname ? throw "Please pass `pname` to makeFlakeOutputs",
|
||||||
pkgs ? null,
|
pkgs ? null,
|
||||||
packageOverrides ? {},
|
packageOverrides ? {},
|
||||||
@ -168,7 +169,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
realizedProjects = dream2nix.realizeProjects {
|
realizedProjects = dream2nix.realizeProjects {
|
||||||
inherit packageOverrides translatedProjects source;
|
inherit inject packageOverrides translatedProjects source;
|
||||||
};
|
};
|
||||||
|
|
||||||
allOutputs =
|
allOutputs =
|
||||||
|
@ -170,7 +170,7 @@
|
|||||||
versions)
|
versions)
|
||||||
[
|
[
|
||||||
oldDependencyGraph
|
oldDependencyGraph
|
||||||
inject
|
(decompressDependencyGraph inject)
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
lib.recursiveUpdate lock {
|
lib.recursiveUpdate lock {
|
||||||
|
@ -15,5 +15,5 @@ in
|
|||||||
]
|
]
|
||||||
''
|
''
|
||||||
export dream2nixSrc=${dream2nixWithExternals}
|
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