refactor(nix): overlay aliases self packages instead of re-instantiating

The overlay previously re-called callPackage against the consumer's
nixpkgs (`final`), which meant `pkgs.hermes-agent` could be a different
derivation than `nix build .#default` and the NixOS module's default —
an untested build matrix against arbitrary consumer nixpkgs versions,
for a package whose Python side is uv2nix-locked anyway.

Now the overlay is a pure alias for the flake's own locked package:
one callPackage site (packages.nix), everything else references it.
.override { extraPythonPackages = ...; } still works — callPackage's
makeOverridable travels with the derivation.

This also removes callHermesArgs.nix (added earlier this branch): with
a single call site there's nothing left to share.

Verified: direct drvPath == overlaid drvPath, .override produces a
distinct drv, nix flake check exit 0 (all 16 checks).
This commit is contained in:
ethernet 2026-07-15 13:42:35 -04:00
parent 651bd9890a
commit 20a1ed1779
3 changed files with 15 additions and 25 deletions

View file

@ -1,13 +0,0 @@
# nix/callHermesArgs.nix — Shared callPackage arguments for hermes-agent.nix
#
# packages.nix (perSystem) and overlays.nix (overlay) both call
# ./hermes-agent.nix with the same flake-input wiring. This file is that
# single set of args — import it and spread, adding only the
# system-resolved npm-lockfile-fix package at each call site.
#
# Only embed clean revs — dirtyRev doesn't represent any upstream commit,
# so comparing it would always claim "update available".
inputs: {
inherit (inputs) uv2nix pyproject-nix pyproject-build-systems;
rev = inputs.self.rev or null;
}

View file

@ -1,12 +1,14 @@
# nix/overlays.nix — Expose pkgs.hermes-agent for external NixOS configs
#
# The overlay is a pure alias for this flake's own package — NOT a
# re-instantiation against the consumer's nixpkgs. This guarantees
# `pkgs.hermes-agent`, `nix build .#default`, and the NixOS module's
# default package are all the exact same locked, tested derivation.
# (.override { extraPythonPackages = ...; } still works — callPackage's
# makeOverridable travels with the package.)
{ inputs, ... }:
{
flake.overlays.default = final: _: {
hermes-agent = final.callPackage ./hermes-agent.nix (
import ./callHermesArgs.nix inputs
// {
npm-lockfile-fix = inputs.npm-lockfile-fix.packages.${final.stdenv.hostPlatform.system}.default;
}
);
hermes-agent = inputs.self.packages.${final.stdenv.hostPlatform.system}.default;
};
}

View file

@ -4,12 +4,13 @@
perSystem =
{ pkgs, lib, inputs', ... }:
let
hermesAgent = pkgs.callPackage ./hermes-agent.nix (
import ./callHermesArgs.nix inputs
// {
npm-lockfile-fix = inputs'.npm-lockfile-fix.packages.default;
}
);
hermesAgent = pkgs.callPackage ./hermes-agent.nix {
inherit (inputs) uv2nix pyproject-nix pyproject-build-systems;
npm-lockfile-fix = inputs'.npm-lockfile-fix.packages.default;
# Only embed clean revs — dirtyRev doesn't represent any upstream
# commit, so comparing it would always claim "update available".
rev = inputs.self.rev or null;
};
in
{
packages = {