Monorepo for Tangled
0

Configure Feed

Select the types of activity you want to include in your feed.

nix/microvm: lookup packages by attr path

Signed-off-by: dawn <dawn@tangled.org>

dawn (Jun 30, 2026, 1:33 AM +0300) 75324035 67cd21b5

+11 -2
+11 -2
nix/microvm/user-config.nix
··· 44 44 system = pkgs.stdenv.hostPlatform.system; 45 45 flake = getFlake flakeRef; 46 46 notFound = throw "Package ${pkgName} not found in ${flakeRef}"; 47 + # pkgName may be dotted (e.g. "python3Packages.requests"), so walk the 48 + # attr path rather than doing a single dotted-string lookup 49 + pkgPath = lib.splitString "." pkgName; 50 + inPackages = ["packages" system] ++ pkgPath; 51 + inLegacy = ["legacyPackages" system] ++ pkgPath; 47 52 in 48 53 if flakeRef == "nixpkgs" && !(registry ? nixpkgs) 49 - then pkgs.${pkgName} or notFound 50 - else flake.legacyPackages.${system}.${pkgName} or flake.packages.${system}.${pkgName} or notFound; 54 + then lib.attrByPath pkgPath notFound pkgs 55 + else if lib.hasAttrByPath inLegacy flake 56 + then lib.getAttrFromPath inLegacy flake 57 + else if lib.hasAttrByPath inPackages flake 58 + then lib.getAttrFromPath inPackages flake 59 + else notFound; 51 60 52 61 # strings are resolved as package references only where the option type 53 62 # actually expects packages; everything else passes through untouched