# `checks.script-test-agent-memory-cap` — runs the four readers of # `/run/hive/memory-max-bytes` in ../agent-modules/memory-cap.nix: the # environment generator, the unit generator, the boot check that warns about # an unusable cap, and the login-shell snippet `/etc/set-environment` sources. # The cases are in ./agent-memory-cap.sh. # # What runs is the rendered scripts. The one edit is the cap file's path, moved # under the build directory, and the snippet's reference to the environment # generator, pointed at that edited copy. { pkgs, lib, self, nixosSystem, }: let inherit (import ../module-eval/lib.nix { inherit pkgs lib self nixosSystem ; }) agentWith ; machine = agentWith { }; in pkgs.runCommand "hyperhive-script-test-agent-memory-cap" { ENV_GENERATOR = machine.environment.etc."systemd/system-environment-generators/50-hyperhive-memory-cap".source; UNIT_GENERATOR = machine.systemd.generators.hyperhive-memory-cap; CHECK = machine.systemd.services.hyperhive-memory-cap-check.serviceConfig.ExecStart; PROFILE = machine.environment.etc."hyperhive/memory-cap.sh".source; EXTRA_INIT = machine.environment.extraInit; SHELLS = "${pkgs.dash}/bin/dash ${pkgs.bash}/bin/sh"; } '' ${pkgs.bash}/bin/bash ${./agent-memory-cap.sh} touch "$out" ''