Genix rebuilds + hyprland version fix
This commit is contained in:
1 parent
cd7c908fde
commit
fd733cdc21
44 files changed
+363
-161
No files matched your search
@@ -19,6 +19,7 @@
|
||||
laptop-power-mgr = {
|
||||
enable = true;
|
||||
enableTempMonitor = true;
|
||||
enableLidSuspendWatchdog = true;
|
||||
};
|
||||
amdgpu.enable = true;
|
||||
};
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
{ config, lib, skyg-secrets, ... }:
|
||||
let
|
||||
apps = config.skyg.internalNetworkingMap.apps;
|
||||
robotSecrets = [ "robots-shared" "robots-sibli" ];
|
||||
robotSecrets = [ "robots-shared" "robots-sibli" "robots-genix" ];
|
||||
secret = name: config.age.secrets.${name}.path;
|
||||
ports = {
|
||||
ollama = 11434;
|
||||
ds4 = 8000;
|
||||
tracker = 1984;
|
||||
};
|
||||
# A robot's seed: its config plus the files it shares with the others.
|
||||
# Each robot gets copies under /etc/nixos/seed (same layout as this repo),
|
||||
# so a robot that rebuilds itself (genix) keeps working.
|
||||
seedOf = file: {
|
||||
root = ../../..;
|
||||
configuration = file;
|
||||
extraFiles = [
|
||||
./robotnix/common.nix
|
||||
./robotnix/buzz.nix
|
||||
../../../pkgs/buzz-cli
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
age.secrets = lib.genAttrs robotSecrets (name: {
|
||||
@@ -47,7 +59,7 @@ in
|
||||
cpus = { min = 1; max = 4; };
|
||||
memory = { min = "2G"; max = "16G"; };
|
||||
disk = { rootSize = "100G"; homeSize = "60G"; };
|
||||
seed.configuration = ./robotnix/sibli.nix;
|
||||
seed = seedOf ./robotnix/sibli.nix;
|
||||
hermes = {
|
||||
name = "Siblix";
|
||||
environmentFiles = [ (secret "robots-sibli") ];
|
||||
@@ -66,5 +78,47 @@ in
|
||||
access = { };
|
||||
git.enable = false;
|
||||
};
|
||||
|
||||
# Persistent and self-managing: genix changes and applies its own system
|
||||
# (robotnix-apply), pushes its flake to gitea, and pulls it back after a
|
||||
# reseed. Add /var/lib/robotnix-git/id_ed25519.pub (inside genix) as a
|
||||
# deploy key with write access on ari/genix.
|
||||
robots.genix = {
|
||||
id = 3;
|
||||
address = apps.genix.ip;
|
||||
cpus = { min = 1; max = 6; };
|
||||
memory = { min = "4G"; max = "24G"; };
|
||||
disk = { rootSize = "150G"; homeSize = "100G"; };
|
||||
seed = seedOf ./robotnix/genix.nix;
|
||||
selfManage.enable = true;
|
||||
git = {
|
||||
remoteUrl = "gitea@gitea.app.internal:Hermenix/genix.git";
|
||||
interval = "hourly";
|
||||
};
|
||||
hermes = {
|
||||
name = "Genix";
|
||||
environmentFiles = [ (secret "robots-genix") ];
|
||||
settings = {
|
||||
model = {
|
||||
provider = "commandcode";
|
||||
default = "deepseek/deepseek-v4.1-flash";
|
||||
};
|
||||
fallback_providers = [
|
||||
{ provider = "anthropic"; model = "claude-haiku-5-5"; }
|
||||
{ provider = "openrouter"; model = "deepseek/deepseek-v4.1-flash"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
allowDocker = true;
|
||||
# Survive a reseed (root is rebuilt from the git remote).
|
||||
persist = [
|
||||
"/var/lib/hermes"
|
||||
"/var/lib/docker"
|
||||
];
|
||||
# Push/pull its flake over gitea's ssh.
|
||||
access.lanAccess = [
|
||||
{ address = apps.gitea.ip; port = 22; }
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
# Buzz for a robot's Hermes: the `buzz` CLI and a profile for its key.
|
||||
# Shared by this host's robots (copied into each under /etc/nixos/seed).
|
||||
# Needs a Buzz identity in the robot's secret: `skyg buzz identity <robot>`.
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.skyg.robot.buzz;
|
||||
# Built from this repo; the robot gets a copy of pkgs/buzz-cli with this file.
|
||||
buzz-cli = pkgs.callPackage ../../../../pkgs/buzz-cli { };
|
||||
in
|
||||
{
|
||||
options.skyg.robot.buzz = {
|
||||
enable = lib.mkEnableOption "Buzz for this robot's Hermes";
|
||||
homeChannel = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "BUZZ_HOME_CHANNEL (not secret, so it lives here, not in the secret).";
|
||||
};
|
||||
profileName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = config.services.hermes-agent.environment.API_SERVER_MODEL_NAME or config.networking.hostName;
|
||||
defaultText = lib.literalExpression "the Hermes gateway model name, else the host name";
|
||||
description = "Name published for a new key that has no Buzz profile yet.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ buzz-cli ];
|
||||
|
||||
# The Hermes service PATH has no system packages.
|
||||
services.hermes-agent.environment = {
|
||||
BUZZ_CLI_PATH = "${buzz-cli}/bin/buzz";
|
||||
} // lib.optionalAttrs (cfg.homeChannel != null) {
|
||||
BUZZ_HOME_CHANNEL = cfg.homeChannel;
|
||||
};
|
||||
|
||||
# A new Buzz key has no profile, and Hermes won't connect without one.
|
||||
# Publish one at start if missing; the relay keeps it.
|
||||
systemd.services.buzz-profile = {
|
||||
description = "Publish the Buzz profile if missing";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
before = [ "hermes-agent.service" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
path = [ buzz-cli pkgs.jq ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
User = "hermes";
|
||||
EnvironmentFile = config.systemd.services.hermes-agent.serviceConfig.EnvironmentFile;
|
||||
};
|
||||
script = ''
|
||||
if [ -z "''${BUZZ_PRIVATE_KEY:-}" ] || [ -z "''${BUZZ_RELAY_URL:-}" ]; then
|
||||
echo "No Buzz creds, skipping."
|
||||
exit 0
|
||||
fi
|
||||
# Retry: the relay may not be reachable yet. Failure is not fatal.
|
||||
for _ in 1 2 3 4 5; do
|
||||
n=""
|
||||
if out=$(buzz users get); then
|
||||
n=$(jq 'length' <<<"$out") || n=""
|
||||
fi
|
||||
if [ "$n" = "0" ]; then
|
||||
if buzz users set-profile --name ${lib.escapeShellArg cfg.profileName}; then
|
||||
echo "Published Buzz profile."
|
||||
exit 0
|
||||
fi
|
||||
elif [ -n "$n" ]; then
|
||||
echo "Buzz profile exists."
|
||||
exit 0
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
echo "Could not check or publish the Buzz profile." >&2
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
# Shared base for this host's robots (sibli, genix). Robots get a copy under
|
||||
# /etc/nixos/seed (see seedOf in ../robotnix.nix), so a robot that rebuilds
|
||||
# itself keeps working; edit it here for new installs and ephemeral robots.
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
user = config.robotnix.user;
|
||||
in
|
||||
{
|
||||
# The user has no password; ssh keys only.
|
||||
security.sudo.wheelNeedsPassword = false;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
vim
|
||||
curl
|
||||
htop
|
||||
claude-code
|
||||
devenv
|
||||
direnv
|
||||
(python3.withPackages (ps: [ ps.pip ]))
|
||||
nodejs
|
||||
docker-compose
|
||||
zellij
|
||||
];
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# direnv: hook into bash so the repo's devenv shims work.
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
interactiveShellInit = ''
|
||||
eval "$(direnv hook bash)"
|
||||
'';
|
||||
};
|
||||
|
||||
# Docker + compose. Needs allowDocker = true on the host.
|
||||
virtualisation.docker.enable = true;
|
||||
users.users.${user}.extraGroups = [ "docker" ];
|
||||
users.users.hermes.extraGroups = lib.mkIf config.robotnix.hermes.enable [ "docker" ];
|
||||
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 14d";
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# genix's starting config. It is persistent and manages itself: after the
|
||||
# first install this (copied to /etc/nixos/seed/...) belongs to genix, which
|
||||
# changes and applies its own system with robotnix-apply. Edits here only
|
||||
# matter for a fresh install with nothing on its git remote.
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./common.nix
|
||||
./buzz.nix
|
||||
];
|
||||
|
||||
skyg.robot.buzz.enable = true;
|
||||
}
|
||||
@@ -1,92 +1,29 @@
|
||||
# sibli is ephemeral: root resets to this config on every start, so change
|
||||
# things here (then rebuild the host), not inside the robot.
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
buzz-cli = pkgs.callPackage ../../../../pkgs/buzz-cli { };
|
||||
robotoName = config.services.hermes-agent.environment.API_SERVER_MODEL_NAME;
|
||||
in
|
||||
{
|
||||
# The user has no password; ssh keys only.
|
||||
security.sudo.wheelNeedsPassword = false;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
vim
|
||||
curl
|
||||
htop
|
||||
claude-code
|
||||
devenv
|
||||
direnv
|
||||
(python3.withPackages (ps: [ ps.pip ]))
|
||||
nodejs
|
||||
docker-compose
|
||||
zellij
|
||||
buzz-cli
|
||||
imports = [
|
||||
./common.nix
|
||||
./buzz.nix
|
||||
];
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# direnv: hook into bash so the repo's devenv shims work.
|
||||
programs.bash = {
|
||||
skyg.robot.buzz = {
|
||||
enable = true;
|
||||
interactiveShellInit = ''
|
||||
eval "$(direnv hook bash)"
|
||||
'';
|
||||
homeChannel = "a8969cdc-7ba2-4e25-ae18-b898ab59003d";
|
||||
};
|
||||
|
||||
services.hermes-agent.environment = {
|
||||
BUZZ_CLI_PATH = "${buzz-cli}/bin/buzz";
|
||||
BUZZ_HOME_CHANNEL = "a8969cdc-7ba2-4e25-ae18-b898ab59003d";
|
||||
};
|
||||
|
||||
# A new Buzz key has no profile, and Hermes won't connect without one.
|
||||
# Publish one at start if missing; the relay keeps it across resets.
|
||||
systemd.services.buzz-profile = {
|
||||
description = "Publish the Buzz profile if missing";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
before = [ "hermes-agent.service" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
path = [ buzz-cli pkgs.jq ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
User = "hermes";
|
||||
EnvironmentFile = config.systemd.services.hermes-agent.serviceConfig.EnvironmentFile;
|
||||
services.hermes-agent = {
|
||||
extraPackages = [ pkgs.nodejs ];
|
||||
mcpServers.shortcut = {
|
||||
command = "${pkgs.nodejs}/bin/npx";
|
||||
args = [ "-y" "@shortcut/mcp@latest" ];
|
||||
env.SHORTCUT_API_TOKEN = "\${SHORTCUT_API_KEY}";
|
||||
};
|
||||
script = ''
|
||||
if [ -z "''${BUZZ_PRIVATE_KEY:-}" ] || [ -z "''${BUZZ_RELAY_URL:-}" ]; then
|
||||
echo "No Buzz creds, skipping."
|
||||
exit 0
|
||||
fi
|
||||
# Retry: the relay may not be reachable yet. Failure is not fatal.
|
||||
for _ in 1 2 3 4 5; do
|
||||
n=""
|
||||
if out=$(buzz users get); then
|
||||
n=$(jq 'length' <<<"$out") || n=""
|
||||
fi
|
||||
if [ "$n" = "0" ]; then
|
||||
if buzz users set-profile --name ${lib.escapeShellArg robotoName}; then
|
||||
echo "Published Buzz profile."
|
||||
exit 0
|
||||
fi
|
||||
elif [ -n "$n" ]; then
|
||||
echo "Buzz profile exists."
|
||||
exit 0
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
echo "Could not check or publish the Buzz profile." >&2
|
||||
'';
|
||||
};
|
||||
|
||||
# Docker + compose. Needs allowDocker = true on the host.
|
||||
virtualisation.docker.enable = true;
|
||||
users.users.ari.extraGroups = [ "docker" ];
|
||||
users.users.hermes.extraGroups = [ "docker" ];
|
||||
|
||||
# Own tailnet machine. Needs allowTun = true on the host.
|
||||
# Logs in by itself with TS_AUTHKEY from the robots-sibli secret.
|
||||
# State is kept via persist on the host, so this only matters once.
|
||||
services.tailscale.enable = true;
|
||||
services.tailscale.openFirewall = true;
|
||||
networking.firewall.trustedInterfaces = [ "tailscale0" ];
|
||||
@@ -131,9 +68,4 @@ in
|
||||
echo "Could not log in to Tailscale." >&2
|
||||
'';
|
||||
};
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 14d";
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user