Operating system information utilities for Apero.
Provides a unified interface for querying system metadata regardless of the underlying platform (Linux, macOS, Windows).
Example
iex> info = Apero.OS.info()
iex> info.type in [:linux, :macos, :windows, :unknown]
true
Summary
Functions
Returns the CPU architecture of the current machine.
Returns true if running inside a container (Docker, Podman, LXC).
Returns the number of logical CPU cores available to the OS.
Returns the distribution name on Linux (reads /etc/os-release),
"macOS" on Darwin, or "Windows" on win32.
Returns the machine hostname.
Returns a consolidated map of system information.
Returns the OS kernel version string, or "unknown" if unavailable.
Returns true if the current process is running as root / Administrator.
Returns the total system RAM in megabytes, or 0 if unavailable.
Returns the operating system type.
Returns true if running under WSL (Windows Subsystem for Linux).
Types
Functions
@spec arch() :: arch()
Returns the CPU architecture of the current machine.
Possible values: :x86_64, :arm64, :arm, :i386, :unknown.
@spec container?() :: boolean()
Returns true if running inside a container (Docker, Podman, LXC).
@spec cpu_count() :: pos_integer()
Returns the number of logical CPU cores available to the OS.
@spec distro() :: binary()
Returns the distribution name on Linux (reads /etc/os-release),
"macOS" on Darwin, or "Windows" on win32.
@spec hostname() :: binary()
Returns the machine hostname.
@spec info() :: map()
Returns a consolidated map of system information.
Keys: :type, :arch, :hostname, :distro, :kernel_version,
:cpu_count, :total_memory_mb.
@spec kernel_version() :: binary()
Returns the OS kernel version string, or "unknown" if unavailable.
@spec root?() :: boolean()
Returns true if the current process is running as root / Administrator.
@spec total_memory_mb() :: non_neg_integer()
Returns the total system RAM in megabytes, or 0 if unavailable.
@spec type() :: os_type()
Returns the operating system type.
Possible values: :linux, :macos, :windows, :unknown.
@spec wsl?() :: boolean()
Returns true if running under WSL (Windows Subsystem for Linux).