Liking cljdoc? Tell your friends :D

eyre

Clojars Project

Babashka

eyre is a Clojure library for probing an operating system and user environment for facts. It detects the shell, OS, hardware, users, mounted filesystems, network configuration, and available binaries, and works over any transport that can execute commands and return :exit, :out, and :err.

Features

  • Supported shells:
    • bash
    • zsh
    • sh
    • dash
    • ksh
    • busybox/ash
    • fish
    • nushell
    • PowerShell
    • cmd.exe
  • Supported Operating Systems:
    • Linux
    • FreeBSD
    • NetBSD
    • macOS
    • Windows
  • Every fact module accepts the same small contract: an executor function and a shell map.
  • All per-shell collection scripts are embedded, so there are no files to install on the target.
  • No dependencies deps.edn.

Quickstart

gather.clj:

(ns gather
  (:require [babashka.process :as process]
            [clojure.pprint :as pprint]
            [eyre.core :as eyre]))

(defn local-exec [script]
  (process/shell {:cmd "bash"
                  :in script
                  :out :string
                  :err :string}))

(pprint/pprint
  (eyre/gather local-exec))

(shutdown-agents)
clojure -Sdeps '{:deps {io.epiccastle/eyre {:mvn/version "0.1.0"}}}' gather.clj

or run under babashka:

bb -Sdeps '{:deps {io.epiccastle/eyre {:mvn/version "0.1.0"}}}' gather.clj

Installation

tools.deps

io.epiccastle/eyre {:mvn/version "0.1.0"}

leiningen

[io.epiccastle/eyre "0.1.0"]

Usage

An executor is any function that takes a command string and returns a map like {:exit 0 :out "..." :err ""}. This one runs the script locally with babashka/process:

(require '[babashka.process :as process]
         '[eyre.core :as eyre])

(defn local-exec [script]
  (process/shell {:cmd "bash"
                  :in script
                  :out :string
                  :err :string}))

(eyre/gather local-exec)

The executor can just as easily run over SSH. Any transport returning :exit, :out, and :err will work. Here's a naive example using clojuressh that could be improved (this re-establishes the connection each exec invocation):

(require '[clojuressh.core :as ssh]
         '[clojuressh.session :as session]
         '[eyre.core :as eyre])

(defn make-executor [{:keys [host username password port]}]
  (fn [command]
    (let [session (ssh/ssh host {:username username
                                 :password password
                                 :port     (or port 22)
                                 :strict-host-key-checking false})
          result  @(ssh/exec session command {:out :string
                                              :err :string})]
      (session/disconnect session)
      result)))

(def ssh-exec (make-executor {:host "remote.example.com"
                              :username "root"
                              :password "secret"
                              :port 22}))

(eyre/gather ssh-exec)

Using individual modules

The same pieces are available separately if you do not need the full report:

(require '[eyre.shell :as shell]
         '[eyre.os :as os]
         '[eyre.users :as users])

(def shell (shell/gather-shell {:exec local-exec}))

(os/gather-os {:exec local-exec :shell shell})
(users/gather-users {:exec local-exec :shell shell})

Output format

The complete map returned by eyre.core/gather is documented in docs/output.md.

Modules

NamespaceFact domain
eyre.shellShell type, version, and canonical path
eyre.osOperating system, kernel, and distribution
eyre.hardwareCPU, memory, disks, and virtualization
eyre.usersCurrent uid, gid, and group membership
eyre.filesystemMounted filesystems and security features
eyre.networkHostname, interfaces, gateway, and DNS
eyre.binsResolved paths for common binaries

Development

Read full test docs: docs/testing.md.

Run the tests on babashka with:

make test-bb

On clojure with:

make test-clojure

Or both with:

make test

The test suite includes unit tests on parsing and integration tests run against a set of local VMs and containers configured in test/eyre_test/config.clj.

Quote

The justices interpreted the King's laws; their judgments were entered in long eyre rolls. Bringing the King's law into the districts around the country had a role in creating conformity in legal decisions regardless of geography, and setting precedents for future cases. Thus, the courts of eyre were instrumental in creating English Common Law. The eyres were gradually replaced by assizes and general commissions of Oyer and Terminer in the latter half of the fourteenth century.

-- Jokinen, Anniina. "Justices in Eyre." Luminarium Encyclopedia.

License

Copyright © 2026 Crispin Wellington

Distributed under the Eclipse Public License version 2.0.

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close