Skip to content

Latest commit

 

History

History
666 lines (389 loc) · 17.5 KB

REFERENCE.md

File metadata and controls

666 lines (389 loc) · 17.5 KB

Reference

Table of Contents

Classes

Defined types

Resource types

Private Resource types

  • rustup_internal: Manage a user’s Rust installation with rustup

Functions

Private Functions

  • rustup::home: Return the default home directory for a user on this OS

Data types

Classes

rustup::global

Manage global Rust installation with rustup

Examples

Standard usage
include rustup::global

Parameters

The following parameters are available in the rustup::global class:

ensure

Data type: Enum[present, latest, absent]

  • present - install rustup, but don’t update it.
  • latest - install rustup and update it on every puppet run.
  • absent - uninstall rustup and the tools it manages.

Default value: present

user

Data type: String[1]

The user to own and manage rustup. We recommend not using root or any other existing user.

Default value: 'rustup'

manage_user

Data type: Boolean

Whether or not to manage $user user.

Default value: true

purge_toolchains

Data type: Boolean

Whether or not to uninstall toolchains that aren’t managed by Puppet.

Default value: false

purge_targets

Data type: Boolean

Whether or not to uninstall targets that aren’t managed by Puppet.

Default value: false

dist_server

Data type: Optional[Stdlib::HTTPUrl]

Override RUSTUP_DIST_SERVER. Set to 'https://dev-static.rust-lang.org' to install pre-release toolchains.

Default value: undef

home

Data type: Stdlib::Absolutepath

Where to install rustup and the rust toolchains. Will contain rustup and cargo directories.

Default value: '/opt/rust'

shell

Data type: Stdlib::Absolutepath

Shell for the rustup user. This can be a nologin shell.

Default value: '/bin/bash'

env_scripts_append

Data type: Array[Stdlib::Absolutepath]

Scripts to append with line that sources the cargo environment script.

Default value: ['/etc/bashrc']

env_scripts_create

Data type: Array[Stdlib::Absolutepath]

Paths that will get links to the cargo environment script.

Default value:

