Discover options on the command line?

If I run xmodmap something helpfully tells me that nixos.xorg.xmodmap is what I need.

That’s great. So next question is how does one easily tell without googling what options are available when configuring said package? Is there an equivilent of man xmodmap that would tell me what options are available?

Does something like this exist?

nix-env -iA nixos.xorg.xmodmap --show-options

It would save me a lot of time if I don’t have to google each time to find the derivations and then walk through nix code to find the options. There must be a slicker way?

(I’m keen on nix, but it needs to be really easy to use if it’s going to eat the world. A slick way to discover what’s possible is a key part of the user experience)

nix-channels know the entirety of build outputs, so the shell will tell you if somthing is attempting to run but doesn’t actually exist.

I think you’re confusing packages (which are just applications/libraries) and modules (which are configurable bits of code like in confiugration.nix, which will result in an environment. xmodmap is just an application.

I think you’re looking for nix search which will scan through your channels (technically NIX_PATH) to find applications for you. For configuring modules you’re looking for man configuration.nix, nixos-options or the website nixos-options

1 Like

You may be interested in this talk, where Eelco proposed some next-gen refinement ideas for the Nix DSL specifically targeted around discoverability of package options. To my knowledge this hasn’t gone very far, but it’s mainly starving for design/implementation work than interest.

In the meantime, using the tools we have rather than the tools we wish we had, you can run nix edit, which will open up the nix expression file defining that attribute in your editor. Then you can take a look at its header to see what options it has.


I really must get my audio working - I’m going to get so much more out of these videos :rofl:

1 Like