summaryrefslogtreecommitdiffstats
path: root/modules/rust/manifests/user.pp
blob: 1b16eebaf262113c4ddf9c352890a0f6ca4a28b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
define rust::user($user=$name, $home=undef) {
  $_home = $home ? {
    undef => $user ? {
      'root' => '/root',
      default => "/home/$user",
    },
    default => $home,
  }

  include rust

  exec { "install and configure stable toolchain for $user":
    provider => "shell",
    command => "rustup default stable",
    user => $user,
    unless => "rustup show active-toolchain | grep -q stable",
    require => [
      Package["rustup"],
      User[$user],
      File["${_home}/.rustup"],
    ],
  }
}