Tags
Tags are a central concept in HermitGrab. Each action (link
, patch
, install
) can require the presence or absence of specific tags. Actions are enabled or disabled based on the set of active tags.
There are multiple sources for tags.
The command line
When running the apply command, you can specify multiple tags with the -t
or --tag
argument.
A profile
Instead of specifying tags individually on the command line, you can create a profile, which is a collection of tags. When the -p
or --profile
argument is used, all tags in that profile become active. If no profile is specified, the default
profile is used if it has been defined.
Built-in Auto-detected Tags
HermitGrab automatically detects system information and provides it as tags. For example:
arch=aarch64
(possible Values)arch_alias=arm64
(Eitherarm64
,amd64
,armhf
or the same asarch=
)hostname=b8346a603af8
os=linux
(possible Values)os_bitness=64
os_codename=bookworm
os_family=unix
(possible Values)os_version=12.0.0
user=vscode
These are particularly useful for ensuring that tools are only installed on compatible platforms. For example, a configuration file for the Fish shell, which is not available on Windows, might include the following requires
key:
requires = ["fish", "+os_family=unix"]
Custom Tag Detectors
You can also define custom tags based on the output of a script. For example:
[detectors]
# The `k9s` tag is activated if the command returns a successful exit code.
k9s = { enable_if = "command -v kubectl" }
# The `is_container` tag is activated if the command returns a non-zero exit code.
is_container = { enable_if_not = "grep -q 'systemd' /proc/1/cmdline" }
# Upon successful execution, the command's standard output is used to set a tag's value,
# for example `shell=/bin/bash`.
shell = { value_of = "echo $SHELL" }