Manages Rust toolchain in the user environment.
Table of Contents
Applying tool_rust
will make sure rust
is configured as specified.
This formula provides a custom execution module and state to manage packages installed with cargo
. The functions are self-explanatory, please see the source code or the rendered docs at :ref:`em_cargo` and :ref:`sm_cargo`.
The general configuration structure is in line with all other formulae from the tool suite, for details see :ref:`toolsuite`. An example pillar is provided, see :ref:`pillar.example`. Note that you do not need to specify everything by pillar. Often, it's much easier and less resource-heavy to use the parameters/<grain>/<value>.yaml
files for non-sensitive settings. The underlying logic is explained in :ref:`map.jinja`.
The following shows an example of tool_rust
per-user configuration. If provided by pillar, namespace it to tool_global:users
and/or tool_rust:users
. For the parameters
YAML file variant, it needs to be nested under a values
parent key. The YAML files are expected to be found in
salt://tool_rust/parameters/<grain>/<value>.yaml
orsalt://tool_global/parameters/<grain>/<value>.yaml
.
user:
# Force the usage of XDG directories for this user.
xdg: true
# Sync this user's config from a dotfiles repo.
# The available paths and their priority can be found in the
# rendered `config/sync.sls` file (currently, @TODO docs).
# Overview in descending priority:
# salt://dotconfig/<minion_id>/<user>/cargo
# salt://dotconfig/<minion_id>/cargo
# salt://dotconfig/<os_family>/<user>/cargo
# salt://dotconfig/<os_family>/cargo
# salt://dotconfig/default/<user>/cargo
# salt://dotconfig/default/cargo
dotconfig: # can be bool or mapping
file_mode: '0600' # default: keep destination or salt umask (new)
dir_mode: '0700' # default: 0700
clean: false # delete files in target. default: false
# Persist environment variables used by this formula for this
# user to this file (will be appended to a file relative to $HOME)
persistenv: '.config/zsh/zshenv'
# Add runcom hooks specific to this formula to this file
# for this user (will be appended to a file relative to $HOME)
rchook: '.config/zsh/zshrc'
# This user's configuration for this formula. Will be overridden by
# user-specific configuration in `tool_rust:users`.
# Set this to `false` to disable configuration for this user.
rust:
crates:
- broot
- du-dust
tool_rust:
# Specify an explicit version (works on most Linux distributions) or
# keep the packages updated to their latest version on subsequent runs
# by leaving version empty or setting it to 'latest'
# (again for Linux, brew does that anyways).
version: latest
# Which method to use to install `rustup`. Currently available:
# web, asdf, system (`pkg.installed`)
install_method: web
# Default formula configuration for all users.
defaults:
crates: default value for all users
tool_rust.config.sync
will recursively apply templates from
salt://dotconfig/<minion_id>/<user>/cargo
salt://dotconfig/<minion_id>/cargo
salt://dotconfig/<os_family>/<user>/cargo
salt://dotconfig/<os_family>/cargo
salt://dotconfig/default/<user>/cargo
salt://dotconfig/default/cargo
to the user's config dir for every user that has it enabled (see user.dotconfig
). The target folder will not be cleaned by default (ie files in the target that are absent from the user's dotconfig will stay).
The URL list above is in descending priority. This means user-specific configuration from wider scopes will be overridden by more system-specific general configuration.
The following states are found in this formula:
tool_rust
tool_rust.package
tool_rust.package.asdf
tool_rust.package.pkg
tool_rust.package.web
tool_rust.xdg
tool_rust.env_vars
tool_rust.config
tool_rust.crates
tool_rust.clean
tool_rust.package.clean
tool_rust.package.asdf.clean
tool_rust.package.web.clean
tool_rust.xdg.clean
tool_rust.env_vars.clean
tool_rust.config.clean
tool_rust.crates.clean
Meta-state.
Performs all operations described in this formula according to the specified configuration.
Installs the Rust package only.
Ensures Rust adheres to the XDG spec as best as possible for all managed users. Has a dependency on tool_rust.package.
Manages the Rust package configuration by
- recursively syncing from a dotfiles repo
Has a dependency on tool_rust.package.
Meta-state.
Undoes everything performed in the tool_rust
meta-state
in reverse order.
Removes the Rust package. Has a dependency on tool_rust.config.clean.
Removes the configuration of the Rust package.
Commit message formatting is significant.
Please see How to contribute for more details.
pre-commit is configured for this formula, which you may optionally use to ease the steps involved in submitting your changes.
First install the pre-commit
package manager using the appropriate method, then run bin/install-hooks
and
now pre-commit
will run automatically on each git commit
.
$ bin/install-hooks
pre-commit installed at .git/hooks/pre-commit
pre-commit installed at .git/hooks/commit-msg
There is a script that semi-autodocuments available states: bin/slsdoc
.
If a .sls
file begins with a Jinja comment, it will dump that into the docs. It can be configured differently depending on the formula. See the script source code for details currently.
This means if you feel a state should be documented, make sure to write a comment explaining it.
- allow installation with specific standalone installers