Defined Type: rustup
- Defined in:
- manifests/init.pp
Summary
Manage a user’s Rust installation with `rustup`Overview
The name should be the username.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'manifests/init.pp', line 45
define rustup (
Enum[present, latest, absent] $ensure = present,
String[1] $user = $name,
Optional[String[1]] $default_toolchain = undef,
Array[String[1]] $toolchains = [],
Boolean $purge_toolchains = false,
Array[String[1]] $targets = [],
Boolean $purge_targets = false,
Optional[Stdlib::HTTPUrl] $dist_server = undef,
Stdlib::Absolutepath $home = rustup::home($user),
Stdlib::Absolutepath $rustup_home = "${home}/.rustup",
Stdlib::Absolutepath $cargo_home = "${home}/.cargo",
Boolean $modify_path = true,
Stdlib::HTTPUrl $installer_source = 'https://sh.rustup.rs',
) {
if $ensure == absent {
$_toolchains = []
$_targets = []
} else {
$_toolchains = $toolchains.map |$toolchain| {
{
ensure => present,
name => $toolchain,
profile => 'default',
}
}
$_targets = $targets.map |$target| {
{
ensure => present,
name => $target.split(' ')[0],
toolchain => $target.split(' ')[1],
}
}
}
rustup_internal { $name:
ensure => $ensure,
user => $user,
default_toolchain => $default_toolchain,
toolchains => $_toolchains,
purge_toolchains => $purge_toolchains,
targets => $_targets,
purge_targets => $purge_targets,
dist_server => $dist_server,
home => $home,
rustup_home => $rustup_home,
cargo_home => $cargo_home,
modify_path => $modify_path,
installer_source => $installer_source,
}
}
|