generateSplicesForMkScope: Support dot in attribute path
Only the list form supports the full domain of possible attribute names.
This commit is contained in:
parent
283712dd84
commit
944b1056a6
1 changed files with 14 additions and 8 deletions
|
@ -148,17 +148,23 @@ in
|
||||||
makeScopeWithSplicing' = lib.makeScopeWithSplicing' { inherit splicePackages; inherit (pkgs) newScope; };
|
makeScopeWithSplicing' = lib.makeScopeWithSplicing' { inherit splicePackages; inherit (pkgs) newScope; };
|
||||||
|
|
||||||
# generate 'otherSplices' for 'makeScopeWithSplicing'
|
# generate 'otherSplices' for 'makeScopeWithSplicing'
|
||||||
generateSplicesForMkScope = attr:
|
generateSplicesForMkScope = attrs:
|
||||||
let
|
let
|
||||||
split = X: lib.splitString "." "${X}.${attr}";
|
split = X: [ X ] ++ (
|
||||||
|
if builtins.isList attrs
|
||||||
|
then attrs
|
||||||
|
else if builtins.isString attrs
|
||||||
|
then lib.splitString "." attrs
|
||||||
|
else throw "generateSplicesForMkScope must be passed a list of string or string"
|
||||||
|
);
|
||||||
|
bad = throw "attribute should be found";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# nulls should never be reached
|
selfBuildBuild = lib.attrByPath (split "pkgsBuildBuild") bad pkgs;
|
||||||
selfBuildBuild = lib.attrByPath (split "pkgsBuildBuild") null pkgs;
|
selfBuildHost = lib.attrByPath (split "pkgsBuildHost") bad pkgs;
|
||||||
selfBuildHost = lib.attrByPath (split "pkgsBuildHost") null pkgs;
|
selfBuildTarget = lib.attrByPath (split "pkgsBuildTarget") bad pkgs;
|
||||||
selfBuildTarget = lib.attrByPath (split "pkgsBuildTarget") null pkgs;
|
selfHostHost = lib.attrByPath (split "pkgsHostHost") bad pkgs;
|
||||||
selfHostHost = lib.attrByPath (split "pkgsHostHost") null pkgs;
|
selfHostTarget = lib.attrByPath (split "pkgsHostTarget") bad pkgs;
|
||||||
selfHostTarget = lib.attrByPath (split "pkgsHostTarget") null pkgs;
|
|
||||||
selfTargetTarget = lib.attrByPath (split "pkgsTargetTarget") { } pkgs;
|
selfTargetTarget = lib.attrByPath (split "pkgsTargetTarget") { } pkgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue