summaryrefslogtreecommitdiffstats
path: root/configs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-20 02:04:33 +0000
committertv <tv@krebsco.de>2026-11-20 03:05:43 +0100
commit8416c5b24d8207f6c58f995e58445fe1e55c9ab2 (patch)
treeba3e44a875c4342de43248d53de6a0d04bfc1119 /configs
parenta211d2bd5946b7cc2db01e2f786cce8c0d7ad4f1 (diff)
configs/hermes: build hermes-agent with the system's nixpkgs
flake-compat evaluates hermes-agent's flake with the nixpkgs locked in its flake.lock, nixos-unstable. Instead, call the flake and its inputs directly, with this system's pkgs as nixpkgs, which all of them follow anyway. The other inputs are still fetched as locked. The NixOS module is imported from its file, as the flake's nixosModules.default needs pkgs, which imports can't use. hermes-agent targets nixos-unstable: with nixos-26.05, evaluation fails in fetchPnpmDeps, which expects a pnpm it can override.
Diffstat (limited to 'configs')
-rw-r--r--configs/hermes.nix48
1 files changed, 37 insertions, 11 deletions
diff --git a/configs/hermes.nix b/configs/hermes.nix
index 2cf40e9..a4e5b4e 100644
--- a/configs/hermes.nix
+++ b/configs/hermes.nix
@@ -4,21 +4,47 @@
{ config, lib, pkgs, ... }:
let
tmux = "${pkgs.tmux}/bin/tmux -S /run/hermes/tmux";
- # Not a flake input: flake-compat evaluates hermes-agent's flake, with its
- # flake.lock, using plain nix. Bump rev and sha256 together.
- flake-compat = builtins.fetchTarball {
- url = "https://github.com/edolstra/flake-compat/archive/5edf11c44bc78a0d334f6334cdaf7d60d732daab.tar.gz";
- sha256 = "0yqfa6rx8md81bcn4szfp0hjq2f3h9i8zjzhqqyfqdkrj5559nmw";
+
+ # Bump url and sha256 together.
+ src = builtins.fetchTarball {
+ url = "https://github.com/NousResearch/hermes-agent/archive/9f47677483d1b4de4d1a88d37b3b7ca18b18b215.tar.gz";
+ sha256 = "1xpvwgmn5slmfc2zsr5bfgywz1c6dqx3i5qy6ppbdvg1j2vngx71";
};
- hermes-agent = (import flake-compat {
- src = builtins.fetchTarball {
- url = "https://github.com/NousResearch/hermes-agent/archive/9f47677483d1b4de4d1a88d37b3b7ca18b18b215.tar.gz";
- sha256 = "1xpvwgmn5slmfc2zsr5bfgywz1c6dqx3i5qy6ppbdvg1j2vngx71";
+
+ # hermes-agent's flake without flakes, like flake-compat, but with this
+ # system's pkgs as nixpkgs, which all of the flake's inputs follow. The
+ # other inputs are fetched as locked in its flake.lock; home-manager is
+ # left out, as only the flake's checks use it.
+ callFlake = src: inputs:
+ let
+ self = { _type = "flake"; outPath = src; inherit inputs; }
+ // (import (src + "/flake.nix")).outputs (inputs // { inherit self; });
+ in
+ self;
+ input = name:
+ let locked = (builtins.fromJSON (builtins.readFile (src + "/flake.lock"))).nodes.${name}.locked;
+ in builtins.fetchTarball {
+ url = "https://github.com/${locked.owner}/${locked.repo}/archive/${locked.rev}.tar.gz";
+ sha256 = locked.narHash;
};
- }).defaultNix;
+ nixpkgs = {
+ _type = "flake";
+ outPath = pkgs.path;
+ inherit (pkgs) lib;
+ legacyPackages.${pkgs.stdenv.hostPlatform.system} = pkgs;
+ };
+ pyproject-nix = callFlake (input "pyproject-nix") { inherit nixpkgs; };
+ uv2nix = callFlake (input "uv2nix") { inherit nixpkgs pyproject-nix; };
+ hermes-agent = callFlake src {
+ inherit nixpkgs pyproject-nix uv2nix;
+ flake-parts = callFlake (input "flake-parts") { nixpkgs-lib = nixpkgs; };
+ pyproject-build-systems = callFlake (input "pyproject-build-systems") { inherit nixpkgs pyproject-nix uv2nix; };
+ };
in
{
- imports = [ hermes-agent.nixosModules.default ];
+ # Straight from the file, as the flake's nixosModules.default needs pkgs,
+ # which imports can't use.
+ imports = [ (import (src + "/nix/nixosModules.nix") { inputs.self = hermes-agent; }).flake.nixosModules.default ];
services.hermes-agent = {
enable = true;