Fetch flake outputs and display them

This commit is contained in:
2025-08-24 15:36:47 +02:00
parent 5171770f1a
commit b0079a2756
7 changed files with 165 additions and 12 deletions

View File

@@ -0,0 +1,36 @@
outputAttrs: let
attrNamePathToString = attrNamePath: builtins.concatStringsSep "." attrNamePath;
outputInfo = drv: builtins.listToAttrs (builtins.map (outputName: {
name = outputName;
value = {
store_path = drv."${outputName}".outPath;
};
}) drv.outputs);
recurseAttrs = attrs: attrNamePath: builtins.concatLists (builtins.attrValues (
builtins.mapAttrs (attrName: attrValue:
if builtins.typeOf attrValue == "set" then
if builtins.hasAttr "type" attrValue then
if attrValue.type == "derivation" then
[ {
name = attrNamePathToString (attrNamePath ++ [ attrName ]);
value = {
name = attrValue.name;
derivation_path = attrValue.drvPath;
system = attrValue.system;
outputs = outputInfo attrValue;
};
} ]
else
[ "unknown type" ]
else
recurseAttrs attrValue (attrNamePath ++ [ attrName ])
else
[]
) attrs
));
in
builtins.listToAttrs (recurseAttrs outputAttrs [])