Forge Home

rustup

Manage Rust with rustup

1,282 downloads

74 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.2.6 (latest)
  • 0.2.5
  • 0.2.4
  • 0.2.3
  • 0.2.2
  • 0.2.1
  • 0.2.0
  • 0.1.0
released Sep 3rd 2024
This version is compatible with:
  • Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x
  • Puppet >= 6.21.0 < 9.0.0
  • , , , , , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'dp-rustup', '0.2.6'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add dp-rustup
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install dp-rustup --version 0.2.6

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

dp/rustup — version 0.2.6 Sep 3rd 2024

Puppet module to manage Rust with rustup

This manages Rust installations with the rustup tool. There are two ways to use it:

  • Per-user installations. Each user has their own installation in their home directory that is entirely separate from every other installation. This is how the rustup tool expects to be used.
  • Global installation. Users are able to access shared toolchains and targets, but will not be able to change any of them. Users can still use cargo install, but the installed tools will only be accessible to themselves. The rustup tool is not designed to be used this way, but it seems to work fine.

Usage

Per-user installation

You can just use the rustup defined type, or you can define separate resources for toolchains and targets. You can mix and match these approaches if you want.

To just install the standard, stable toolchain:

rustup { 'user':
  toolchains => ['stable'],
}

A more complicated example:

rustup { 'user':
  toolchains       => ['stable', 'nightly'],
  targets          => [
    'default stable',
    'default nightly',
    'x86_64-unknown-linux-musl nightly',
  ],
  purge_toolchains => true,
  purge_targets    => true,
}

This is the multi-resource equivalent of the above, but it always tries to install the latest nightly toolchain:

rustup { 'user':
  purge_toolchains => true,
  purge_targets    => true,
}
rustup::toolchain { 'user: stable': }
rustup::target { 'user: default': }
rustup::toolchain { 'user: nightly':
  ensure => latest,
}
rustup::target { 'user: default nightly': }
rustup::target { 'user: x86_64-unknown-linux-musl nightly': }

You can find more information in the reference documentation for rustup::toolchain and rustup::target.

Global installation

Like the per-user installation this can be configured with one resource (the rustup::global class) or multiple. Multiple resources provide more configurability.

class { 'rustup::global':
  toolchains       => ['stable', 'nightly'],
  targets          => [
    'default stable',
    'default nightly',
    'x86_64-unknown-linux-musl nightly',
  ],
  purge_toolchains => true,
  purge_targets    => true,
}

Again, the equivalent configuration except that the nightly toolchain is updated every run:

class { 'rustup::global':
  purge_toolchains => true,
  purge_targets    => true,
}
rustup::global::toolchain { 'stable': }
rustup::global::target { 'default': }
rustup::global::toolchain { 'nightly':
  ensure => latest,
}
rustup::global::target { 'default nightly': }
rustup::global::target { 'x86_64-unknown-linux-musl nightly': }

You can find more information in the reference documentation for rustup::global::toolchain and rustup::global::target.

Limitations

  • This does not allow management of components.
  • This does not support Windows.

Development status

This is presently being developed, if in a somewhat intermittent fashion.

Reference

See REFERENCE.md.

Development

See DEVELOPMENT.md.