Is your feature request related to a problem? Please describe.
In a common flake there are some custom attributes used, that appear in nix flake show just as "unknown". One of the commonly used custom attributes is lib (used by nixpkgs itself). Also homeConfigurations and homeModules are rather common since home-manager got flake support. And I am sure there are equivalent attributes for nix-darwin.
Describe the solution you'd like
There should be a way to label these. This could be done by adding an extra attribute labelers to the flake schema.
A labeler then is a function that returns either a string or an arbitrary nested set of strings. nix flake show will use each attribute name as a "node" in the tree and increase nesting, while a string value will be used as label. As far as I can tell, this would pretty much match what one sees in the nix flake show --json output.
Whenever nix flake show discovers an unknown attribute foo it will call self.labelers.foo self.foo. The labeler then has to inspect the value and build the aforementioned label tree.
The following show snippet could have been created by the returned nix value below it:
├───homeConfigurations
│ ├───nobbz@enceladeus: Home Manager configuration
│ ├───nobbz@mimas: Home Manager configuration
│ └───nobbz@thetys: Home Manager configuration
{
"nobbz@enceladeus" = "Home Manager configuration";
"nobbz@mimas" = "Home Manager configuration";
"nobbz@thetys" = "Home Manager configuration";
}
Describe alternatives you've considered
External programs that are required to increase discoverability of custom attributes
Is your feature request related to a problem? Please describe.
In a common flake there are some custom attributes used, that appear in
nix flake showjust as "unknown". One of the commonly used custom attributes islib(used bynixpkgsitself). AlsohomeConfigurationsandhomeModulesare rather common sincehome-managergot flake support. And I am sure there are equivalent attributes fornix-darwin.Describe the solution you'd like
There should be a way to label these. This could be done by adding an extra attribute
labelersto the flake schema.A
labelerthen is a function that returns either a string or an arbitrary nested set of strings.nix flake showwill use each attribute name as a "node" in the tree and increase nesting, while a string value will be used as label. As far as I can tell, this would pretty much match what one sees in thenix flake show --jsonoutput.Whenever
nix flake showdiscovers an unknown attributefooit will callself.labelers.foo self.foo. The labeler then has to inspect the value and build the aforementioned label tree.The following
showsnippet could have been created by the returned nix value below it:Describe alternatives you've considered
External programs that are required to increase discoverability of custom attributes