From 944b1056a646b1c58683dfdd4aaef40c5a4ca44c Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 30 Apr 2024 12:05:33 -0400 Subject: [PATCH] generateSplicesForMkScope: Support dot in attribute path Only the list form supports the full domain of possible attribute names. --- pkgs/top-level/splice.nix | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/pkgs/top-level/splice.nix b/pkgs/top-level/splice.nix index 9ac0fe2200f9..c477d797795a 100644 --- a/pkgs/top-level/splice.nix +++ b/pkgs/top-level/splice.nix @@ -148,17 +148,23 @@ in makeScopeWithSplicing' = lib.makeScopeWithSplicing' { inherit splicePackages; inherit (pkgs) newScope; }; # generate 'otherSplices' for 'makeScopeWithSplicing' - generateSplicesForMkScope = attr: + generateSplicesForMkScope = attrs: 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 { - # nulls should never be reached - selfBuildBuild = lib.attrByPath (split "pkgsBuildBuild") null pkgs; - selfBuildHost = lib.attrByPath (split "pkgsBuildHost") null pkgs; - selfBuildTarget = lib.attrByPath (split "pkgsBuildTarget") null pkgs; - selfHostHost = lib.attrByPath (split "pkgsHostHost") null pkgs; - selfHostTarget = lib.attrByPath (split "pkgsHostTarget") null pkgs; + selfBuildBuild = lib.attrByPath (split "pkgsBuildBuild") bad pkgs; + selfBuildHost = lib.attrByPath (split "pkgsBuildHost") bad pkgs; + selfBuildTarget = lib.attrByPath (split "pkgsBuildTarget") bad pkgs; + selfHostHost = lib.attrByPath (split "pkgsHostHost") bad pkgs; + selfHostTarget = lib.attrByPath (split "pkgsHostTarget") bad pkgs; selfTargetTarget = lib.attrByPath (split "pkgsTargetTarget") { } pkgs; };