diff --git a/.envrc b/.envrc index f746973cae60..01232045f166 100644 --- a/.envrc +++ b/.envrc @@ -1,5 +1,5 @@ watch_file pyproject.toml uv.lock watch_file package-lock.json package.json web/package.json ui-tui/package.json website/package.json apps/shared/package.json apps/desktop/package.json ui-tui/packages/hermes-ink/package.json -watch_file flake.nix flake.lock nix/devShell.nix nix/tui.nix nix/package.nix nix/python.nix +watch_file flake.nix flake.lock nix/devShell.nix nix/tui.nix nix/package.nix nix/python.nix nix/hermes-agent.nix nix/desktop.nix use flake diff --git a/nix/devShell.nix b/nix/devShell.nix index c131bbb5ba77..28fb380a913c 100644 --- a/nix/devShell.nix +++ b/nix/devShell.nix @@ -25,10 +25,12 @@ in { devShells.default = pkgs.mkShell { - inputsFrom = packages; - packages = with pkgs; [ - uv - ]; + packages = + with pkgs; + [ + uv + ] + ++ self'.packages.default.passthru.devDeps; shellHook = '' echo "Hermes Agent dev shell" ${combinedNonNpm} diff --git a/nix/hermes-agent.nix b/nix/hermes-agent.nix index 1dd3031fb948..3d7dc260f5e4 100644 --- a/nix/hermes-agent.nix +++ b/nix/hermes-agent.nix @@ -37,10 +37,14 @@ }: let nodejs = nodejs_22; - hermesVenv = callPackage ./python.nix { - inherit uv2nix pyproject-nix pyproject-build-systems; - dependency-groups = [ "all" ] ++ extraDependencyGroups; - }; + mkHermesVenv = + extraDependencyGroups: + callPackage ./python.nix { + inherit uv2nix pyproject-nix pyproject-build-systems; + dependency-groups = [ "all" ] ++ extraDependencyGroups; + }; + + hermesVenv = mkHermesVenv extraDependencyGroups; hermesNpmLib = callPackage ./lib.nix { inherit npm-lockfile-fix nodejs; @@ -106,12 +110,6 @@ let pythonPath = lib.makeSearchPath sitePackagesPath allExtraPythonPackages; - pyprojectHash = builtins.hashString "sha256" (builtins.readFile ../pyproject.toml); - uvLockHash = - if builtins.pathExists ../uv.lock then - builtins.hashString "sha256" (builtins.readFile ../uv.lock) - else - "none"; checkPackageCollisions = '' import pathlib, sys, re @@ -223,21 +221,10 @@ stdenv.mkDerivation (finalAttrs: { }; devShellHook = '' - STAMP=".nix-stamps/hermes-agent" - STAMP_VALUE="${pyprojectHash}:${uvLockHash}" - if [ ! -f "$STAMP" ] || [ "$(cat "$STAMP")" != "$STAMP_VALUE" ]; then - echo "hermes-agent: installing Python dependencies..." - uv venv .venv --python ${python312}/bin/python3 2>/dev/null || true - source .venv/bin/activate - uv pip install -e ".[all]" - [ -d mini-swe-agent ] && uv pip install -e ./mini-swe-agent 2>/dev/null || true - mkdir -p .nix-stamps - echo "$STAMP_VALUE" > "$STAMP" - else - source .venv/bin/activate - export HERMES_PYTHON=${hermesVenv}/bin/python3 - fi + export HERMES_PYTHON=${hermesVenv}/bin/python3 ''; + + devDeps = runtimeDeps ++ [ (mkHermesVenv (extraDependencyGroups ++ [ "dev" ])) ]; }; meta = with lib; {