module: serve subcommand + runtime/state dirs

This commit is contained in:
müde 2026-05-14 20:52:44 +02:00
parent 90798b936e
commit b1b11cf17c

View file

@ -16,6 +16,11 @@ in
defaultText = lib.literalExpression "pkgs.hyperhive"; defaultText = lib.literalExpression "pkgs.hyperhive";
description = "Package that provides /bin/hive-c0re."; description = "Package that provides /bin/hive-c0re.";
}; };
agentFlake = lib.mkOption {
type = lib.types.str;
default = "/etc/hyperhive#agent-base";
description = "Flake reference passed to `nixos-container create --flake` when spawning sub-agents.";
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -23,9 +28,12 @@ in
description = "hyperhive coordinator daemon"; description = "hyperhive coordinator daemon";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
ExecStart = "${cfg.package}/bin/hive-c0re"; ExecStart = "${cfg.package}/bin/hive-c0re --socket /run/hyperhive/host.sock serve --agent-flake ${cfg.agentFlake}";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 2; RestartSec = 2;
RuntimeDirectory = "hyperhive";
RuntimeDirectoryMode = "0750";
StateDirectory = "hyperhive";
}; };
}; };
}; };