Skip to content

[feature] Support additional install args for Rust toolchain bins #2708

Description

@JakubWasilczyk-Alias2k

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

The Rust toolchain bins list only takes a crate name and version, like diesel_cli@2.3.9. I can't pass any flags to the install command.

That's a problem for crates like diesel_cli, whose default features pull in postgres, mysql and sqlite. Building it needs all three client libraries installed, even though we only use postgres. The install command we actually want is:

cargo install diesel_cli@2.3.9 --no-default-features --features postgres

There's no way to write that in .moon/toolchain.yml, so we install diesel_cli by hand and it stays outside of moon.

Describe the solution you'd like

Let a bin entry carry extra arguments:

rust:
  bins:
    - bin: 'diesel_cli@2.3.9'
      args: ['--no-default-features', '--features', 'postgres']

moon appends args to the install command. It would also be nice if changing args triggered a reinstall instead of being skipped because the binary already exists.

Describe alternatives you've considered

  • Installing it manually or in a separate task. Works, but every dev and CI runner has to remember it, and moon doesn't know about the tool.
  • Installing every backend. Means every machine needs libpq, libmysqlclient and libsqlite3 for nothing.
  • Relying on prebuilt binaries from cargo-binstall. Those ship with whatever features the author picked, so non-default feature sets aren't possible.

Additional context

Other crates would benefit too, for example sqlx-cli with --no-default-features --features rustls,postgres. Might be worth skipping binstall and going straight to cargo install whenever args is set, since binstall's handling of feature flags isn't consistent.

moon version: 2.5.3
OS: MacOS

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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