Skip to content

Host

The rb.host table provides information about the current machine and user. It is populated once at startup from POSIX syscalls — no environment variables are used.

lua
local rb = require("rootbeer")

if rb.host.os == "macos" then
    -- macOS specific config
end

if rb.host.hostname == "work-macbook" then
    -- work machine overrides
end

API Reference

rootbeer.HostInfo

archstring
CPU architecture (e.g. "aarch64", "x86_64").
homestring
Home directory path (from passwd).
hostnamestringoptional
Machine hostname, or nil if it cannot be determined.
osstring
The operating system (e.g. "macos", "linux").
shellstring
Default login shell (from passwd, e.g. "/bin/zsh").
userstring
Current username (from passwd).