Files
Hermit/default.nix
T
WHCandCursor ea38247161
ci / tcc-check (push) Failing after 42s
ci / linux (aarch64, 0) (push) Skipped
ci / linux (x86, 1) (push) Skipped
ci / linux (x86_64, 1) (push) Skipped
ci / windows (push) Skipped
feat: Hermit 1.1.0 — HERMIT_* env, Tauri desktop shell
Wire hermit_getenv across the engine, rebrand WebUI/systemd/docs, and
add apps/desktop (Tauri 2 + React) with a DeepSeek-Harness-like UI.
Qt app/ is frozen; full libcstcore FFI is scaffolded behind --features engine.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-30 13:15:47 +08:00

95 lines
3.1 KiB
Nix

# NixOS and other nix users: legacy Qt Quick front end (frozen; Tauri app is
# apps/desktop). CLI remains scripts/bootstrap_linux.sh.
#
# nix-build # ./result/bin/hermit-app (Qt, transitional)
# nix-env -f . -i hermit
{ pkgs ? import <nixpkgs> { } }:
let
# The version lives in one place: the header the engine and the APK read.
vLine = re:
let
hit = pkgs.lib.findFirst
(l: builtins.match "#define ${re} ([0-9]+)" l != null) ""
(pkgs.lib.splitString "\n" (builtins.readFile ./include/cst_version.h));
in
builtins.head (builtins.match "#define ${re} ([0-9]+)" hit);
in
pkgs.stdenv.mkDerivation {
pname = "hermit";
version =
"${vLine "CST_VERSION_MAJOR"}.${vLine "CST_VERSION_MINOR"}.${vLine "CST_VERSION_PATCH"}";
# Not the whole checkout: third_party/ (the static curl/mbedTLS/ncurses
# sources, the NDK builds), the build directories and the session store are
# gigabytes this build never reads -- curl, ncurses and Qt come from nixpkgs.
src = builtins.filterSource
(path: type:
!(builtins.elem (baseNameOf path) [
".agent"
".cursor"
".gen"
".git"
"build-android-arm64-v8a"
"build-apk-android"
"build-win-tui"
"dist"
"result"
"third_party"
]))
./.;
nativeBuildInputs = with pkgs; [ cmake pkg-config qt6.wrapQtAppsHook ];
# qtwayland so a Wayland session gets a native client, qtsvg for the icon
# theme: Breeze's icons are SVG, and without the image format plugin the
# window falls back to text glyphs.
buildInputs = with pkgs; [
qt6.qtbase
qt6.qtdeclarative
qt6.qtwayland
qt6.qtsvg
curl
curl.dev
ncurses
ncurses.dev
];
cmakeFlags = [ "-DCST_BUILD_APP=ON" "-DCMAKE_BUILD_TYPE=Release" ];
# The "app" component is the window, its launcher entry and the icon;
# app/CMakeLists.txt is the one place that knows where each goes.
installPhase = ''
runHook preInstall
cmake --install . --component app --prefix "$out"
runHook postInstall
'';
doCheck = true;
# One test cannot pass here: tests/test_sandbox.c has the engine run a
# sandboxed command and asserts Landlock *denied* the write outside the
# workspace, and Landlock does not work inside the nix build sandbox -- the
# command succeeds and the assertion trips. The other 40 run; the full set
# is `make check` / `ctest` in the dev tree.
checkPhase = ''
runHook preCheck
ctest --output-on-failure -j"$NIX_BUILD_CORES" -E test_sandbox
runHook postCheck
'';
# The tests write settings, sessions, undo files and a scratch workspace:
# give them a home of their own.
preCheck = ''
export HOME="$TMPDIR/home"
export XDG_CONFIG_HOME="$HOME/.config" XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
mkdir -p "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME" "$XDG_DATA_HOME"
'';
meta = {
description =
"Hermit: local coding agent (legacy Qt Quick front end; prefer apps/desktop)";
homepage = "https://git.whcself.xyz/WHC/Hermit";
platforms = pkgs.lib.platforms.linux;
mainProgram = "cst-agent-app";
};
}