$facts['os']['family'] ? {
    'Darwin' => [],
    default  => ['/etc/profile.d/99-cargo.sh']
installer_source

Data type: Stdlib::HTTPUrl

URL of the rustup installation script. Changing this will have no effect after the initial installation.

Default value: 'https://sh.rustup.rs'

Defined types

rustup

The name should be the username.

Examples

Standard usage
rustup { 'daniel': }

Parameters

The following parameters are available in the rustup defined type:

ensure

Data type: Enum[present, latest, absent]

  • present - install rustup, but don’t update it.
  • latest - install rustup and update it on every puppet run.
  • absent - uninstall rustup and the tools it manages.

Default value: present

user

Data type: String[1]

The user to own and manage rustup.

Default value: $name

default_toolchain

Data type: Optional[String[1]]

Which toolchain should be the default.

Default value: undef

toolchains

Data type: Array[String[1]]

The toolchains to install.

Default value: []

purge_toolchains

Data type: Boolean

Whether or not to uninstall toolchains that aren’t managed by Puppet.

Default value: false

targets

Data type: Array[String[1]]

The targets to install. These can take two forms:

  • "$target $toolchain": Install $target for $toolchain.
  • "$target": Install $target for the default toolchain.

You can use 'default' to indicate the target for the current host.

Default value: []

purge_targets

Data type: Boolean

Whether or not to uninstall targets that aren’t managed by Puppet.

Default value: false

dist_server

Data type: Optional[Stdlib::HTTPUrl]

Override RUSTUP_DIST_SERVER. Set to 'https://dev-static.rust-lang.org' to install pre-release toolchains.

Default value: undef

home

Data type: Stdlib::Absolutepath

The user’s home directory. This defaults to /home/$user on Linux and /Users/$user on macOS.

Default value: rustup::home($user)

rustup_home

Data type: Stdlib::Absolutepath

Where toolchains are installed. Generally you shouldn’t change this.

Default value: "${home}/.rustup"

cargo_home

Data type: Stdlib::Absolutepath

Where cargo installs executables. Generally you shouldn’t change this.

Default value: "${home}/.cargo"

modify_path

Data type: Boolean

Whether or not to let rustup modify the user’s PATH in their shell init scripts. This only affects the initial installation and removal.

Default value: true

installer_source

Data type: Stdlib::HTTPUrl

URL of the rustup installation script. Changing this will have no effect after the initial installation.

Default value: 'https://sh.rustup.rs'

rustup::exec

The name should start with the username followed by a colon and a space, then the command. For example:

rustup::exec { 'daniel: rustup default nightly': }

Parameters

The following parameters are available in the rustup::exec defined type:

user

Data type: String[1]

The user to run as. Automatically set if the $name of the resource follows the rules above.

Default value: $name.split(': ')[0]

command

Data type: String[1]

The command to run, e.g. 'rustup default stable'. Automatically set if the $name of the resource follows the rules above.

Default value: $name.split(': ')[1]

creates

Data type: Optional[String[1]]

Only run when if this path does not exist. (See exec documentation.)

Default value: undef

environment

Data type: Array[String[1]]

Additional environment variables to set beyond RUSTUP_HOME, CARGO_HOME, and PATH.

Default value: []

onlyif

Data type: Rustup::OptionalStringOrArray

Only run when $onlyif returns success. (See exec documentation.)

Default value: undef

refreshonly

Data type: Boolean

Only run this when it receives an event. (See exec documentation.)

Default value: false

unless

Data type: Rustup::OptionalStringOrArray

Only run when $unless returns failure. (See exec documentation.)

Default value: undef

home

Data type: Stdlib::Absolutepath

The user’s home directory. This defaults to /home/$user on Linux and /Users/$user on macOS. This is only used to calculate defaults for the $rustup_home and $cargo_home parameters.

Default value: rustup::home($user)

rustup_home

Data type: Stdlib::Absolutepath

Where toolchains are installed. Generally you shouldn’t change this.

Default value: "${home}/.rustup"

cargo_home

Data type: Stdlib::Absolutepath

Where cargo installs executables. Generally you shouldn’t change this.

Default value: "${home}/.cargo"

bin

Data type: Stdlib::Absolutepath

Where rustup installs proxy executables. Generally you shouldn’t change this.

Default value: "${cargo_home}/bin"

more

Data type: Hash[String[1], Any]

Other parameters to pass to exec. They may override any of the other parameters.

Default value: {}

rustup::global::target

You can name this two ways to automatically set the parameters:

  • "$target $toolchain": install $target for $toolchain in the global installation. For example, 'x86_64-unknown-linux-gnu nightly'.
  • "$target": install $target for the default toolchain in the global installation. For example: 'stable'.

Parameters

The following parameters are available in the rustup::global::target defined type:

ensure

Data type: Enum[present, absent]

Whether the target should be present or absent.

Default value: present

target

Data type: String[1]

The name of the target to install, e.g. "sparcv9-sun-solaris". Automatically set if the $name of the resource follows the rules above.

Default value: $name.split(' ')[0]

toolchain

Data type: Optional[String[1]]

The name of the toolchain in which to install the target, e.g. "stable". undef means the default toolchain. Automatically set if the $name of the resource follows the rules above.

Default value: $name.split(' ')[1]

rustup::global::toolchain

The name should just be the toolchain. For example:

rustup::global::toolchain { 'stable': }

Parameters

The following parameters are available in the rustup::global::toolchain defined type:

ensure

Data type: Enum[present, latest, absent]

  • present - install toolchain if it doesn’t exist, but don’t update it.
  • latest - install toolchain and update it on every puppet run.
  • absent - uninstall toolchain.

Default value: present

toolchain

Data type: String[1]

The name of the toolchain to install, e.g. "stable".

Default value: $name

profile

Data type: Rustup::Profile

Profile to use for installation. This determines which components will be installed initially.

Changing this for an existing installation will not have an effect even if it causes an update, i.e. when ensure => latest is set.

Default value: 'default'

rustup::target

You can name this two ways to automatically set the parameters:

  • "$rustup: $target $toolchain": install $target for $toolchain for the rustup resource named $rustup (normally the username). For example, 'daniel: x86_64-unknown-linux-gnu nightly'.
  • "$rustup: $target": install $target for the default toolchain for the rustup resource named $rustup (normally the username). For example: 'daniel: stable'.

You may use the string 'default' as the target to indicate the target that corresponds to the current host.

Parameters

The following parameters are available in the rustup::target defined type:

ensure

Data type: Enum[present, absent]

Whether the target should be present or absent.

Default value: present

rustup

Data type: String[1]

The name of the rustup installation (normally the username). Automatically set if the $name of the resource follows the rules above.

Default value: $name.split(': ')[0]

target

Data type: String[1]

The name of the target to install, e.g. "sparcv9-sun-solaris". Automatically set if the $name of the resource follows the rules above.

Default value: $name.split(': ')[1].split(' ')[0]

toolchain

Data type: Optional[String[1]]

The name of the toolchain in which to install the target, e.g. "stable". undef means the default toolchain. Automatically set if the $name of the resource follows the rules above.

Default value: $name.split(': ')[1].split(' ')[1]

rustup::toolchain

The name should start with the name of the rustup resource (normally the name of the user) followed by a colon and a space, then the toolchain. For example:

rustup::toolchain { 'daniel: stable': }

Parameters

The following parameters are available in the rustup::toolchain defined type:

ensure

Data type: Enum[present, latest, absent]

  • present - install toolchain if it doesn’t exist, but don’t update it.
  • latest - install toolchain and update it on every puppet run.
  • absent - uninstall toolchain.

Default value: present

rustup

Data type: String[1]

The name of the rustup installation (normally the username). Automatically set if the $name of the resource follows the rules above.

Default value: $name.split(': ')[0]

toolchain

Data type: String[1]

The name of the toolchain to install, e.g. "stable". Automatically set if the $name of the resource follows the rules above.

Default value: $name.split(': ')[1]

profile

Data type: Rustup::Profile

Profile to use for installation. This determines which components will be installed initially.

Changing this for an existing installation will not have an effect even if it causes an update, i.e. when ensure => latest is set.

Default value: 'default'

Data types

Rustup::OptionalStringOrArray

Convenience type to make params easier to read

Alias of Variant[Undef, String[1], Array[String[1]]]

Rustup::Profile

default is a keyword in Puppet, so it must always be wrapped in quotes.

Alias of Enum[minimal, 'default', complete]