Activation reaches plugin discovery before the application dependencies exist. Give PM its own locked Python project and runtime so it can install or repair the application without importing that dependency tree. Keep PM outside the application workspace. A shared uv workspace resolves the application graph and cannot provide this isolation. Route mutations through an isolated worker and preserve transaction callbacks, cancellation, custom package registrations, and correlated receipts. Use the same runtime builder for source installs and packaged payloads. Keep offline wheelhouse support in that builder. Nix builds the independent PM lock as a separate derivation. Refuse lazy-disabled bootstrap before installing tools or dependencies. Move first-party YAML readers and writers to ruamel. Keep the application lock's transitive PyYAML requirements for third-party packages. Verification: - Focused canonical Python suite: 177 passed, 1 host-gated skip. - Electron backend probes: 12 passed. Electron typecheck passed. - Both uv locks, scoped lint, Bash syntax, and whitespace checks passed. - Cold activation, corrupt-app repair, offline staging, and relocation ran. - Built and exercised the Nix PM runtime and standalone YAML merge script. Six broader caller test files retain the same 24 failing test IDs as an archive of HEAD. The existing real-home guard blocks those tests before they can exercise the affected paths. No full-suite pass is claimed. Native Windows signing and full Bionic package execution remain unverified.
41 lines
1.2 KiB
Nix
41 lines
1.2 KiB
Nix
# nix/configMergeScript.nix — Deep-merge Nix settings into existing config.yaml
|
|
#
|
|
# Used by the NixOS module activation script and by checks.nix tests.
|
|
# Nix keys override; user-added keys (skills, streaming, etc.) are preserved.
|
|
{ pkgs }:
|
|
pkgs.writeScript "hermes-config-merge" ''
|
|
#!${pkgs.python3.withPackages (ps: [ ps.ruamel-yaml ])}/bin/python3
|
|
import json, sys
|
|
from pathlib import Path
|
|
from ruamel.yaml import YAML
|
|
|
|
yaml = YAML(typ="safe", pure=True)
|
|
# Existing configs use YAML 1.1 booleans such as yes and off.
|
|
yaml.version = (1, 1)
|
|
yaml.default_flow_style = False
|
|
yaml.sort_base_mapping_type_on_output = False
|
|
|
|
nix_json, config_path = sys.argv[1], Path(sys.argv[2])
|
|
|
|
with open(nix_json) as f:
|
|
nix = json.load(f)
|
|
|
|
existing = {}
|
|
if config_path.exists():
|
|
with open(config_path) as f:
|
|
existing = yaml.load(f) or {}
|
|
|
|
def deep_merge(base, override):
|
|
result = dict(base)
|
|
for k, v in override.items():
|
|
if k in result and isinstance(result[k], dict) and isinstance(v, dict):
|
|
result[k] = deep_merge(result[k], v)
|
|
else:
|
|
result[k] = v
|
|
return result
|
|
|
|
merged = deep_merge(existing, nix)
|
|
with open(config_path, "w") as f:
|
|
yaml.dump(merged, f)
|
|
''
|