flake: expose hyperhive package + nixos module + agent-base container

This commit is contained in:
müde 2026-05-14 20:33:25 +02:00
parent 6686df93a5
commit c67584c7c1
6 changed files with 145 additions and 0 deletions

61
flake.lock generated
View file

@ -1,5 +1,48 @@
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"naersk",
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1752475459,
"narHash": "sha256-z6QEu4ZFuHiqdOPbYss4/Q8B0BFhacR8ts6jO/F/aOU=",
"owner": "nix-community",
"repo": "fenix",
"rev": "bf0d6f70f4c9a9cf8845f992105652173f4b617f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"naersk": {
"inputs": {
"fenix": "fenix",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1778151388,
"narHash": "sha256-lldMJPUeouEjO8/7aLuwhcsIw29vVihm2ZALzjiqfec=",
"owner": "nix-community",
"repo": "naersk",
"rev": "efdddff9ff4d8e7d0056d57ec67dac50f75ab8f6",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1778430510,
@ -18,10 +61,28 @@
},
"root": {
"inputs": {
"naersk": "naersk",
"nixpkgs": "nixpkgs",
"treefmt-nix": "treefmt-nix"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1752428706,
"narHash": "sha256-EJcdxw3aXfP8Ex1Nm3s0awyH9egQvB2Gu+QEnJn2Sfg=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "591e3b7624be97e4443ea7b5542c191311aa141d",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [

View file

@ -3,6 +3,10 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
@ -13,6 +17,7 @@
inputs@{
self,
nixpkgs,
naersk,
treefmt-nix,
}:
let
@ -37,10 +42,38 @@
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
treefmt-eval = treefmt-nix.lib.evalModule pkgs treefmt-config;
naersk-lib = pkgs.callPackage naersk { };
}
);
in
{
packages = forAllSystems (
{ naersk-lib, ... }:
{
default = naersk-lib.buildPackage {
src = ./.;
meta.description = "hyperhive workspace (hive-c0re, hive-ag3nt, hive-m1nd)";
};
}
);
overlays.default = final: prev: {
hyperhive = self.packages.${prev.stdenv.hostPlatform.system}.default;
};
nixosModules = {
agent-base = ./nix/templates/agent-base.nix;
hive-c0re = ./nix/modules/hive-c0re.nix;
};
nixosConfigurations.agent-base = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
self.nixosModules.agent-base
{ nixpkgs.overlays = [ self.overlays.default ]; }
];
};
devShells = forAllSystems (
{ pkgs, ... }:
{

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

32
nix/modules/hive-c0re.nix Normal file
View file

@ -0,0 +1,32 @@
{
pkgs,
lib,
config,
...
}:
let
cfg = config.services.hive-c0re;
in
{
options.services.hive-c0re = {
enable = lib.mkEnableOption "hive-c0re hyperhive coordinator daemon";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.hyperhive;
defaultText = lib.literalExpression "pkgs.hyperhive";
description = "Package that provides /bin/hive-c0re.";
};
};
config = lib.mkIf cfg.enable {
systemd.services.hive-c0re = {
description = "hyperhive coordinator daemon";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/hive-c0re";
Restart = "on-failure";
RestartSec = 2;
};
};
};
}

View file

@ -0,0 +1,17 @@
{ pkgs, ... }:
{
boot.isContainer = true;
environment.systemPackages = [ pkgs.hyperhive ];
systemd.services.hive-ag3nt = {
description = "hive-ag3nt harness";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.hyperhive}/bin/hive-ag3nt";
Type = "oneshot";
};
};
system.stateVersion = "25.11";
}