mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
* Add setuptools build dep for legacy alibabacloud packages and updated stale npm-deps hash * Add HERMES_NODE env var to pin Node.js version The TUI requires Node.js 20+ for regex `/v` flag support (used by string-width). Instead of relying on PATH lookup, explicitly set HERMES_NODE to the bundled Node 22 in the Nix wrapper, and add a fallback check in the Python code to use HERMES_NODE if available. Also upgrade container provisioning to Node 22 via NodeSource (Ubuntu 24.04 ships Node 18 which is EOL) and add a Nix check to verify the wrapper and Node version at build time.
98 lines
2.7 KiB
Nix
98 lines
2.7 KiB
Nix
# nix/python.nix — uv2nix virtual environment builder
|
|
{
|
|
python311,
|
|
lib,
|
|
callPackage,
|
|
uv2nix,
|
|
pyproject-nix,
|
|
pyproject-build-systems,
|
|
stdenv,
|
|
}:
|
|
let
|
|
workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ./..; };
|
|
hacks = callPackage pyproject-nix.build.hacks { };
|
|
|
|
overlay = workspace.mkPyprojectOverlay {
|
|
sourcePreference = "wheel";
|
|
};
|
|
|
|
isAarch64Darwin = stdenv.hostPlatform.system == "aarch64-darwin";
|
|
|
|
# Keep the workspace locked through uv2nix, but supply the local voice stack
|
|
# from nixpkgs so wheel-only transitive artifacts do not break evaluation.
|
|
mkPrebuiltPassthru = dependencies: {
|
|
inherit dependencies;
|
|
optional-dependencies = { };
|
|
dependency-groups = { };
|
|
};
|
|
|
|
mkPrebuiltOverride = final: from: dependencies:
|
|
hacks.nixpkgsPrebuilt {
|
|
inherit from;
|
|
prev = {
|
|
nativeBuildInputs = [ final.pyprojectHook ];
|
|
passthru = mkPrebuiltPassthru dependencies;
|
|
};
|
|
};
|
|
|
|
# Legacy alibabacloud packages ship only sdists with setup.py/setup.cfg
|
|
# and no pyproject.toml, so setuptools isn't declared as a build dep.
|
|
buildSystemOverrides = final: prev: builtins.mapAttrs
|
|
(name: _: prev.${name}.overrideAttrs (old: {
|
|
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ final.setuptools ];
|
|
}))
|
|
(lib.genAttrs [
|
|
"alibabacloud-credentials-api"
|
|
"alibabacloud-endpoint-util"
|
|
"alibabacloud-gateway-dingtalk"
|
|
"alibabacloud-gateway-spi"
|
|
"alibabacloud-tea"
|
|
] (_: null));
|
|
|
|
pythonPackageOverrides = final: _prev:
|
|
if isAarch64Darwin then {
|
|
numpy = mkPrebuiltOverride final python311.pkgs.numpy { };
|
|
|
|
av = mkPrebuiltOverride final python311.pkgs.av { };
|
|
|
|
humanfriendly = mkPrebuiltOverride final python311.pkgs.humanfriendly { };
|
|
|
|
coloredlogs = mkPrebuiltOverride final python311.pkgs.coloredlogs {
|
|
humanfriendly = [ ];
|
|
};
|
|
|
|
onnxruntime = mkPrebuiltOverride final python311.pkgs.onnxruntime {
|
|
coloredlogs = [ ];
|
|
numpy = [ ];
|
|
packaging = [ ];
|
|
};
|
|
|
|
ctranslate2 = mkPrebuiltOverride final python311.pkgs.ctranslate2 {
|
|
numpy = [ ];
|
|
pyyaml = [ ];
|
|
};
|
|
|
|
faster-whisper = mkPrebuiltOverride final python311.pkgs.faster-whisper {
|
|
av = [ ];
|
|
ctranslate2 = [ ];
|
|
huggingface-hub = [ ];
|
|
onnxruntime = [ ];
|
|
tokenizers = [ ];
|
|
tqdm = [ ];
|
|
};
|
|
} else {};
|
|
|
|
pythonSet =
|
|
(callPackage pyproject-nix.build.packages {
|
|
python = python311;
|
|
}).overrideScope
|
|
(lib.composeManyExtensions [
|
|
pyproject-build-systems.overlays.default
|
|
overlay
|
|
buildSystemOverrides
|
|
pythonPackageOverrides
|
|
]);
|
|
in
|
|
pythonSet.mkVirtualEnv "hermes-agent-env" {
|
|
hermes-agent = [ "all" ];
|
|
}
|