2026-04-09 15:30:29 -04:00
|
|
|
# nix/tui.nix — Hermes TUI (Ink/React) compiled with tsc and bundled
|
2026-04-20 16:12:28 -04:00
|
|
|
{ pkgs, hermesNpmLib, ... }:
|
2026-04-09 15:30:29 -04:00
|
|
|
let
|
|
|
|
|
src = ../ui-tui;
|
|
|
|
|
npmDeps = pkgs.fetchNpmDeps {
|
|
|
|
|
inherit src;
|
2026-05-05 15:32:20 +05:30
|
|
|
hash = "sha256-MLcLhjTF6dgdvNBtJWzo8Nh19eNh/ZitD2b07nm61Tc=";
|
2026-04-09 15:30:29 -04:00
|
|
|
};
|
|
|
|
|
|
2026-04-20 16:12:28 -04:00
|
|
|
npm = hermesNpmLib.mkNpmPassthru { folder = "ui-tui"; attr = "tui"; pname = "hermes-tui"; };
|
|
|
|
|
|
2026-04-09 15:30:29 -04:00
|
|
|
packageJson = builtins.fromJSON (builtins.readFile (src + "/package.json"));
|
|
|
|
|
version = packageJson.version;
|
|
|
|
|
in
|
2026-04-20 16:12:28 -04:00
|
|
|
pkgs.buildNpmPackage (npm // {
|
2026-04-09 15:30:29 -04:00
|
|
|
pname = "hermes-tui";
|
|
|
|
|
inherit src npmDeps version;
|
|
|
|
|
|
|
|
|
|
doCheck = false;
|
2026-04-27 11:49:02 -05:00
|
|
|
npmFlags = [ "--legacy-peer-deps" ];
|
2026-04-09 15:30:29 -04:00
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
|
|
mkdir -p $out/lib/hermes-tui
|
|
|
|
|
|
|
|
|
|
cp -r dist $out/lib/hermes-tui/dist
|
|
|
|
|
|
|
|
|
|
# runtime node_modules
|
|
|
|
|
cp -r node_modules $out/lib/hermes-tui/node_modules
|
|
|
|
|
|
2026-04-11 15:58:22 -04:00
|
|
|
# @hermes/ink is a file: dependency, we need to copy it in fr
|
|
|
|
|
rm -f $out/lib/hermes-tui/node_modules/@hermes/ink
|
|
|
|
|
cp -r packages/hermes-ink $out/lib/hermes-tui/node_modules/@hermes/ink
|
|
|
|
|
|
2026-04-09 15:30:29 -04:00
|
|
|
# package.json needed for "type": "module" resolution
|
|
|
|
|
cp package.json $out/lib/hermes-tui/
|
|
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
|
'';
|
2026-04-20 16:12:28 -04:00
|
|
|
})
|