mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-22 15:24:03 +01:00
refactor: host profiles; give ruby, kana and aquamarine the TUI home (#512)
- Add the agent profile (modules/nixos/agent.nix: rootless Podman, linger, nix-ld) with home/linux/tui.nix as its home role; ruby, kana and aquamarine use it, so hosts no longer import from hosts/idols-ruby. - Gate nushell's ~/.secrets source behind modules.shell.secrets.enable, off on agent hosts. - Persist the TUI home state on aquamarine's tmpfs root. - Document host profiles in hosts/README.md; add tests/agent-profile and drop the x86_64 colmena-parity test, which needs mysecrets. Assisted-by: Claude Code (claude-opus-5-5)
This commit is contained in:
1 parent
eb6f6c34f0
commit
9a307b313d
31 files changed
+301
-147
No files matched your search
@@ -5,6 +5,53 @@ This directory contains all host-specific configurations for my NixOS and macOS
|
||||
Manual firmware settings are recorded in [`docs/bios.md`](../docs/bios.md), and the shared
|
||||
Wake-on-LAN workflow is in [`docs/wake-on-lan.md`](../docs/wake-on-lan.md).
|
||||
|
||||
## Host Profiles
|
||||
|
||||
Every host is exactly one profile. The profile fixes the system module that
|
||||
`outputs/<system>/src/<host>.nix` imports and the Home Manager role that
|
||||
`home/hosts/<platform>/<host>.nix` imports. A host directory only adds hardware, networking,
|
||||
persisted paths and feature switches on top.
|
||||
|
||||
| Profile | System module (in outputs) | Home role (in home/hosts) | Hosts |
|
||||
| --------- | --------------------------------- | ------------------------- | ------------------------------------------- |
|
||||
| `desktop` | `modules/nixos/desktop.nix` | `home/linux/gui.nix` | `ai`, `shoukei` |
|
||||
| `agent` | `modules/nixos/agent.nix` | `home/linux/tui.nix` | `aquamarine`, `ruby`, `kana` |
|
||||
| `server` | `modules/nixos/server/server.nix` | none | `shoryu`, `shushou`, `youko`, k3s, `akane`¹ |
|
||||
| `darwin` | `modules/darwin` | `home/darwin` | `fern`, `frieren` |
|
||||
|
||||
¹ `akane` (aarch64) uses `server-aarch64.nix`; the k3s nodes import `server.nix` from their host
|
||||
directory.
|
||||
|
||||
- **desktop**: Niri session and GUI apps on top of the full TUI stack.
|
||||
- **agent**: headless, with the full TUI stack from Home Manager (shell, editors, dev toolchains,
|
||||
cloud CLIs, AI agents with their rules and skills), and nix-ld, rootless Podman and linger from
|
||||
the system. Computer use (Xvfb + i3, VNC) is part of the profile but off by default.
|
||||
- **server**: system services only, no Home Manager.
|
||||
|
||||
The `agent` hosts differ only in:
|
||||
|
||||
| | `aquamarine` | `ruby` | `kana` |
|
||||
| ------------ | ------------------------------------------ | ------------------- | ------------- |
|
||||
| Computer use | off | on, with cua-driver | on |
|
||||
| Hardware | physical; 2x R9700, NPU speech recognition | libvirt guest | libvirt guest |
|
||||
| Root | tmpfs; `preservation.nix` keeps home state | disk | disk |
|
||||
|
||||
`outputs/x86_64-linux/tests/agent-profile` checks the `agent` rows.
|
||||
|
||||
### Where a new piece of configuration goes
|
||||
|
||||
1. A tool you run from a shell goes to the Home Manager role (`home/base/core`, `home/base/tui`),
|
||||
never to a host's `environment.systemPackages`.
|
||||
2. Anything that needs root or a system service (nix-ld, Podman, drivers, systemd units) goes to the
|
||||
profile's system module, or to a `modules/nixos` module the profile imports.
|
||||
3. Hardware, networking, the hostname, persisted paths and feature switches go to the host
|
||||
directory.
|
||||
|
||||
A host does not import files from another host's directory; shared code moves under `modules/` or
|
||||
`home/` instead. Existing exceptions, between machines on identical hardware: `shushou` and `youko`
|
||||
reuse `12kingdoms-shoryu`'s hardware and preservation files, and `shoukei` reuses `idols-ai`'s
|
||||
preservation file.
|
||||
|
||||
## Current Host Inventory
|
||||
|
||||
### Physical Machines
|
||||
|
||||
@@ -15,9 +15,6 @@ in
|
||||
{
|
||||
imports = (mylib.scanPaths ./.) ++ [
|
||||
disko.nixosModules.default
|
||||
|
||||
../idols-ruby/packages.nix
|
||||
../idols-ruby/oci-containers
|
||||
];
|
||||
|
||||
# supported file systems, so we can mount any removable disks with these filesystems
|
||||
|
||||
@@ -67,14 +67,9 @@ in
|
||||
# VictoriaMetrics.
|
||||
services.smartd.enable = true;
|
||||
|
||||
# The inference engine ships as an OCI image and is meant to run rootless, so
|
||||
# `podman` is what this host uses to build and start it from the `~/src` checkout
|
||||
# that ./preservation.nix keeps.
|
||||
virtualisation.podman.enable = true;
|
||||
|
||||
# Keep the user systemd manager running after logout and start it at boot,
|
||||
# so enabled user services can run without an active login session.
|
||||
users.users."${myvars.username}".linger = true;
|
||||
# The inference engine ships as an OCI image and runs under the agent
|
||||
# profile's rootless Podman (modules/nixos/agent.nix), built from the `~/src`
|
||||
# checkout that ./preservation.nix keeps.
|
||||
|
||||
# Speech recognition runs on the NPU, see ./asr.nix. The driver and the
|
||||
# compiler it loads come from NixOS/nixpkgs#570230, which is unmerged, so they
|
||||
|
||||
@@ -85,6 +85,84 @@ in
|
||||
|
||||
".config/systemd/user"
|
||||
".config/containers/systemd"
|
||||
|
||||
# ======================================
|
||||
# Home Manager TUI role (home/linux/tui.nix); the same paths `ai` keeps
|
||||
# ======================================
|
||||
".local/state/home-manager"
|
||||
".local/state/nix/profiles"
|
||||
".local/share/nix"
|
||||
".config/nushell" # history
|
||||
|
||||
# ai agents
|
||||
".agents" # skills for all agents
|
||||
".config/agents"
|
||||
".codex"
|
||||
".dsh" # DeepSeek Harness
|
||||
".pi"
|
||||
".config/opencode"
|
||||
".local/share/opencode"
|
||||
".local/state/opencode"
|
||||
# ctx7 docs lookup login
|
||||
{
|
||||
directory = ".config/context7";
|
||||
mode = "0700";
|
||||
}
|
||||
|
||||
# editors
|
||||
".local/share/nvim"
|
||||
".local/state/nvim"
|
||||
".local/share/jupyter"
|
||||
|
||||
# tuios session state, project-tape trust store and layout templates
|
||||
{
|
||||
directory = ".local/state/tuios";
|
||||
mode = "0700";
|
||||
}
|
||||
{
|
||||
directory = ".local/share/tuios";
|
||||
mode = "0700";
|
||||
}
|
||||
".config/tuios"
|
||||
|
||||
# cloud native
|
||||
{
|
||||
directory = ".aws";
|
||||
mode = "0700";
|
||||
}
|
||||
{
|
||||
directory = ".aliyun";
|
||||
mode = "0700";
|
||||
}
|
||||
{
|
||||
directory = ".config/gcloud";
|
||||
mode = "0700";
|
||||
}
|
||||
{
|
||||
directory = ".config/gh";
|
||||
mode = "0700";
|
||||
}
|
||||
{
|
||||
directory = ".kube";
|
||||
mode = "0700";
|
||||
}
|
||||
".terraform.d/plugin-cache"
|
||||
|
||||
# language package managers
|
||||
".npm"
|
||||
"go"
|
||||
".cargo"
|
||||
".local/bin"
|
||||
".local/share/uv"
|
||||
|
||||
{
|
||||
directory = ".gnupg";
|
||||
mode = "0700";
|
||||
}
|
||||
{
|
||||
directory = ".ssh";
|
||||
mode = "0700";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
@@ -123,6 +201,21 @@ in
|
||||
group = lib.mkForce username;
|
||||
mode = lib.mkForce "0750";
|
||||
};
|
||||
"/home/${username}/.local/state".d = {
|
||||
user = username;
|
||||
group = lib.mkForce username;
|
||||
mode = lib.mkForce "0750";
|
||||
};
|
||||
"/home/${username}/.local/state/nix".d = {
|
||||
user = username;
|
||||
group = lib.mkForce username;
|
||||
mode = lib.mkForce "0750";
|
||||
};
|
||||
"/home/${username}/.terraform.d".d = {
|
||||
user = username;
|
||||
group = lib.mkForce username;
|
||||
mode = lib.mkForce "0750";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Idols - Kana
|
||||
|
||||
NixOS VM running under libvirt on `shoryu`, used to run AI agents. It imports the agent and
|
||||
computer-use modules from [`idols-ruby`](../idols-ruby/).
|
||||
NixOS VM running under libvirt on `shoryu`, used to run AI agents. Profile: `agent`, see
|
||||
[Host Profiles](../README.md#host-profiles).
|
||||
|
||||
- Deploy from the VM with `just local`.
|
||||
- Host inventory and role context: [`../README.md`](../README.md).
|
||||
@@ -16,11 +16,8 @@ let
|
||||
ipv4WithMask = "${ipv4}/24";
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
../idols-ruby/packages.nix
|
||||
../idols-ruby/computer-use.nix
|
||||
../idols-ruby/oci-containers
|
||||
];
|
||||
# Headless computer-use environment (Xvfb + i3 + desktop automation + browser).
|
||||
modules.desktop.computerUse.enable = true;
|
||||
|
||||
# supported file systems, so we can mount any removable disks with these filesystems
|
||||
boot.supportedFilesystems = [
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
# Idols - Ruby
|
||||
|
||||
NixOS VM running under libvirt on `shoryu`, used to run AI agents. It owns the shared agent and
|
||||
computer-use modules (`packages.nix`, `computer-use.nix`, `oci-containers/`) that
|
||||
[`idols-kana`](../idols-kana/) imports.
|
||||
NixOS VM running under libvirt on `shoryu`, used to run AI agents. Profile: `agent`, see
|
||||
[Host Profiles](../README.md#host-profiles).
|
||||
|
||||
- Deploy from the VM with `just local`.
|
||||
- Host inventory and role context: [`../README.md`](../README.md).
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
# Headless computer-use environment (sway + desktop automation + browser).
|
||||
modules.desktop.computerUse.enable = true;
|
||||
}
|
||||
@@ -16,11 +16,8 @@ let
|
||||
ipv4WithMask = "${ipv4}/24";
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./packages.nix
|
||||
./computer-use.nix
|
||||
./oci-containers
|
||||
];
|
||||
# Headless computer-use environment (Xvfb + i3 + desktop automation + browser).
|
||||
modules.desktop.computerUse.enable = true;
|
||||
|
||||
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation.
|
||||
boot.binfmt.emulatedSystems = [
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
mylib,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = mylib.scanPaths ./.;
|
||||
|
||||
virtualisation = {
|
||||
docker.enable = true;
|
||||
|
||||
oci-containers = {
|
||||
backend = "docker";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
{
|
||||
pkgs,
|
||||
llm-agents,
|
||||
...
|
||||
}:
|
||||
let
|
||||
agentPackages = llm-agents.packages.${pkgs.stdenv.hostPlatform.system};
|
||||
in
|
||||
{
|
||||
# https://github.com/Mic92/nix-ld
|
||||
#
|
||||
# nix-ld will install itself at `/lib64/ld-linux-x86-64.so.2` so that
|
||||
# it can be used as the dynamic linker for non-NixOS binaries.
|
||||
#
|
||||
# nix-ld works like a middleware between the actual link loader located at `/nix/store/.../ld-linux-x86-64.so.2`
|
||||
# and the non-NixOS binaries. It will:
|
||||
#
|
||||
# 1. read the `NIX_LD` environment variable and use it to find the actual link loader.
|
||||
# 2. read the `NIX_LD_LIBRARY_PATH` environment variable and use it to set the `LD_LIBRARY_PATH` environment variable
|
||||
# for the actual link loader.
|
||||
#
|
||||
# nix-ld's nixos module will set default values for `NIX_LD` and `NIX_LD_LIBRARY_PATH` environment variables, so
|
||||
# it can work out of the box:
|
||||
#
|
||||
# - https://github.com/NixOS/nixpkgs/blob/nixos-26.05/nixos/modules/programs/nix-ld.nix#L42-L45
|
||||
#
|
||||
# You can overwrite `NIX_LD_LIBRARY_PATH` in the environment where you run the non-NixOS binaries to customize the
|
||||
# search path for shared libraries.
|
||||
programs.nix-ld = {
|
||||
enable = true;
|
||||
libraries = with pkgs; [
|
||||
stdenv.cc.cc
|
||||
];
|
||||
};
|
||||
|
||||
environment.systemPackages =
|
||||
with pkgs;
|
||||
[
|
||||
nodejs_24
|
||||
pnpm
|
||||
|
||||
#-- python
|
||||
uv # python project package manager
|
||||
(python313.withPackages (
|
||||
ps: with ps; [
|
||||
pandas
|
||||
requests
|
||||
pyquery
|
||||
pyyaml
|
||||
numpy
|
||||
|
||||
# model downloaders
|
||||
huggingface-hub
|
||||
]
|
||||
))
|
||||
|
||||
rustc
|
||||
cargo # rust package manager
|
||||
go
|
||||
|
||||
# cryptography
|
||||
age
|
||||
sops
|
||||
rclone
|
||||
gnupg
|
||||
|
||||
# cloud-native
|
||||
kubectl
|
||||
istioctl
|
||||
kubernetes-helm
|
||||
fluxcd
|
||||
terraform
|
||||
|
||||
# db related
|
||||
pgcli
|
||||
mongosh
|
||||
sqlite
|
||||
|
||||
yt-dlp # youtube/bilibili/soundcloud/... video/music downloader
|
||||
]
|
||||
# AI Agent Tools
|
||||
++ [
|
||||
# Agents
|
||||
agentPackages.codex
|
||||
agentPackages.opencode2
|
||||
agentPackages.pi
|
||||
# dsh from nur-packages: llm-agents.nix's dsh cannot boot on nixpkgs node
|
||||
# (node-addon-require-builtin probe), this one shims it.
|
||||
pkgs.dsh
|
||||
];
|
||||
}
|
||||
Reference in new issue
Block a user