Skip to content

RFC: poor man's nix-option via package argument names #13132

@abbradar

Description

@abbradar

Currently we don't have a way to discover available package options in nixpkgs. Usual way is to grep all-packages.nix or to look into package directly. A discussion about the place of package flags together with some earlier thoughts inspired me to think of this: we don't have any typing nor we have a way to mark package arguments as "options" -- arguments are just, well, arguments. I.e. we don't have any way to distinguish pam the dependency from withPam the Boolean flag. ...Or do we? All flags do have something in common -- they have a name. We also have a loose naming policy of calling all package configuration flags withFoo or enableFoo. So, I propose this:

  1. Enforce a policy to name those flags consistently with some prefix.
  2. Make a nix-option tool which would, given an overridable derivation (that is, output of makeOverridable function) would print all such options for it with current setting. Example:
> nix-option -A uwsgi ~/nixpkgs
Package uwsgi-2.0.11.2 has 2 options:
* withPAM = true
* withSystemd = true

Notice that it would print current value, that is, if the package was overridden in all-packages.nix or somewhere else the end result would be visible in the output.

What do you think of this? It sounds somewhat hacky, and quite possibly there's some better way that I haven't thought of...

cc @zimbatm (because of discussion)

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: questionRequests for a specific question to be answered2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md9.needs: reporter feedbackThis issue needs the person who filed it to respond
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions