Skip to content

Allow specifying commands as packages without the attrset #216

@lilyball

Description

@lilyball

Is your feature request related to a problem? Please describe.

When listing commands, most of my commands are just packages that don't need additional attributes. Having to repeat the package key is tedious. In my Nix config that ends up looking like

{
  commands = with pkgs; [
    { package = cargo-deny; }
    { package = cargo-insta; }
    { package = vagrant; }
    { package = jq; }
  ];
}

Describe the solution you'd like

I'd prefer to be able to write this like

{
  commands = with pkgs; [ cargo-deny cargo-insta vagrant jq ];
}

This can be done by changing the type for commands, which is currently listOf (submodule { options = commadOptions; }), to use either or coercedTo to accept a strOrPackage in addition to the submodule. coercedTo is probably better in that you wouldn't have to change any of the code that consumes it.

Describe alternatives you've considered

A library function could be provided instead that takes a list of packages and wraps each package in the appropriate attrset, but that seems unnecessarily awkward.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions