hermes - 💡(How to fix) Fix [Feature]: nix package should support source patching [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#16537Fetched 2026-04-28 06:52:43
View on GitHub
Comments
1
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×3commented ×1

Fix Action

Fix / Workaround

This makes it impossible for downstream consumers to apply patches to the Python source via overrideAttrs + patches — there's no source to patch since patchPhase is skipped.

Consumer flakes that follows hermes-agent need to apply unmerged bugfix PRs (e.g. #13567) to the Python source. Currently the only option is maintaining a fork branch, which doesn't scale when carrying multiple unrelated patches.

Expose a sourcePatches argument (or similar) in python.nix / packages.nix that applies patches to the workspace source before the uv2nix venv build. For example:

Code Example

# python.nix
{ python312, lib, callPackage, uv2nix, pyproject-nix, pyproject-build-systems, stdenv,
  sourcePatches ? [],  # ← new
}:
let
  patchedSource = if sourcePatches == [] then ./.. else
    pkgs.applyPatches { src = ./..; patches = sourcePatches; };
  workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = patchedSource; };
  ...

---

hermesVenv = pkgs.callPackage ./python.nix {
  inherit (inputs) uv2nix pyproject-nix pyproject-build-systems;
  sourcePatches = cfg.sourcePatches or [];
};
RAW_BUFFERClick to expand / collapse

Feature Description

The nix package (nix/packages.nix) uses dontUnpack = true; dontBuild = true; — it's a wrapper that copies bundled skills and creates makeWrapper entries around hermesVenv binaries. The Python source (tools/, run_agent.py, etc.) lives inside hermesVenv, built by python.nix via pythonSet.mkVirtualEnv.

This makes it impossible for downstream consumers to apply patches to the Python source via overrideAttrs + patches — there's no source to patch since patchPhase is skipped.

Use Case

Consumer flakes that follows hermes-agent need to apply unmerged bugfix PRs (e.g. #13567) to the Python source. Currently the only option is maintaining a fork branch, which doesn't scale when carrying multiple unrelated patches.

Proposed Approach

Expose a sourcePatches argument (or similar) in python.nix / packages.nix that applies patches to the workspace source before the uv2nix venv build. For example:

# python.nix
{ python312, lib, callPackage, uv2nix, pyproject-nix, pyproject-build-systems, stdenv,
  sourcePatches ? [],  # ← new
}:
let
  patchedSource = if sourcePatches == [] then ./.. else
    pkgs.applyPatches { src = ./..; patches = sourcePatches; };
  workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = patchedSource; };
  ...

Then in packages.nix, pass it through:

hermesVenv = pkgs.callPackage ./python.nix {
  inherit (inputs) uv2nix pyproject-nix pyproject-build-systems;
  sourcePatches = cfg.sourcePatches or [];
};

Alternatives Considered

  • Fork branch: works but doesn't scale with multiple patches and requires constant rebasing.
  • postInstall patching on the wrapper: only works for bundled skills in $out/share/hermes-agent/skills/, not for Python source in the venv.
  • python312.override { packageOverrides }: only overrides nixpkgs Python packages, not the hermes-agent workspace package itself.

extent analysis

TL;DR

To enable downstream consumers to apply patches to the Python source, add a sourcePatches argument to python.nix and pass it through to packages.nix.

Guidance

  • Introduce a sourcePatches argument in python.nix to accept a list of patches to apply to the workspace source before building the uv2nix venv.
  • Modify python.nix to use pkgs.applyPatches to apply the provided patches to the source code if sourcePatches is not empty.
  • In packages.nix, pass the sourcePatches argument through to the hermesVenv package to enable consumers to provide patches.
  • Verify the fix by creating a consumer flake that applies a test patch to the Python source and checks that the patch is correctly applied in the resulting hermesVenv package.

Example

# python.nix
{ python312, lib, callPackage, uv2nix, pyproject-nix, pyproject-build-systems, stdenv,
  sourcePatches ? [],  # ← new
}:
let
  patchedSource = if sourcePatches == [] then ./.. else
    pkgs.applyPatches { src = ./..; patches = sourcePatches; };
  workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = patchedSource; };
  ...

Notes

This solution assumes that the uv2nix and pyproject-nix dependencies are correctly configured and that the sourcePatches argument is properly passed through to the hermesVenv package.

Recommendation

Apply workaround by introducing the sourcePatches argument to python.nix and passing it through to packages.nix, as this allows downstream consumers to apply patches to the Python source without requiring a fork branch or other workar

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix [Feature]: nix package should support source patching [1 comments, 1 participants]