Compare commits
119
Commits
ee00ccb0d7
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3def9ce938 | ||
|
|
2e540a2224 | ||
|
|
89484504e4 | ||
|
|
6fbc61c7ea | ||
|
|
1dc3ae47f9 | ||
|
|
a092e23f6e | ||
|
|
7a973aaee6 | ||
|
|
5c48ef9c1e | ||
|
|
01f039a5ce | ||
|
|
4c9d8f88cb | ||
|
|
c8223aec40 | ||
|
|
6abc047879 | ||
|
|
a48af90346 | ||
|
|
32ea399d89 | ||
|
|
705f2eb4c6 | ||
|
|
5139a55daa | ||
|
|
f9835c150f | ||
|
|
e9479f9be1 | ||
|
|
a1ebcfb6aa | ||
|
|
956158729e | ||
|
|
87aea41843 | ||
|
|
f3d03f4c20 | ||
|
|
ff770c1d03 | ||
|
|
d7875b588e | ||
|
|
5881b9c8be | ||
|
|
d7bd46c0cd | ||
|
|
b583c550f3 | ||
|
|
08207da02b | ||
|
|
3efec42e72 | ||
|
|
fb5503ec36 | ||
|
|
be6e7492b3 | ||
|
|
10d85b2a91 | ||
|
|
6db82ed10a | ||
|
|
09c6fe2235 | ||
|
|
2547ec45b4 | ||
|
|
26856003d4 | ||
|
|
ce92096042 | ||
|
|
62c41a6f8e | ||
|
|
d8ea131327 | ||
|
|
a3178f0507 | ||
|
|
3b44ae1354 | ||
|
|
e72789fbb1 | ||
|
|
f06921593d | ||
|
|
416c648f99 | ||
|
|
25a21d2f66 | ||
|
|
dfd4ca06a2 | ||
|
|
d337d7605e | ||
|
|
f2d1ce5744 | ||
|
|
a8bc08de43 | ||
|
|
0c265f7a74 | ||
|
|
d6b79f8d8d | ||
|
|
39fc85e8f9 | ||
|
|
088de60af5 | ||
|
|
eb94f5a034 | ||
|
|
91d6511f01 | ||
|
|
e3f01e3c35 | ||
|
|
880c85facb | ||
|
|
6ff3b48fcf | ||
|
|
eb862ebf7e | ||
|
|
fa5343f211 | ||
|
|
82480e88f4 | ||
|
|
a60b842ee2 | ||
|
|
2d09b6c69f | ||
|
|
e2bff381b9 | ||
|
|
2b83e9c606 | ||
|
|
1c420283f4 | ||
|
|
8fec1dd4bb | ||
|
|
18f4639bb7 | ||
|
|
fdf7ecb3e4 | ||
|
|
2a2b1d8421 | ||
|
|
594a1c1901 | ||
|
|
dd4965f030 | ||
|
|
a12f10d964 | ||
|
|
9856e11416 | ||
|
|
fd733cdc21 | ||
|
|
cd7c908fde | ||
|
|
62e73eb4d2 | ||
|
|
0efbc5817b | ||
|
|
2e8529fff0 | ||
|
|
3a2cb09d07 | ||
|
|
bfdcd45746 | ||
|
|
9217e61675 | ||
|
|
6f0efacfca | ||
|
|
eecad5cc4a | ||
|
|
6ec9594f92 | ||
|
|
567a85b946 | ||
|
|
95b6885f4e | ||
|
|
57fbf70b7c | ||
|
|
86f9ae010e | ||
|
|
520f804738 | ||
|
|
9b537c9f62 | ||
|
|
bb3c73b310 | ||
|
|
eb6380ddfe | ||
|
|
0cf504ad27 | ||
|
|
39f062a7af | ||
|
|
4c8efd185d | ||
|
|
5d2ff990ae | ||
|
|
4a72048f0d | ||
|
|
97644f4598 | ||
|
|
53e272367e | ||
|
|
b53ab9c854 | ||
|
|
32bc1e83e9 | ||
|
|
b0da186ed3 | ||
|
|
3c244541cb | ||
|
|
8dcbd3bf6c | ||
|
|
56f93456cd | ||
|
|
7f8db88b8c | ||
|
|
246f2cf360 | ||
|
|
c9f459d4c6 | ||
|
|
e962c5cebc | ||
|
|
7dd5f9e17b | ||
|
|
53c41cf826 | ||
|
|
4f3a95b42c | ||
|
|
da93290953 | ||
|
|
e719674851 | ||
|
|
3b764654d2 | ||
|
|
71f0c086a4 | ||
|
|
1e6cf7251f | ||
|
|
a8fa1f83af |
No files matched your search
@@ -0,0 +1,18 @@
|
||||
# .agents/looprails
|
||||
|
||||
Looprail files for this repo.
|
||||
|
||||
## journal-triage
|
||||
|
||||
`journal-triage.toml` reads the journald log of this machine, has Claude Opus triage it
|
||||
against this repo, and writes a report ranked by urgency to `.tmp/journal-reports/<host>-<date>.md` (gitignored).
|
||||
|
||||
- `journal-triage/collect.sh`: pulls warnings (and worse), failed units and a digest of
|
||||
unique messages into the run folder.
|
||||
- `journal-triage/triage.md`: the brief for Opus. It reads `GUIDELINES.md`, traces each issue to
|
||||
`hosts/<host>/` or `modules/`, and suggests fixes as repo changes. It only reads and suggests:
|
||||
no edits, no builds, no sudo.
|
||||
- Inputs: `since` (default `24 hours ago`), `priority` (`err`, `warning`, `notice`),
|
||||
`host` (default `fwbook`), `repo` (default `/home/ari/nixos-setup`).
|
||||
|
||||
Run: `looprail run .agents/looprails/journal-triage.toml`, or ask the agent to run it.
|
||||
@@ -0,0 +1,45 @@
|
||||
name = "journal-triage"
|
||||
description = "Collect journald warnings, triage them with Claude Opus against this repo, and write an urgency-ranked report with fixes as repo changes."
|
||||
|
||||
[inputs.static]
|
||||
since = { type = "string", description = "How far back to read the journal.", min_length = 1, default = "24 hours ago" }
|
||||
priority = { type = "enum", description = "Lowest log priority to include.", values = ["err", "warning", "notice"], default = "warning" }
|
||||
host = { type = "string", description = "Name of the host folder under hosts/ to trace issues to.", min_length = 1, default = "fwbook" }
|
||||
repo = { type = "string", description = "Path of the NixOS config repo.", min_length = 1, default = "/home/ari/nixos-setup" }
|
||||
|
||||
[[step.collect]]
|
||||
kind = "shell"
|
||||
description = "Collects journal warnings and failed units into a digest."
|
||||
cwd = "{{ inputs.repo }}"
|
||||
run = ["sh .agents/looprails/journal-triage/collect.sh {{ inputs.since }} {{ inputs.priority }}"]
|
||||
|
||||
[step.collect.outputs]
|
||||
raw_log = { type = "string", description = "Path of the full raw journal log." }
|
||||
digest = { type = "string", description = "Path of the deduplicated digest." }
|
||||
lines = { type = "int", description = "Number of raw log lines." }
|
||||
unique = { type = "int", description = "Number of distinct messages." }
|
||||
|
||||
[[step.triage]]
|
||||
kind = "agent"
|
||||
description = "Has Opus triage the log against the repo and suggest fixes."
|
||||
needs = ["collect"]
|
||||
agent = { command = ["claude-agent-acp"], model = "opus" }
|
||||
cwd = "{{ inputs.repo }}"
|
||||
brief = "journal-triage/triage.md"
|
||||
failover = "agent"
|
||||
|
||||
[step.triage.outputs]
|
||||
summary = { type = "string", description = "Markdown report ranked by urgency.", min_length = 1 }
|
||||
issues = { type = "list", description = "The issues found, with urgency, fix and files.", items = { title = { type = "string" }, urgency = { type = "enum", values = ["critical", "high", "medium", "low", "noise"] }, fix = { type = "string" }, files = { type = "list" } } }
|
||||
|
||||
[[step.report]]
|
||||
kind = "shell"
|
||||
description = "Writes the report to .tmp/journal-reports."
|
||||
needs = ["triage"]
|
||||
run = [
|
||||
"R={{ inputs.repo }}; mkdir -p \"$R/.tmp/journal-reports\"",
|
||||
"S={{ steps.triage.outputs.summary }}; H={{ inputs.host }}; R={{ inputs.repo }}; f=\"$R/.tmp/journal-reports/$H-$(date +%Y-%m-%d-%H%M).md\"; printf '%s\\n' \"$S\" > \"$f\"; echo \"report=$f\" >> \"$NBOT_LR_OUTPUTS\"; echo \"Report written to $f\"",
|
||||
]
|
||||
|
||||
[step.report.outputs]
|
||||
report = { type = "string", description = "Path of the written report." }
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# Collect journald warnings+ and failed units into the run folder, plus a deduplicated digest.
|
||||
set -eu
|
||||
since="$1"; priority="$2"
|
||||
dir="$NBOT_LR_RUN_DIR"
|
||||
raw="$dir/journal-raw.log"; digest="$dir/journal-digest.txt"
|
||||
|
||||
journalctl -p "$priority" --since "$since" --no-pager -q -o short-iso > "$raw" || true
|
||||
|
||||
{
|
||||
echo "=== Failed systemd units ==="
|
||||
systemctl --failed --no-legend --plain || true
|
||||
systemctl --user --failed --no-legend --plain 2>/dev/null || true
|
||||
echo
|
||||
echo "=== Boots in window ==="
|
||||
journalctl --list-boots --no-pager -q | tail -5 || true
|
||||
echo
|
||||
echo "=== Unique messages (count, source: message; numbers/hex normalized), most frequent first ==="
|
||||
cut -d' ' -f3- "$raw" \
|
||||
| sed -E 's/\[[0-9]+\]//; s/0x[0-9a-fA-F]+/0xN/g; s/[0-9]+/N/g' \
|
||||
| sort | uniq -c | sort -rn | head -400
|
||||
} > "$digest"
|
||||
|
||||
lines=$(wc -l < "$raw")
|
||||
uniq=$(grep -c '^ *[0-9]' "$digest" || true)
|
||||
printf 'raw_log=%s\ndigest=%s\nlines=%s\nunique=%s\n' "$raw" "$digest" "$lines" "$uniq" >> "$NBOT_LR_OUTPUTS"
|
||||
@@ -0,0 +1,65 @@
|
||||
You are triaging the systemd journal of the NixOS host `{{ inputs.host }}`, and tracing each issue
|
||||
back to the NixOS config repo that builds it: {{ inputs.repo }} (your working folder).
|
||||
|
||||
Window: since {{ inputs.since }}, priority {{ inputs.priority }} and worse.
|
||||
{{ steps.collect.outputs.lines }} log lines, {{ steps.collect.outputs.unique }} distinct messages.
|
||||
|
||||
- Digest (failed units, boots, deduplicated messages with counts): {{ steps.collect.outputs.digest }}
|
||||
- Full raw log (timestamps, for context): {{ steps.collect.outputs.raw_log }}
|
||||
|
||||
## Rules: read and suggest only
|
||||
|
||||
- Change nothing. Do not edit, create or delete files, in the repo or anywhere else.
|
||||
- Do not run builds or switches: no `nixos-rebuild`, `nh`, `skyg`, `nix build`, `nix flake check`,
|
||||
`nixos-anywhere`, docker/podman builds. No sudo. No git commands that change state.
|
||||
- You may run read-only commands: `systemctl status`, `journalctl -u`, `ls`, `cat`, `grep`, `rg`,
|
||||
`git log`, `git diff`, `nix-instantiate --parse`.
|
||||
- Never read anything in `secrets/`.
|
||||
|
||||
## Steps
|
||||
|
||||
1. Read `GUIDELINES.md` in the repo. Your suggested changes must follow it.
|
||||
2. Read the digest, then grep the raw log for detail where needed.
|
||||
3. Group related messages into issues. Ignore harmless boot-time noise unless it points to
|
||||
something real; list it briefly under "noise" so the reader knows it was seen.
|
||||
4. For each real issue, find where it comes from in the repo: start with `hosts/{{ inputs.host }}/`,
|
||||
then `modules/`, `configs/`, `pkgs/` and `flake.nix`. Check whether another host
|
||||
(`hosts/*/`) already solves the same problem, and reuse that pattern.
|
||||
Note when the cause is outside the repo (a hand-written file in `~/.config`, state on disk).
|
||||
|
||||
## How to write fixes
|
||||
|
||||
- Give each fix as a short suggested Nix change with its repo path, e.g.
|
||||
`hosts/{{ inputs.host }}/systemd.nix` plus a small snippet.
|
||||
- Follow the repo's layout: put config in the matching host sub-file (`hardware.nix`, `systemd.nix`,
|
||||
`packages.nix`, `networking.nix`, `services.nix` or `services/<name>.nix`, `home/default.nix`).
|
||||
Custom options live under `skyg.*`; check `modules/lib.nix` before naming one.
|
||||
- Never suggest `imports = [...]` in host files.
|
||||
- Never suggest editing `flake.lock`, anything in `hosts/*/hardware-configuration/` or
|
||||
`*.hardware-configuration.nix`, or `secrets/`. If the cause lives there, say so and suggest an
|
||||
override in the right host sub-file instead (e.g. `fileSystems."/boot".options` in `hardware.nix`
|
||||
with `lib.mkForce`).
|
||||
- When a fix is imperative (a one-off command), say it needs to be run by hand, and prefer a
|
||||
declarative option when one exists.
|
||||
- Remind the reader that they rebuild themselves; do not tell them a change has been applied.
|
||||
|
||||
## Urgency
|
||||
|
||||
- critical: data loss, security, hardware failing, system unbootable or core service down
|
||||
- high: a service failing or crash-looping, repeated errors with user-visible effect
|
||||
- medium: degraded behaviour, misconfiguration, something that will bite later
|
||||
- low: cosmetic or rare warnings worth a look
|
||||
- noise: benign, safe to ignore
|
||||
|
||||
## Output
|
||||
|
||||
`summary` is a Markdown report:
|
||||
- a one-paragraph overview
|
||||
- sections by urgency, critical first; each issue with evidence (unit, sample message, count,
|
||||
first/last seen), likely cause, the repo files involved, and fixes as suggested repo changes
|
||||
- a short "Repo recommendations" section: patterns across hosts or modules worth changing
|
||||
(duplication, hand-made units that should be declarative, a fix that would help other hosts too)
|
||||
|
||||
Keep it concise, with plain words.
|
||||
|
||||
`issues` is the same issues as a list; `files` holds the repo paths involved (empty if none).
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
name: nbot-wf
|
||||
description: When anything to do with workflows comes up, use the nbot-wf MCP tools; if they are not available, run nbot-wf install and restart the session.
|
||||
---
|
||||
|
||||
When anything to do with workflows comes up, use the nbot-wf MCP tools; if they are not available, run `nbot-wf install` and restart the session.
|
||||
|
||||
The `get_workflow_guide` tool explains how to find, run, watch, answer, stop, resume, write and update a workflow.
|
||||
@@ -0,0 +1,3 @@
|
||||
[mcp_servers.nbot-wf]
|
||||
command = "nbot-wf"
|
||||
args = ["mcp"]
|
||||
@@ -42,3 +42,9 @@ docs
|
||||
.claude
|
||||
.mnt
|
||||
.pi
|
||||
|
||||
# Zed local settings (machine-local MCP tokens live here)
|
||||
.zed/settings.local.json
|
||||
|
||||
|
||||
.nbot-wf
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"nbot-wf": {
|
||||
"command": "nbot-wf",
|
||||
"args": [
|
||||
"mcp"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
/nix/store/8wpcklj1m0cp057gvc6ksvkc6znlipd5-pre-commit-config.json
|
||||
/nix/store/mbdhxcacyi218765m4p2b53ww4fhrlsf-pre-commit-config.json
|
||||
+34
-25
@@ -1,29 +1,38 @@
|
||||
{
|
||||
"show_completions_on_input": true,
|
||||
"languages": {
|
||||
"QML": {
|
||||
"colorize_brackets": true,
|
||||
"inlay_hints": {
|
||||
"show_background": true,
|
||||
"enabled": true
|
||||
},
|
||||
"show_whitespaces": "all",
|
||||
"show_completions_on_input": true,
|
||||
"always_treat_brackets_as_autoclosed": true,
|
||||
"format_on_save": "on",
|
||||
"language_servers": ["qmljs"]
|
||||
}
|
||||
},
|
||||
"lsp": {
|
||||
"qmljs": {
|
||||
"context_servers": {
|
||||
"linux-tracker": {
|
||||
"url": "http://fwdesk.lab.internal:1984/mcp"
|
||||
}
|
||||
},
|
||||
"languages": {
|
||||
"QML": {
|
||||
"colorize_brackets": true,
|
||||
"inlay_hints": {
|
||||
"show_background": true,
|
||||
"enabled": true
|
||||
},
|
||||
"show_whitespaces": "all",
|
||||
"show_completions_on_input": true,
|
||||
"always_treat_brackets_as_autoclosed": true,
|
||||
"format_on_save": "on",
|
||||
"language_servers": [
|
||||
"qmljs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"lsp": {
|
||||
"qmljs": {
|
||||
"enable_lsp_tasks": true,
|
||||
"binary": {
|
||||
"path": "qmlls",
|
||||
"arguments": ["-E"]
|
||||
},
|
||||
"initialization_options": {
|
||||
"buildDir": "."
|
||||
}
|
||||
}
|
||||
}
|
||||
"binary": {
|
||||
"path": "qmlls",
|
||||
"arguments": [
|
||||
"-E"
|
||||
]
|
||||
},
|
||||
"initialization_options": {
|
||||
"buildDir": "."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ Key non-negotiable rules from that file:
|
||||
changes — no matter how small the task.
|
||||
- **Never run builds, system switches, or remote installs** (`nixos-rebuild`,
|
||||
`nh os`, `skyg os`, `skyg remote install`, `nixos-anywhere`, `nix build`,
|
||||
`nix flake check`, etc.) — zero exceptions, even if asked.
|
||||
`nix flake check`, etc.). You may only run it after asking the user 3 times if the are sure about it!
|
||||
- Never edit `flake.lock`, `*.hardware-configuration.nix`, or anything in
|
||||
`secrets/`.
|
||||
- Never add `imports = [...]` to host files.
|
||||
|
||||
@@ -1,179 +1,153 @@
|
||||
# NixOS System Configurations
|
||||
|
||||
My comprehensive Nix configurations for managing multiple hosts, including local machines and remote servers.
|
||||
Nix configs for all my machines: local desktops/laptops and homelab servers.
|
||||
|
||||
## Repository Layout
|
||||
|
||||
```
|
||||
nixos-setup/
|
||||
├── bin/ # `skyg` CLI
|
||||
│ ├── skyg # Bash shim → NuShell command modules in bin/lib/
|
||||
│ ├── check-flake-versions # Shim for `skyg flake check-versions`
|
||||
│ ├── temp-monitor # NuShell CPU/GPU temperature logger (see TEMP_MONITOR_README.md)
|
||||
│ └── lib/ # NuShell command modules (os, remote, secrets, ca, pkgs, flake, build, render, hm)
|
||||
├── configs/ # Application-specific configurations (incl. configs/pki TLS certs)
|
||||
├── pkgs/ # Custom packages (buzz-desktop, colibri, delta-editor, niri-touchscreen-gestures, superset-desktop)
|
||||
├── hosts/ # One folder per host (fwbook, hl-*, iso) + generated hardware configs
|
||||
├── modules/ # Reusable NixOS and Home Manager modules
|
||||
├── bin/ # `skyg` CLI (see bin/ABOUTME.md)
|
||||
│ ├── skyg # Bash shim → NuShell modules in bin/lib/
|
||||
│ ├── temp-monitor # CPU/GPU temperature logger (see TEMP_MONITOR_README.md)
|
||||
│ └── lib/ # Command modules: os, remote, secrets, ca, pkgs, flake, build, render, hm, net
|
||||
├── configs/ # App configs per host, plus configs/pki (lab TLS certs)
|
||||
├── pkgs/ # Custom packages (see pkgs/ABOUTME.md)
|
||||
├── hosts/ # One folder per host (fwbook, hl-*, iso) + disko/hardware files
|
||||
├── modules/
|
||||
│ ├── main.nix # Entry point that wires all modules together
|
||||
│ ├── core/ # Core system modules
|
||||
│ ├── nixos/ # NixOS modules (desktop, server, common)
|
||||
│ ├── home/ # Home Manager modules
|
||||
│ ├── nixos/ # NixOS-specific modules
|
||||
│ └── *.nix # Utility modules (lib, skyg-utils, internal-networking, etc.)
|
||||
│ ├── openwrt/ # OpenWrt config generator
|
||||
│ └── *.nix # Shared helpers (lib, skyg-utils, internal-networking, …)
|
||||
├── openwrt-routers/ # OpenWrt router configs (glmain)
|
||||
├── secrets/ # agenix-encrypted secrets (keys listed in secrets.nix)
|
||||
├── docs/ # Documentation
|
||||
├── flake.nix # Nix flake definition
|
||||
├── flake.lock # Locked dependency versions
|
||||
└── README.md # This file
|
||||
└── flake.nix # Flake definition
|
||||
```
|
||||
|
||||
## Using This Flake
|
||||
|
||||
To use the custom packages in your own NixOS/Home Manager configuration:
|
||||
Custom packages and helpers are exported for reuse:
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs.nixos-setup.url = "github:skykanin/nixos-setup";
|
||||
|
||||
outputs = { self, nixpkgs, nixos-setup, ... }:
|
||||
outputs = { nixos-setup, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixos-setup.lib.pkgs.${system};
|
||||
pkgs = nixos-setup.lib.pkgs."x86_64-linux";
|
||||
in {
|
||||
environment.systemPackages = with pkgs; [
|
||||
niri-touchscreen-gestures
|
||||
];
|
||||
environment.systemPackages = [ pkgs.niri-touchscreen-gestures ];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
You can also import `nixos-setup.lib` to reuse `makeNixOs`, `makeHomeManagerUsers`, `makeIso`, `makeSdImage`, and other utilities.
|
||||
`nixos-setup.lib` also provides `makeNixOs`, `makeHomeManagerUsers`, `makeIso`, `makeSdImage`, and more.
|
||||
|
||||
See [`pkgs/ABOUTME.md`](pkgs/ABOUTME.md) for details on each package.
|
||||
Inside this repo, every package in `pkgs/` is available as `pkgs.<name>` through the overlay.
|
||||
|
||||
## Quick Start
|
||||
## The `skyg` CLI
|
||||
|
||||
The `skyg` script is your main interface for managing these configurations. It's located in `bin/skyg` and uses NuShell. Run `skyg` with no arguments to list subcommands, or `skyg <subcommand> --help` for details.
|
||||
`bin/skyg` is the main tool for this repo. Run `skyg` to list subcommands, or `skyg <subcommand> --help` for details.
|
||||
|
||||
### Available Commands
|
||||
### Local system — `skyg os`
|
||||
|
||||
#### Local System (`skyg os`)
|
||||
| Command | Description |
|
||||
| -------------------------------------- | ---------------------------------------------------------------------------------- |
|
||||
| `skyg os <action>` | Rebuild locally. Actions: `test`, `dry-activate`, `run`, `switch`, `build`, `boot` |
|
||||
| `skyg os <action> --build-host <host>` | Build on another machine (e.g. `--build-host fwdesk`) |
|
||||
| `skyg os rollback` | Go back to the previous generation |
|
||||
|
||||
- **`skyg os <action>`** - Run a local NixOS rebuild. Actions: `test`, `dry-activate`, `run`, `switch`, `build`, `boot`
|
||||
- **`skyg os rollback`** - Roll back to the previous generation
|
||||
- **`--build-host <host>`** - Build on a remote builder (e.g. `skyg os switch --build-host fwdesk`)
|
||||
### Remote hosts — `skyg remote`
|
||||
|
||||
#### Remote Deployments (`skyg remote`)
|
||||
| Command | Description |
|
||||
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `skyg remote <action> <target>` | Deploy to a remote host. Same actions as `skyg os` |
|
||||
| `skyg remote install <target>` | Fresh install via nixos-anywhere using `hosts/hl-<target>.disko.nix`. **Wipes disks.** Asks you to type the hostname; refuses if NixOS is already installed unless `--force-wipe` |
|
||||
| `skyg remote status <target>` | Show one host's status |
|
||||
| `skyg remote status --all` | Show all hosts: generation, pending reboot, needs rebuild |
|
||||
| `skyg remote boot-all` | Run `boot` on every online remote (skips this machine) |
|
||||
| `skyg remote reboot-pending` | Reboot hosts whose booted system differs from the current one, one at a time, after confirmation |
|
||||
|
||||
- **`skyg remote <command> <target>`** - Deploy to a remote machine
|
||||
Example: `skyg remote switch bigbox1` deploys `hl-bigbox1` to `root@bigbox1.lab.internal`.
|
||||
|
||||
Supported remote commands: `test`, `dry-activate`, `run`, `switch`, `build`, `boot`
|
||||
### Flake — `skyg flake`
|
||||
|
||||
Example: `skyg remote switch bigbox1` deploys using the `hl-bigbox1` profile to `root@bigbox1.lab.internal`
|
||||
| Command | Description |
|
||||
| --------------------------- | ---------------------------------------------------------- |
|
||||
| `skyg flake update [input]` | Update all inputs, or one, then show the `flake.lock` diff |
|
||||
| `skyg flake check` | Run `nix flake check --no-build` |
|
||||
| `skyg flake check-versions` | Check that all inputs use the same NixOS release |
|
||||
|
||||
- **`skyg remote install <target>`** - Fresh-install a remote host via nixos-anywhere, using `hosts/hl-<target>.disko.nix`. Always wipes the disks in that file. Aborts if the disko file is missing, if the host already boots NixOS from disk (unless `--force-wipe`), or if you don't type the short hostname to confirm.
|
||||
- **`skyg remote status <target>`** - Check status of a single remote host
|
||||
- **`skyg remote status --all`** - Check status of all remote hosts (generation, pending reboot, needs rebuild)
|
||||
- **`skyg remote boot-all`** - Boot all remote hosts (skips the current machine, checks online status first)
|
||||
- **`skyg remote reboot-pending`** - Find every remote with a pending reboot (its booted system differs from its current system) and reboot them. Lists the affected hosts and asks for confirmation, then reboots them one at a time, waiting for each to come back online and sending a desktop notification when it does.
|
||||
### Images and routers — `skyg build`
|
||||
|
||||
#### Flake Management (`skyg flake`)
|
||||
| Command | Description |
|
||||
| ----------------------------------------- | ------------------------------------------------------------------------------ |
|
||||
| `skyg build image <iso\|pi1\|pi2>` | Build an ISO or a Pi SD card image |
|
||||
| `skyg build openwrt [router] [--dry-run]` | Deploy a router config (default `glmain`). `--dry-run` only renders to `.tmp/` |
|
||||
|
||||
- **`skyg flake update [input]`** - Update all flakes, or a specific input (e.g. `skyg flake update nixpkgs`). Displays the diff of `flake.lock` after updating.
|
||||
- **`skyg flake check`** - Run `nix flake check --no-build`
|
||||
- **`skyg flake check-versions`** - Verify NixOS release version consistency across flake inputs
|
||||
### Home Manager — `skyg hm`
|
||||
|
||||
#### Building Images and Routers (`skyg build`)
|
||||
| Command | Description |
|
||||
| -------------------------- | ----------------------------------------- |
|
||||
| `skyg hm switch [profile]` | Apply Home Manager config (default `ari`) |
|
||||
| `skyg hm build [profile]` | Build Home Manager config |
|
||||
|
||||
- **`skyg build image <iso|pi1|pi2>`** - Build a bootable image: ISO (`iso`) or Pi SD card image (`pi1`, `pi2`)
|
||||
- **`skyg build openwrt [router]`** - Deploy an OpenWrt router config (default: `glmain`). Add `--dry-run` to render configs to `.tmp/` without touching the router.
|
||||
### Secrets — `skyg secrets`
|
||||
|
||||
#### Home Manager (`skyg hm`)
|
||||
| Command | Description |
|
||||
| -------------------------------------------- | ----------------------------------------------- |
|
||||
| `skyg secrets` / `skyg secrets list` | List secret names |
|
||||
| `skyg secrets show <secret>` | Decrypt to `.tmp/unencrypted-<secret>` |
|
||||
| `skyg secrets edit <secret> [file] [--yaml]` | Edit and re-encrypt (`--yaml` validates first) |
|
||||
| `skyg secrets compare <secret>` | Diff the working copy against the stored secret |
|
||||
|
||||
- **`skyg hm switch [profile]`** - Apply home-manager configuration (default: `ari`)
|
||||
- **`skyg hm build [profile]`** - Build home-manager configuration
|
||||
### Lab CA — `skyg ca`
|
||||
|
||||
Example: `skyg hm switch ari` or `skyg hm switch`
|
||||
| Command | Description |
|
||||
| ------------------------------------- | --------------------------------------------------------------------------------------- |
|
||||
| `skyg ca init` | Create the root CA: key → `secrets/lab-ca-key.age`, cert → `configs/pki/lab-ca.crt` |
|
||||
| `skyg ca issue <domain> --for <host>` | Issue a TLS cert: cert → `configs/pki/<domain>.crt`, key → `secrets/<name>-tls-key.age` |
|
||||
|
||||
#### Secrets (`skyg secrets`)
|
||||
### Custom packages — `skyg pkgs`
|
||||
|
||||
- **`skyg secrets list`** - List known secret names
|
||||
- **`skyg secrets show <secret>`** - Decrypt a secret to `.tmp/unencrypted-<secret>`
|
||||
- **`skyg secrets edit <secret> [--yaml]`** - Encrypt a working copy back into the secret
|
||||
- **`skyg secrets compare <secret>`** - Diff the working copy against the stored secret
|
||||
| Command | Description |
|
||||
| ---------------------------------- | ----------------------------------------------- |
|
||||
| `skyg pkgs update --all` | Update every package that has an `update.sh` |
|
||||
| `skyg pkgs update <pkg> [version]` | Update one package (latest, or a given version) |
|
||||
|
||||
#### Lab CA (`skyg ca`)
|
||||
### Network — `skyg net`
|
||||
|
||||
- **`skyg ca init`** - Generate the lab root CA: key → `secrets/lab-ca-key.age`, cert → `configs/pki/lab-ca.crt`
|
||||
- **`skyg ca issue <domain> --for <host>`** - Mint a TLS leaf cert signed by the lab CA: cert → `configs/pki/<domain>.crt`, key → `secrets/<name>-tls-key.age`
|
||||
| Command | Description |
|
||||
| ------------------------- | -------------------------------------------------------------------------------------------- |
|
||||
| `skyg net check [device]` | Show NIC info and run a speed test on every device (or one). `--no-speedtest` skips the test |
|
||||
| `skyg net last` | Show the results of the last `skyg net check` |
|
||||
|
||||
#### Custom Packages (`skyg pkgs`)
|
||||
### Other
|
||||
|
||||
- **`skyg pkgs update --all`** - Auto-detect the latest version for all packages that have `update.sh`
|
||||
- **`skyg pkgs update <pkg>`** - Auto-detect the latest version for a single package
|
||||
- **`skyg pkgs update <pkg> <version>`** - Bump a package to an explicit version
|
||||
|
||||
#### Other
|
||||
|
||||
- **`skyg profiles`** - List all available local profiles
|
||||
- **`skyg profiles --only_remote`** - List only remote profiles (prefixed with `hl-`)
|
||||
- **`skyg render html-tpl <file>`** - Render a Gitea `.tmpl` and serve it on `127.0.0.1` for preview. Foreground — Ctrl+C to stop.
|
||||
|
||||
## Usage Examples
|
||||
|
||||
```bash
|
||||
# Check available profiles
|
||||
skyg profiles
|
||||
|
||||
# Build and switch to new configuration
|
||||
skyg os build
|
||||
skyg os switch
|
||||
|
||||
# Test configuration before switching
|
||||
skyg os test
|
||||
|
||||
# Update dependencies
|
||||
skyg flake update nixpkgs
|
||||
|
||||
# Deploy to a remote server
|
||||
skyg remote switch bigbox1
|
||||
|
||||
# Rollback if something goes wrong
|
||||
skyg os rollback
|
||||
|
||||
# Apply home-manager changes
|
||||
skyg hm switch
|
||||
```
|
||||
|
||||
### Using Custom Packages
|
||||
|
||||
All packages from `pkgs/` are available in your configuration as `pkgs.<name>` thanks to the overlay.
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
environment.systemPackages = with pkgs; [ niri-touchscreen-gestures ];
|
||||
```
|
||||
|
||||
See [`pkgs/ABOUTME.md`](pkgs/ABOUTME.md) for details on each package.
|
||||
| Command | Description |
|
||||
| ----------------------------- | ------------------------------------------------------- |
|
||||
| `skyg profiles` | List all profiles |
|
||||
| `skyg profiles true` | List only remote (`hl-*`) profiles |
|
||||
| `skyg render html-tpl <file>` | Preview a Gitea `.tmpl` on `127.0.0.1` (Ctrl+C to stop) |
|
||||
|
||||
## Managing Secrets
|
||||
|
||||
Secrets are encrypted using [agenix](https://github.com/ryantm/agenix) and stored in `secrets/`.
|
||||
Secrets are encrypted with [agenix](https://github.com/ryantm/agenix) and stored in `secrets/`.
|
||||
|
||||
### Adding a Host to Secrets
|
||||
To give a new host access:
|
||||
|
||||
1. **Get the host's SSH public key**: `cat /etc/ssh/ssh_host_ed25519_key.pub`
|
||||
2. **Add to `secrets.nix`**: Create a variable with the key and add it to each secret's `publicKeys` list
|
||||
3. **Re-encrypt**: for each affected secret run `skyg secrets show <name>` then `skyg secrets edit <name>` to re-encrypt it against the updated key set
|
||||
1. Get its key: `cat /etc/ssh/ssh_host_ed25519_key.pub`
|
||||
2. Add it to `secrets.nix` and to each secret's `publicKeys`
|
||||
3. Re-encrypt each affected secret: `skyg secrets show <name>`, then `skyg secrets edit <name>`
|
||||
|
||||
For more details, see `secrets/ABOUTME.md`.
|
||||
See `secrets/ABOUTME.md` and `docs/agenix.md` for more.
|
||||
|
||||
## Host Profiles
|
||||
|
||||
Available profiles include:
|
||||
|
||||
- **Local**: `fwbook` (Framework laptop)
|
||||
- **Remote**: `hl-bigbox1`, `hl-bigbox2`, `hl-fwdesk`, `hl-fws1`, `hl-minipc1`, `hl-minipc2`, `hl-minipc3`, `hl-pi1`, `hl-pi2`, `hl-terra1`
|
||||
- **ISO**: `iso` (bootable image)
|
||||
- **ISO**: `iso` (bootable installer)
|
||||
|
||||
All profiles automatically have access to the custom packages from the `pkgs/` directory.
|
||||
See `docs/hosts/README.md` for per-host details.
|
||||
+33
-30
@@ -7,21 +7,22 @@ The `skyg` CLI — the single entry point for all system management tasks in thi
|
||||
```
|
||||
bin/
|
||||
├── skyg # Bash shim: exec nu --commands "use lib/cmds.nu *; skyg $*"
|
||||
├── check-flake-versions # Bash shim for `skyg flake check-versions`
|
||||
|
||||
├── temp-monitor # NuShell script: collect CPU/GPU temps to CSV + optional graph
|
||||
├── TEMP_MONITOR_README.md # Usage docs for temp-monitor
|
||||
└── lib/
|
||||
├── cmds.nu # Dispatcher + bare `skyg` + `skyg profiles` + deprecated aliases
|
||||
├── cmds.nu # Dispatcher + bare `skyg` + `skyg profiles`
|
||||
├── os.nu # `skyg os` (local NixOS rebuild/switch/rollback)
|
||||
├── remote.nu # `skyg remote *` (deploy, install, boot-all, status, reboot-pending)
|
||||
├── secrets.nu # `skyg secrets list/show/edit/compare`
|
||||
├── secrets.nu # `skyg secrets [list]/show/edit/compare`
|
||||
├── ca.nu # `skyg ca init/issue`
|
||||
├── buzz.nu # `skyg buzz identity`
|
||||
├── pkgs.nu # `skyg pkgs update`
|
||||
├── flake.nu # `skyg flake update/check/check-versions`
|
||||
├── build.nu # `skyg build image/openwrt`
|
||||
├── render.nu # `skyg render html-tpl`
|
||||
├── hm.nu # `skyg hm <action>`
|
||||
├── net.nu # `skyg net check` (per-device NIC info + shared-server speed test)
|
||||
├── net.nu # `skyg net check` (per-device NIC info + shared-server speed test), `skyg net last`
|
||||
├── net-nic.sh # Bash probe piped to each device by `skyg net check` (NIC model, driver, link/supported speeds)
|
||||
├── helpers.nu # Shared helpers: REPO_ROOT const + internal functions
|
||||
├── profile.nu # Profile helpers and tab-completion data
|
||||
@@ -31,32 +32,34 @@ bin/
|
||||
|
||||
## Key Commands
|
||||
|
||||
| Command | Description |
|
||||
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `skyg os switch` | Rebuild and switch local system |
|
||||
| `skyg os rollback` | Roll back to previous generation |
|
||||
| `skyg remote switch <host>` | Deploy to a remote host |
|
||||
| `skyg remote install <host>` | Fresh-install a remote host via nixos-anywhere, using `hosts/<profile>.disko.nix`. Always wipes the disks in that file. Aborts if the file is missing, if the host already boots NixOS from disk (unless `--force-wipe`), or if you do not type the short hostname. |
|
||||
| `skyg remote status <host>` | Check status of a single remote host |
|
||||
| `skyg remote status --all` | Check status of all remote hosts |
|
||||
| `skyg remote boot-all` | Boot all remote hosts |
|
||||
| `skyg remote reboot-pending` | Reboot every remote host with a pending reboot (`booted-system` != `current-system`). Lists them, asks for confirmation, then reboots one at a time, waiting for each to come back online and sending a desktop notification when it does. |
|
||||
| `skyg hm switch` | Apply Home Manager config |
|
||||
| `skyg flake update [input]` | Update flake inputs |
|
||||
| `skyg flake check` | Run `nix flake check --no-build` |
|
||||
| `skyg flake check-versions` | Verify NixOS release version consistency in flake.nix |
|
||||
| `skyg build image iso\|pi1\|pi2` | Build bootable image — ISO (`iso`) or Pi SD card image (`pi1`, `pi2`) |
|
||||
| `skyg build openwrt [router]` | Deploy OpenWrt config |
|
||||
| `skyg profiles` | List valid local/remote profiles |
|
||||
| `skyg secrets list` | List known secret names |
|
||||
| `skyg secrets show <secret>` | Decrypt a secret to `.tmp/unencrypted-<secret>` |
|
||||
| `skyg secrets edit <secret> [--yaml]` | Encrypt a working copy back into the secret |
|
||||
| `skyg secrets compare <secret>` | Diff the working copy against the stored secret |
|
||||
| `skyg ca init` | Generate the lab root CA: key → `secrets/lab-ca-key.age`, cert → `configs/pki/lab-ca.crt` (see `configs/pki/ABOUTME.md`) |
|
||||
| `skyg ca issue <domain> --for <host>` | Mint a TLS leaf cert signed by the lab CA: cert → `configs/pki/<domain>.crt`, key → `secrets/<name>-tls-key.age`. Auto-registers missing `secrets.nix` entries. |
|
||||
| `skyg pkgs update [--all\|<pkg>]` | Update one or all custom packages |
|
||||
| `skyg net check [device]` | For every managed device (or just `[device]`): report the NIC on the default route (model, driver, current link speed, supported speeds), then run `speedtest-go` via `nix-shell` against one shared server. Logs progress per device and returns a table. `--server <id>` picks the server; `--no-speedtest` skips the test. Offline devices are listed, not tested. |
|
||||
| `skyg render html-tpl <file>` | Render a Gitea `.tmpl` and serve it on `127.0.0.1` for preview. Foreground — Ctrl+C to stop. `<file>` tab-completes from `**/*.tmpl`. |
|
||||
| Command | Description |
|
||||
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `skyg os switch` | Rebuild and switch local system |
|
||||
| `skyg os rollback` | Roll back to previous generation |
|
||||
| `skyg remote switch <host>` | Deploy to a remote host |
|
||||
| `skyg remote install <host>` | Fresh-install a remote host via nixos-anywhere, using `hosts/<profile>.disko.nix`. Always wipes the disks in that file. Aborts if the file is missing, if the host already boots NixOS from disk (unless `--force-wipe`), or if you do not type the short hostname. |
|
||||
| `skyg remote status <host>` | Check status of a single remote host: booted / current / next-boot generation. `reboot_pending` = booted != next boot (`/nix/var/nix/profiles/system`), `needs_build` = local build != next boot (or `"unknown"` if the local eval fails). So hosts deployed with `boot` show up correctly. |
|
||||
| `skyg remote status --all` | Check status of all remote hosts |
|
||||
| `skyg remote boot-all` | Boot all remote hosts |
|
||||
| `skyg remote reboot-pending` | Reboot every remote host with a pending reboot (`booted-system` != next-boot generation, so `boot` deploys count). Lists them, asks for confirmation, then reboots one at a time. Each host must prove it rebooted (boot id changed) and come back on its next-boot generation, otherwise it is reported as failed. Sends a desktop notification per host. |
|
||||
| `skyg hm switch` | Apply Home Manager config |
|
||||
| `skyg flake update [input]` | Update flake inputs |
|
||||
| `skyg flake check` | Run `nix flake check --no-build` |
|
||||
| `skyg flake check-versions` | Verify NixOS release version consistency in flake.nix |
|
||||
| `skyg build image iso\|pi1\|pi2` | Build bootable image — ISO (`iso`) or Pi SD card image (`pi1`, `pi2`) |
|
||||
| `skyg build openwrt [router]` | Deploy OpenWrt config |
|
||||
| `skyg profiles` | List valid local/remote profiles |
|
||||
| `skyg secrets list` | List known secret names |
|
||||
| `skyg secrets show <secret>` | Decrypt a secret to `.tmp/unencrypted-<secret>` |
|
||||
| `skyg secrets edit <secret> [--yaml]` | Encrypt a working copy back into the secret |
|
||||
| `skyg secrets compare <secret>` | Diff the working copy against the stored secret |
|
||||
| `skyg ca init` | Generate the lab root CA: key → `secrets/lab-ca-key.age`, cert → `configs/pki/lab-ca.crt` (see `configs/pki/ABOUTME.md`) |
|
||||
| `skyg ca issue <domain> --for <host>` | Mint a TLS leaf cert signed by the lab CA: cert → `configs/pki/<domain>.crt`, key → `secrets/<name>-tls-key.age`. Auto-registers missing `secrets.nix` entries. |
|
||||
| `skyg buzz identity <robot>` | Make a Buzz (Nostr) identity for a robot's Hermes agent and merge `BUZZ_RELAY_URL` / `BUZZ_PRIVATE_KEY` (plus optional `--channels`, `--home-channel`). The bot answers anyone on the relay by default (`BUZZ_ALLOW_ALL_USERS=true`); `--allowed-users <npubs>` limits it to a list, `--restricted` allows no one into `secrets/robots-<robot>.age`, keeping its other lines. Refuses to replace an existing key without `--rotate`. `--dry-run` only shows the npub. Prints the `buzz-manage add-member <npub>` step. Needs `nak` (dev shell). |
|
||||
| `skyg pkgs update [--all\|<pkg>]` | Update one or all custom packages |
|
||||
| `skyg net check [device]` | For every managed device (or just `[device]`): report the NIC on the default route (model, driver, current link speed, supported speeds), then run `speedtest-go` via `nix-shell` against one shared server. Logs progress per device and returns a table. `--server <id>` picks the server; `--no-speedtest` skips the test. Offline devices are listed, not tested. Every run saves the table to `.tmp/net-checks/<timestamp>.nuon`; `--save <file>` also writes it to `<file>` (format from extension). The server is saved in `.tmp/net-checks/server.nuon` on first run; later runs ask whether to change it (fuzzy pick list from `speedtest-go --list`). `--server` skips the question and leaves the saved server alone. |
|
||||
| `skyg net last` | Show the table from the most recent `skyg net check` run (newest file in `.tmp/net-checks/`). |
|
||||
| `skyg render html-tpl <file>` | Render a Gitea `.tmpl` and serve it on `127.0.0.1` for preview. Foreground — Ctrl+C to stop. `<file>` tab-completes from `**/*.tmpl`. |
|
||||
|
||||
## Agent Note
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
LIB="$SCRIPT_DIR/lib/cmds.nu"
|
||||
exec nu --commands "use \"$LIB\" *; skyg flake check-versions"
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
use types.nu *
|
||||
use helpers.nu *
|
||||
|
||||
# Same host as RELAY_URL in hosts/hl-minipc1/services/buzz.nix (public domain).
|
||||
const BUZZ_DEFAULT_RELAY = "https://buzz.home.sosnovsky.ca"
|
||||
|
||||
# Robots that have a secrets/robots-<name>.age (robots-shared is not a robot).
|
||||
def buzz-robots [] {
|
||||
secret-names
|
||||
| where {|s| ($s | str starts-with "robots-") and $s != "robots-shared" }
|
||||
| each {|s| $s | str replace "robots-" "" }
|
||||
}
|
||||
|
||||
# Drop existing KEY=... lines for the keys in `vars` and in `drop`, then append
|
||||
# the new values. Every other line is kept as is.
|
||||
def env-merge [lines: list<string>, vars: record, drop: list<string>] {
|
||||
let keys = (($vars | columns) ++ $drop)
|
||||
let kept = ($lines | where {|l|
|
||||
let t = ($l | str trim)
|
||||
not ($keys | any {|k| $t | str starts-with $"($k)=" })
|
||||
})
|
||||
$kept ++ ($vars | items {|k, v| $"($k)=($v)" })
|
||||
}
|
||||
|
||||
# Make a Buzz (Nostr) identity for a robot's Hermes agent and write the BUZZ_*
|
||||
# env vars into secrets/robots-<robot>.age. Other lines in the secret are kept.
|
||||
# By default the bot answers anyone on the relay (BUZZ_ALLOW_ALL_USERS=true).
|
||||
# Pass --allowed-users for an explicit list, or --restricted for no one.
|
||||
# The nsec is never printed. Afterwards, add the printed npub to the relay.
|
||||
export def "skyg buzz identity" [
|
||||
robot: string@buzz-robots # Robot name (secret: secrets/robots-<robot>.age)
|
||||
--relay: string # BUZZ_RELAY_URL (default: the lab relay)
|
||||
--allowed-users: string # Only these answer: comma-separated npubs or hex pubkeys (BUZZ_ALLOWED_USERS)
|
||||
--restricted # Neither allow-all nor a list is set: the bot ignores everyone until you add one
|
||||
--channels: string # BUZZ_CHANNELS: comma-separated channel UUIDs
|
||||
--home-channel: string # BUZZ_HOME_CHANNEL: channel UUID for cron/notifications
|
||||
--rotate # Replace an existing BUZZ_PRIVATE_KEY (loses relay membership)
|
||||
--dry-run # Make a key and show the npub; do not touch the secret
|
||||
] {
|
||||
cd $REPO_ROOT
|
||||
if (which nak | is-empty) {
|
||||
error make {msg: "nak not found — run inside the dev shell (nix develop)"}
|
||||
}
|
||||
let secret = $"secrets/robots-($robot).age"
|
||||
let relay_url = ($relay | default $BUZZ_DEFAULT_RELAY | str trim --right --char "/")
|
||||
|
||||
# Read the current secret first, so we fail before making anything.
|
||||
mut existing = []
|
||||
if not $dry_run {
|
||||
if not ($secret | path exists) {
|
||||
error make {msg: $"($secret) not found — create it first (skyg secrets edit robots-($robot))"}
|
||||
}
|
||||
$existing = (^agenix -d $secret | lines)
|
||||
let has_key = ($existing | any {|l| ($l | str trim) | str starts-with "BUZZ_PRIVATE_KEY=" })
|
||||
if $has_key and not $rotate {
|
||||
error make {msg: $"($secret) already has BUZZ_PRIVATE_KEY. Use --rotate to replace it (the robot gets a new identity and must be re-added to the relay)."}
|
||||
}
|
||||
}
|
||||
|
||||
let hex = (^nak key generate | str trim)
|
||||
let pubhex = (^nak key public $hex | str trim)
|
||||
let nsec = (^nak encode nsec $hex | str trim)
|
||||
let npub = (^nak encode npub $pubhex | str trim)
|
||||
let ok = ($nsec | str starts-with "nsec1") and ($npub | str starts-with "npub1")
|
||||
if not $ok {
|
||||
error make {msg: "nak returned an unexpected key format; nothing was written"}
|
||||
}
|
||||
|
||||
mut vars = {BUZZ_RELAY_URL: $relay_url, BUZZ_PRIVATE_KEY: $nsec}
|
||||
if ($allowed_users | is-not-empty) { $vars = ($vars | insert BUZZ_ALLOWED_USERS $allowed_users) }
|
||||
if ($channels | is-not-empty) { $vars = ($vars | insert BUZZ_CHANNELS $channels) }
|
||||
if ($home_channel | is-not-empty) { $vars = ($vars | insert BUZZ_HOME_CHANNEL $home_channel) }
|
||||
# Allow-all is the default; a list or --restricted turns it off (and clears a stale true).
|
||||
mut drop = []
|
||||
if ($allowed_users | is-not-empty) {
|
||||
$vars = ($vars | insert BUZZ_ALLOWED_USERS $allowed_users)
|
||||
$drop = ["BUZZ_ALLOW_ALL_USERS"]
|
||||
} else if $restricted {
|
||||
$drop = ["BUZZ_ALLOW_ALL_USERS"]
|
||||
} else {
|
||||
$vars = ($vars | insert BUZZ_ALLOW_ALL_USERS "true")
|
||||
}
|
||||
|
||||
if $dry_run {
|
||||
print $"Dry run: nothing written. Would set in ($secret):"
|
||||
print ($vars | columns | each {|k| $" ($k)" } | str join "\n")
|
||||
if ($drop | is-not-empty) { print $"Would remove: ($drop | str join ', ')" }
|
||||
print $"npub: ($npub)"
|
||||
return
|
||||
}
|
||||
|
||||
# Only --restricted can leave nobody allowed.
|
||||
let gated = (
|
||||
($allowed_users | is-not-empty)
|
||||
or ($existing | any {|l| ($l | str trim) | str starts-with "BUZZ_ALLOWED_USERS=" })
|
||||
)
|
||||
|
||||
# Straight into agenix over stdin: no plaintext file on disk.
|
||||
let body = ((env-merge $existing $vars $drop) | str join "\n") + "\n"
|
||||
$body | ^agenix -e $secret
|
||||
|
||||
print $"✅ Updated ($secret) with: ($vars | columns | str join ', ')"
|
||||
print $"npub: ($npub)"
|
||||
print "Next:"
|
||||
print $" 1. On hl-minipc1: sudo buzz-manage add-member ($npub)"
|
||||
if $restricted and not $gated {
|
||||
print "⚠️ --restricted with no BUZZ_ALLOWED_USERS: the bot will ignore everyone. Re-run with --rotate --allowed-users <npub,...> or edit the secret."
|
||||
}
|
||||
}
|
||||
+1
-59
@@ -5,6 +5,7 @@ export use remote.nu *
|
||||
export use os.nu *
|
||||
export use secrets.nu *
|
||||
export use ca.nu *
|
||||
export use buzz.nu *
|
||||
export use pkgs.nu *
|
||||
export use flake.nu *
|
||||
export use build.nu *
|
||||
@@ -29,62 +30,3 @@ export def "skyg profiles" [only_remote: bool = false] {
|
||||
valid_profiles | print
|
||||
}
|
||||
}
|
||||
|
||||
# --- Deprecated aliases (backward compatibility) ---
|
||||
|
||||
export def "skyg decrypt" [secret: string@secret-names] {
|
||||
print $"(ansi yellow)Deprecated: use `skyg secrets show` instead(ansi reset)"
|
||||
skyg secrets show $secret
|
||||
}
|
||||
|
||||
export def "skyg encrypt" [
|
||||
secret: string@secret-names,
|
||||
source?: string,
|
||||
--yaml
|
||||
] {
|
||||
print $"(ansi yellow)Deprecated: use `skyg secrets edit` instead(ansi reset)"
|
||||
skyg secrets edit $secret $source --yaml=$yaml
|
||||
}
|
||||
|
||||
export def "skyg compare-secret" [secret: string@secret-names] {
|
||||
print $"(ansi yellow)Deprecated: use `skyg secrets compare` instead(ansi reset)"
|
||||
skyg secrets compare $secret
|
||||
}
|
||||
|
||||
export def "skyg secrets" [] {
|
||||
print $"(ansi yellow)Deprecated: use `skyg secrets list` instead(ansi reset)"
|
||||
skyg secrets list
|
||||
}
|
||||
|
||||
export def "skyg rollback" [] {
|
||||
print $"(ansi yellow)Deprecated: use `skyg os rollback` instead(ansi reset)"
|
||||
skyg os rollback
|
||||
}
|
||||
|
||||
export def "skyg update" [input_name?: string] {
|
||||
print $"(ansi yellow)Deprecated: use `skyg flake update` instead(ansi reset)"
|
||||
skyg flake update $input_name
|
||||
}
|
||||
|
||||
export def "skyg check" [] {
|
||||
print $"(ansi yellow)Deprecated: use `skyg flake check` instead(ansi reset)"
|
||||
skyg flake check
|
||||
}
|
||||
|
||||
export def "skyg check-flake-versions" [] {
|
||||
print $"(ansi yellow)Deprecated: use `skyg flake check-versions` instead(ansi reset)"
|
||||
skyg flake check-versions
|
||||
}
|
||||
|
||||
export def "skyg build-image" [target: string] {
|
||||
print $"(ansi yellow)Deprecated: use `skyg build image` instead(ansi reset)"
|
||||
skyg build image $target
|
||||
}
|
||||
|
||||
export def "skyg openwrt" [
|
||||
router?: string,
|
||||
--dry-run
|
||||
] {
|
||||
print $"(ansi yellow)Deprecated: use `skyg build openwrt` instead(ansi reset)"
|
||||
skyg build openwrt $router --dry-run=$dry_run
|
||||
}
|
||||
+73
-14
@@ -1,7 +1,10 @@
|
||||
use profile.nu *
|
||||
use helpers.nu [REPO_ROOT]
|
||||
|
||||
const NIC_SCRIPT = path self | path dirname | path join "net-nic.sh"
|
||||
const SSH_OPTS = ["-o" "BatchMode=yes" "-o" "ConnectTimeout=5" "-o" "StrictHostKeyChecking=accept-new"]
|
||||
const CHECKS_DIR = $REPO_ROOT | path join ".tmp" "net-checks"
|
||||
const SERVER_CACHE = $CHECKS_DIR | path join "server.nuon"
|
||||
|
||||
def local-hostname [] {
|
||||
^cat /proc/sys/kernel/hostname | str trim
|
||||
@@ -63,13 +66,55 @@ def probe-nic [device: string] {
|
||||
| reduce --fold {} {|it, acc| $acc | upsert $it.key ($it.value | str trim) }
|
||||
}
|
||||
|
||||
# Closest speedtest.net server to this machine, as {id, rest}, or null.
|
||||
def closest-server [] {
|
||||
# Nearby speedtest.net servers as [{id, rest}], closest first.
|
||||
def list-servers [] {
|
||||
let r = (^bash -c "nix-shell -p speedtest-go --run 'speedtest-go --list'" | complete)
|
||||
$r.stdout
|
||||
| lines
|
||||
| parse --regex '^\[(?P<id>\d+)\]\s+(?P<rest>.*)$'
|
||||
| get 0?
|
||||
}
|
||||
|
||||
def save-server [s: record] {
|
||||
mkdir $CHECKS_DIR
|
||||
$s | save --force $SERVER_CACHE
|
||||
}
|
||||
|
||||
# Server id to use for all devices: the saved one (asks if you want to change it),
|
||||
# or the closest one on first run. Returns "" if none could be found.
|
||||
def pick-server [] {
|
||||
# ^cat, not open: open may be aliased (e.g. to xdg-open) in the user's config.
|
||||
let saved = if ($SERVER_CACHE | path exists) { try { ^cat $SERVER_CACHE | from nuon } catch { null } } else { null }
|
||||
|
||||
if $saved == null {
|
||||
print "Finding the closest speedtest server (shared by all devices)..."
|
||||
let s = (list-servers | get 0?)
|
||||
if $s == null {
|
||||
print $"(ansi yellow)Could not list servers; each device will pick its own.(ansi reset)"
|
||||
return ""
|
||||
}
|
||||
save-server $s
|
||||
print $"Using server ($s.id): ($s.rest) \(saved to ($SERVER_CACHE)\)"
|
||||
return $s.id
|
||||
}
|
||||
|
||||
print $"Saved server ($saved.id): ($saved.rest)"
|
||||
let ans = (input "Change server? [y/N] " | str trim | str downcase)
|
||||
if $ans not-in ["y" "yes"] { return $saved.id }
|
||||
|
||||
print "Listing speedtest servers..."
|
||||
let servers = (list-servers)
|
||||
if ($servers | is-empty) {
|
||||
print $"(ansi yellow)Could not list servers; keeping saved server.(ansi reset)"
|
||||
return $saved.id
|
||||
}
|
||||
let s = ($servers | input list --fuzzy --display {|x| $"[($x.id)] ($x.rest)" } "Pick a server (closest first)")
|
||||
if $s == null {
|
||||
print "No server picked; keeping saved server."
|
||||
return $saved.id
|
||||
}
|
||||
save-server $s
|
||||
print $"Using server ($s.id): ($s.rest)"
|
||||
$s.id
|
||||
}
|
||||
|
||||
# Run speedtest-go on a device. Assumes dl_speed/ul_speed are bytes/s and latency is ns.
|
||||
@@ -106,6 +151,7 @@ export def "skyg net check" [
|
||||
device?: string@net-targets, # Only check this device (default: all devices)
|
||||
--server: string = "", # speedtest.net server id (default: closest to this machine)
|
||||
--no-speedtest, # Only report network card details
|
||||
--save: path, # Also save the table here (format from extension: .csv, .json, .nuon, .md, ...)
|
||||
] {
|
||||
let all = (net-targets)
|
||||
let devices = if $device == null { $all } else {
|
||||
@@ -115,17 +161,7 @@ export def "skyg net check" [
|
||||
[$device]
|
||||
}
|
||||
|
||||
mut server_id = $server
|
||||
if (not $no_speedtest) and $server_id == "" {
|
||||
print "Finding the closest speedtest server (shared by all devices)..."
|
||||
let s = (closest-server)
|
||||
if $s == null {
|
||||
print $"(ansi yellow)Could not list servers; each device will pick its own.(ansi reset)"
|
||||
} else {
|
||||
$server_id = $s.id
|
||||
print $"Using server ($s.id): ($s.rest)"
|
||||
}
|
||||
}
|
||||
let server_id = if (not $no_speedtest) and $server == "" { pick-server } else { $server }
|
||||
|
||||
let total = ($devices | length)
|
||||
mut rows = []
|
||||
@@ -173,5 +209,28 @@ export def "skyg net check" [
|
||||
}
|
||||
|
||||
print $"Done: checked ($total) device\(s\)."
|
||||
|
||||
mkdir $CHECKS_DIR
|
||||
let auto_file = ($CHECKS_DIR | path join $"(date now | format date '%Y.%m.%d_%H_%M_%S').nuon")
|
||||
$rows | save --force $auto_file
|
||||
print $"Saved to ($auto_file)"
|
||||
if $save != null {
|
||||
$rows | save --force $save
|
||||
print $"Saved to ($save | path expand)"
|
||||
}
|
||||
print $"Show the last table again with: (ansi green_bold)skyg net last(ansi reset)"
|
||||
|
||||
$rows
|
||||
}
|
||||
|
||||
# Show the table from the most recent `skyg net check` run.
|
||||
export def "skyg net last" [] {
|
||||
# glob and ^cat, not ls/open: they may be aliased (e.g. to eza/xdg-open) in the user's config.
|
||||
let files = (glob ($CHECKS_DIR | path join "*.nuon") | where {|f| $f != $SERVER_CACHE })
|
||||
if ($files | is-empty) {
|
||||
error make {msg: $"No saved net checks in ($CHECKS_DIR). Run `skyg net check` first."}
|
||||
}
|
||||
let latest = ($files | sort | last)
|
||||
print $"From ($latest)"
|
||||
^cat $latest | from nuon
|
||||
}
|
||||
+38
-14
@@ -140,7 +140,7 @@ Starting parallel boots (concurrency: 2)..."
|
||||
let boot_results = ($online_hosts | par-each --threads 1 { |host|
|
||||
let target_host = $"root@($host).lab.internal"
|
||||
let profile = $"hl-($host)"
|
||||
let runcmd = $"nh os boot --target-host ($target_host) .#($profile)"
|
||||
let runcmd = $"nh os boot --no-nom --target-host ($target_host) .#($profile)"
|
||||
print $runcmd
|
||||
let ok = (try {
|
||||
bash -c $runcmd
|
||||
@@ -212,9 +212,15 @@ export def "skyg remote status-all" [] {
|
||||
# Print each host's status as one block, as soon as it finishes.
|
||||
let booted = (if ($info.booted | is-empty) { "-" } else { $info.booted | path basename })
|
||||
let current = (if ($info.current | is-empty) { "-" } else { $info.current | path basename })
|
||||
let next_boot = (if ($info.next_boot | is-empty) { "-" } else { $info.next_boot | path basename })
|
||||
let reboot_line = if $info.reboot_pending { $"(ansi yellow)REBOOT PENDING(ansi reset)\n" } else { "" }
|
||||
let build_line = if $info.needs_build { $"(ansi red)NEEDS NEW BUILD(ansi reset)" } else { $"(ansi green)UP TO DATE(ansi reset)" }
|
||||
print $"($host) | Booted: ($booted) | Current: ($current)"
|
||||
# needs_build is true, false, or "unknown" (local eval failed)
|
||||
let build_line = match $info.needs_build {
|
||||
true => $"(ansi red)NEEDS NEW BUILD(ansi reset)",
|
||||
false => $"(ansi green)UP TO DATE(ansi reset)",
|
||||
_ => $"(ansi yellow)BUILD UNKNOWN (eval failed)(ansi reset)",
|
||||
}
|
||||
print $"($host) | Booted: ($booted) | Current: ($current) | Next boot: ($next_boot)\n ($reboot_line)($build_line)"
|
||||
|
||||
$info
|
||||
})
|
||||
@@ -222,7 +228,7 @@ export def "skyg remote status-all" [] {
|
||||
return ($results | select host status reboot_pending needs_build)
|
||||
}
|
||||
|
||||
# Reboot every remote host that is pending a reboot (booted-system != current-system).
|
||||
# Reboot every remote host that is pending a reboot (booted-system != next-boot generation).
|
||||
# Detects pending hosts, lists them, asks for confirmation, then reboots each one at a
|
||||
# time, waiting for it to come back online and sending a desktop notification when it does.
|
||||
export def "skyg remote reboot-pending" [] {
|
||||
@@ -253,15 +259,14 @@ export def "skyg remote reboot-pending" [] {
|
||||
}
|
||||
|
||||
let info = (try {
|
||||
let booted = bash -c $"ssh -o BatchMode=yes ($target) 'readlink /run/booted-system' 2>/dev/null" | str trim
|
||||
let current = bash -c $"ssh -o BatchMode=yes ($target) 'readlink /run/current-system' 2>/dev/null" | str trim
|
||||
{booted: $booted, current: $current, pending: ($booted != $current)}
|
||||
let s = (get-boot-state $target)
|
||||
{booted: $s.booted, next_boot: $s.next_boot, pending: ($s.booted != "" and $s.booted != $s.next_boot)}
|
||||
} catch {
|
||||
{booted: "", current: "", pending: false}
|
||||
{booted: "", next_boot: "", pending: false}
|
||||
})
|
||||
|
||||
if $info.pending {
|
||||
print $"(ansi blue)REBOOT PENDING(ansi reset): ($host) booted=($info.booted | path basename) current=($info.current | path basename)"
|
||||
print $"(ansi blue)REBOOT PENDING(ansi reset): ($host) booted=($info.booted | path basename) next=($info.next_boot | path basename)"
|
||||
$pending = ($pending | append $host)
|
||||
} else {
|
||||
print $"(ansi green)UP TO DATE(ansi reset): ($host)"
|
||||
@@ -320,12 +325,31 @@ export def "skyg remote reboot-pending" [] {
|
||||
let boot_id_after = (try {
|
||||
bash -c $"ssh -o BatchMode=yes ($target) 'cat /proc/sys/kernel/random/boot_id' 2>/dev/null" | str trim
|
||||
} catch { "" })
|
||||
let confirmed = ($boot_id_before != "" and $boot_id_after != "" and $boot_id_before != $boot_id_after)
|
||||
if $confirmed {
|
||||
print $"(ansi green)($host) is back online (reboot confirmed)(ansi reset)"
|
||||
# Proof of reboot: boot id changed. If we can't read it, fall back to "it went offline".
|
||||
let did_reboot = if $boot_id_before != "" and $boot_id_after != "" {
|
||||
$boot_id_before != $boot_id_after
|
||||
} else {
|
||||
print $"(ansi green)($host) is back online(ansi reset)"
|
||||
$went_down
|
||||
}
|
||||
if not $did_reboot {
|
||||
print $"(ansi red)($host) answered but did NOT reboot (same boot id, never went offline)(ansi reset)"
|
||||
notify $"❌ ($host) did not reboot" "Reboot command had no effect"
|
||||
$failed = ($failed | append $host)
|
||||
continue
|
||||
}
|
||||
|
||||
# Check the host really came up on the generation we wanted.
|
||||
let after = (try { get-boot-state $target } catch { null })
|
||||
if $after != null and $after.booted != $after.next_boot {
|
||||
print $"(ansi red)($host) rebooted but is NOT on its latest generation(ansi reset)"
|
||||
print $" booted=($after.booted | path basename)"
|
||||
print $" wanted=($after.next_boot | path basename)"
|
||||
notify $"⚠️ ($host) wrong generation" "Rebooted but not on the latest generation"
|
||||
$failed = ($failed | append $host)
|
||||
continue
|
||||
}
|
||||
|
||||
print $"(ansi green)($host) rebooted and is back online(ansi reset)"
|
||||
notify $"✅ ($host) rebooted" "Back online and reachable"
|
||||
$rebooted = ($rebooted | append $host)
|
||||
} else {
|
||||
@@ -342,7 +366,7 @@ export def "skyg remote reboot-pending" [] {
|
||||
Total hosts considered: ($all_hosts | length)
|
||||
Pending reboot: ($pending | length) - ($pending | str join ', ')
|
||||
Rebooted: ($rebooted | length) - ($rebooted | str join ', ')
|
||||
Failed to return: ($failed | length) - ($failed | str join ', ')
|
||||
Failed: ($failed | length) - ($failed | str join ', ')
|
||||
Offline: ($offline | length) - ($offline | str join ', ')
|
||||
Up to date: ($up_to_date | length) - ($up_to_date | str join ', ')
|
||||
"
|
||||
|
||||
+26
-10
@@ -1,6 +1,19 @@
|
||||
use types.nu *
|
||||
use profile.nu *
|
||||
|
||||
# Read the 3 system paths on a remote host:
|
||||
# booted = what it booted from
|
||||
# current = what is running now (changed by switch/test)
|
||||
# next_boot = what the next reboot will use (changed by switch/boot)
|
||||
export def get-boot-state [target: string] {
|
||||
let lines = (bash -c $"ssh -o BatchMode=yes ($target) 'readlink /run/booted-system; readlink /run/current-system; readlink -f /nix/var/nix/profiles/system' 2>/dev/null" | lines)
|
||||
let booted = ($lines | get 0? | default "")
|
||||
let current = ($lines | get 1? | default "")
|
||||
let profile = ($lines | get 2? | default "")
|
||||
let next_boot = if $profile == "" { $current } else { $profile }
|
||||
{booted: $booted, current: $current, next_boot: $next_boot}
|
||||
}
|
||||
|
||||
export def get-remote-boot-info [ host: string@remote_targets ] {
|
||||
let target = $"root@($host).lab.internal"
|
||||
let is_online = (try {
|
||||
@@ -8,13 +21,13 @@ export def get-remote-boot-info [ host: string@remote_targets ] {
|
||||
true
|
||||
} catch { false })
|
||||
if (not $is_online) {
|
||||
return {host: $host, status: "offline", booted: "", current: "", reboot_pending: false, needs_build: false, local_toplevel: ""}
|
||||
return {host: $host, status: "offline", booted: "", current: "", next_boot: "", reboot_pending: false, needs_build: false, local_toplevel: ""}
|
||||
}
|
||||
return (try {
|
||||
# Fetch remote system paths and the local toplevel concurrently.
|
||||
let fetched = (["remote" "local"] | par-each {|what|
|
||||
if $what == "remote" {
|
||||
bash -c $"ssh ($target) 'readlink /run/booted-system; readlink /run/current-system' 2>/dev/null" | lines
|
||||
get-boot-state $target
|
||||
} else {
|
||||
try {
|
||||
bash -c $"nix eval --raw '.#nixosConfigurations.hl-($host).config.system.build.toplevel.outPath' 2>/dev/null || true" | str trim
|
||||
@@ -22,22 +35,25 @@ export def get-remote-boot-info [ host: string@remote_targets ] {
|
||||
}
|
||||
})
|
||||
|
||||
let booted = ($fetched.0 | get 0? | default "")
|
||||
let current = ($fetched.0 | get 1? | default "")
|
||||
let state = $fetched.0
|
||||
let booted = $state.booted
|
||||
let current = $state.current
|
||||
let next_boot = $state.next_boot
|
||||
let local_toplevel = $fetched.1
|
||||
|
||||
let reboot_pending = ($booted != $current)
|
||||
let needs_build = if $local_toplevel == "" { "unknown" } else { $local_toplevel != $current }
|
||||
# A reboot only matters if it would land on a different system than we booted.
|
||||
let reboot_pending = ($booted != "" and $booted != $next_boot)
|
||||
let needs_build = if $local_toplevel == "" { "unknown" } else { $local_toplevel != $next_boot }
|
||||
|
||||
{host: $host, status: "online", booted: $booted, current: $current, reboot_pending: $reboot_pending, needs_build: $needs_build, local_toplevel: $local_toplevel}
|
||||
{host: $host, status: "online", booted: $booted, current: $current, next_boot: $next_boot, reboot_pending: $reboot_pending, needs_build: $needs_build, local_toplevel: $local_toplevel}
|
||||
} catch {
|
||||
{host: $host, status: "error", booted: "", current: "", reboot_pending: false, needs_build: false, local_toplevel: ""}
|
||||
{host: $host, status: "error", booted: "", current: "", next_boot: "", reboot_pending: false, needs_build: false, local_toplevel: ""}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
# Poll SSH until the host reaches the desired reachability, or the timeout elapses.
|
||||
def wait-for-host [target: string, want_online: bool, timeout: int] {
|
||||
export def wait-for-host [target: string, want_online: bool, timeout: int] {
|
||||
let deadline = (date now) + ($timeout * 1sec)
|
||||
while (date now) < $deadline {
|
||||
let online = (try {
|
||||
@@ -53,7 +69,7 @@ def wait-for-host [target: string, want_online: bool, timeout: int] {
|
||||
}
|
||||
|
||||
# Send a desktop notification if notify-send is available; never fail the caller.
|
||||
def notify [title: string, body: string] {
|
||||
export def notify [title: string, body: string] {
|
||||
try {
|
||||
^notify-send $title $body
|
||||
} catch { }
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
use types.nu *
|
||||
use helpers.nu *
|
||||
|
||||
# List all secret names (same as `skyg secrets list`)
|
||||
export def "skyg secrets" [] {
|
||||
skyg secrets list
|
||||
}
|
||||
|
||||
# List all secret names
|
||||
export def "skyg secrets list" [] {
|
||||
secret-names
|
||||
|
||||
+5
-4
@@ -23,10 +23,11 @@ these cases where the source subdir and `~/.config` target differ.
|
||||
| `hl-fws1/hypr/` | Hyprland config for `hl-fws1` (remote slim desktop); **baked into the build** via `mountAsSource`, linked to `~/.config/hypr` |
|
||||
| `hl-pi1/quickshell/` | Quickshell configs for `hl-pi1` (full-screen clock + calendar); linked to `~/.config/quickshell` |
|
||||
| `fwbook/quickshell/` | Quickshell configs for `fwbook` (scrolling overview); linked to `~/.config/quickshell` |
|
||||
| `extra.nu` | Extra NuShell config sourced at shell startup |
|
||||
| `fwbook.knsv` | fwbook-specific Kanshi display profile |
|
||||
| `hypr-types/hl.lua` | Shared EmmyLua type stubs for the `hl` global; each host's Hyprland `.luarc.json` points here via `workspace.library` |
|
||||
| `pki/` | Public certs of the lab internal CA (`lab-ca.crt` + issued leaves), managed by `skyg ca`; **not** symlinked to `~/.config` — see `pki/ABOUTME.md` |
|
||||
|
||||
| `extra.nu` | Extra NuShell config sourced at shell startup |
|
||||
| `fwbook.knsv` | fwbook-specific Kanshi display profile |
|
||||
| `hypr-types/hl.lua` | Shared EmmyLua type stubs for the `hl` global; each host's Hyprland `.luarc.json` points here via `workspace.library` |
|
||||
| `pki/` | Public certs of the lab internal CA (`lab-ca.crt` + issued leaves), managed by `skyg ca`; **not** symlinked to `~/.config` — see `pki/ABOUTME.md` |
|
||||
|
||||
## Notes
|
||||
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
-- Autostart
|
||||
-- =========================
|
||||
local function autostart()
|
||||
-- hl.exec_cmd("setpriv --ambient-caps -all -- noctalia")
|
||||
hl.exec_cmd("setpriv --ambient-caps -all -- omarchy-launch-shell")
|
||||
hl.exec_cmd("setpriv --ambient-caps -all -- qs -c overview")
|
||||
hl.exec_cmd("setpriv --ambient-caps -all -- noctalia")
|
||||
-- hl.exec_cmd("setpriv --ambient-caps -all -- omarchy-launch-shell")
|
||||
-- hl.exec_cmd("setpriv --ambient-caps -all -- qs -c overview")
|
||||
hl.exec_cmd("setpriv --ambient-caps -all -- skygqts workspace-manager")
|
||||
hl.exec_cmd("setpriv --ambient-caps -all -- skygqts workspace-badge")
|
||||
end
|
||||
hl.on("hyprland.start", autostart)
|
||||
hl.bind("SUPER + SHIFT + A", autostart)
|
||||
@@ -12,7 +12,7 @@ hl.bind(mod .. " + B", hl.dsp.exec_cmd("chromium"))
|
||||
hl.bind(mod .. " + E", hl.dsp.exec_cmd("wofi-emoji"))
|
||||
hl.bind(mod .. " + ALT + E", hl.dsp.exec_cmd("zeditor ~/.config/hypr/conf/keybindings.lua"))
|
||||
hl.bind(mod .. " + Q", hl.dsp.window.close())
|
||||
hl.bind(mod .. " + ALT + N", hl.dsp.exec_cmd("skygqts workspace-manager toggle"))
|
||||
hl.bind(mod .. " + ALT + N", hl.dsp.exec_cmd("skygqts workspace-badge edit"))
|
||||
-- =========================
|
||||
-- Navigation
|
||||
-- =========================
|
||||
@@ -22,7 +22,9 @@ hl.bind(mod .. " + up", hl.dsp.focus({ workspace = "e-1" }))
|
||||
hl.bind(mod .. " + down", hl.dsp.focus({ workspace = "e+1" }))
|
||||
|
||||
-- for the 4-finger swipe equivalent)
|
||||
hl.bind(mod .. " + Tab", hl.dsp.exec_cmd("qs -c overview ipc call overview toggle"))
|
||||
-- hl.bind(mod .. " + Tab", hl.dsp.exec_cmd("qs -c overview ipc call overview toggle"))
|
||||
hl.bind(mod .. " + Tab", hl.dsp.exec_cmd("skygqts workspace-manager toggle"))
|
||||
--
|
||||
hl.bind(mod .. " + SHIFT + Tab", hl.dsp.focus({ monitor = "+1" }))
|
||||
|
||||
-- =========================
|
||||
|
||||
@@ -10,5 +10,5 @@ require("conf/inputs")
|
||||
require("conf/window-rules")
|
||||
require("conf/keybindings")
|
||||
require("conf/autostart")
|
||||
require("conf.omarchy.index")
|
||||
-- require("conf.noctalia.index")
|
||||
-- require("conf.omarchy.index")
|
||||
require("conf.noctalia.index")
|
||||
@@ -15,7 +15,7 @@ binds {
|
||||
Mod+E { spawn "wofi-emoji"; }
|
||||
Mod+Alt+E { spawn-sh "zeditor ~/.config/niri/shared/binds.kdl"; }
|
||||
Mod+Q { close-window; }
|
||||
Mod+Alt+N hotkey-overlay-title="Workspace: Rename" { spawn "skygqts" "workspace-manager" "rename"; }
|
||||
Mod+Alt+N hotkey-overlay-title="Workspace: Rename" { spawn "skygqts" "workspace-badge" "edit"; }
|
||||
|
||||
|
||||
// =========================
|
||||
@@ -26,7 +26,7 @@ binds {
|
||||
Mod+Up { focus-workspace-up; }
|
||||
Mod+Right { focus-column-right; }
|
||||
|
||||
Mod+Tab hotkey-overlay-title="Workspace: Rename" { spawn "skygqts" "workspace-manager" "windows"; }
|
||||
Mod+Ctrl+Tab hotkey-overlay-title="Workspace: Cycle" { spawn "skygqts" "workspace-manager" "toggle"; }
|
||||
Mod+Shift+Tab { focus-monitor-next; }
|
||||
|
||||
// =========================
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
|
||||
|
||||
skygqts workspace-manager &
|
||||
skygqts workspace-badge &
|
||||
|
||||
notify-send "Autostarted ran!"
|
||||
@@ -8,6 +8,7 @@ local mod = "SUPER"
|
||||
-- =========================
|
||||
hl.bind(mod .. " + T", hl.dsp.exec_cmd("ghostty"))
|
||||
hl.bind(mod .. " + Q", hl.dsp.window.close())
|
||||
hl.bind(mod .. " + Space", hl.dsp.exec_cmd("noctalia msg panel-toggle launcher"))
|
||||
|
||||
-- =========================
|
||||
-- Navigation
|
||||
|
||||
Generated
+307
-278
File diff suppressed because it is too large.
Load diff
@@ -4,6 +4,19 @@
|
||||
skygqts.url = "git+ssh://gitea@gitea.app.internal:22/ari/skygqts.git";
|
||||
skygqts.inputs.nixpkgs.follows = "nixpkgs";
|
||||
hermenix.url = "git+ssh://gitea@gitea.app.internal:22/ari/hermenix.git";
|
||||
nbot = {
|
||||
url = "git+ssh://git@github.com/SkyG-Org/nBot.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
};
|
||||
looprail = {
|
||||
url = "git+ssh://git@github.com/SkyG-Org/LoopRail.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
};
|
||||
# Read-only host monitor (systemd, journal, Docker) over REST + MCP.
|
||||
skyg-linux-tracker = {
|
||||
url = "git+https://gitea.skyg.ca/ari/skyg-linux-tracker.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# Headless Hyprland session streamed over a Unix socket.
|
||||
hhstream = {
|
||||
url = "git+ssh://gitea@gitea.app.internal:22/Hermenix/hyprland-headless-stream-plugin.git";
|
||||
@@ -21,6 +34,8 @@
|
||||
determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/*";
|
||||
determinate.inputs.nixpkgs.follows = "nixpkgs";
|
||||
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0";
|
||||
# Slack 4.53.287, NixOS/nixpkgs#557737.
|
||||
nixpkgs-slack.url = "github:NixOS/nixpkgs/713bc1926b25ad17376e552e339faeea73cf86dc";
|
||||
nixpkgs-unstable.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
|
||||
# my fork of nixpkgs
|
||||
my-nixpkgs.url = "github:asosnovsky/nixpkgs/ds4-init";
|
||||
@@ -76,19 +91,17 @@
|
||||
};
|
||||
# Hyprland
|
||||
hyprlauncher.url = "github:hyprwm/hyprlauncher";
|
||||
# Hyprland compositor via flake (latest git).
|
||||
hyprland.url = "github:hyprwm/Hyprland";
|
||||
# Hyprland compositor via flake — pinned to the latest stable release tag
|
||||
# (was floating on main, 50 commits past v0.57.0, which caused a
|
||||
# compositor render-spin episode on fwbook: ~4-core spin, 100°C, no
|
||||
# suspend requested). Re-lock with: nix flake lock --update-input hyprland
|
||||
hyprland.url = "github:hyprwm/Hyprland/v0.57.0";
|
||||
|
||||
# Secrets management
|
||||
agenix.url = "github:ryantm/agenix";
|
||||
|
||||
# Tether — iPhone ↔ Linux Wayland bridge
|
||||
tether = {
|
||||
url = "github:zackb/tether";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
herdr.url = "github:herdrdev/herdr";
|
||||
ai-usagebar.url = "github:akitaonrails/ai-usagebar";
|
||||
# Declarative disk partitioning (for nixos-anywhere installs)
|
||||
disko = {
|
||||
url = "github:nix-community/disko";
|
||||
@@ -104,8 +117,12 @@
|
||||
{ self
|
||||
, skygqts
|
||||
, hermenix
|
||||
, skyg-linux-tracker
|
||||
, nbot
|
||||
, looprail
|
||||
, hhstream
|
||||
, nixpkgs-unstable
|
||||
, nixpkgs-slack
|
||||
, flox
|
||||
, determinate
|
||||
, nixos-hardware
|
||||
@@ -126,10 +143,8 @@
|
||||
, nix-index-database
|
||||
, agenix
|
||||
, hermes-agent
|
||||
, tether
|
||||
, herdr
|
||||
, disko
|
||||
, ai-usagebar
|
||||
, buildbot-nix
|
||||
}:
|
||||
let
|
||||
@@ -174,11 +189,26 @@
|
||||
buildbot-gitea-webhook-secret = ./secrets/buildbot-gitea-webhook-secret.age;
|
||||
buildbot-gitea-oauth-secret = ./secrets/buildbot-gitea-oauth-secret.age;
|
||||
immich-shared = ./secrets/immich-shared.age;
|
||||
grafana-secret-key = ./secrets/grafana-secret-key.age;
|
||||
umami-app-secret = ./secrets/umami-app-secret.age;
|
||||
linux-tracker-peer-minipc1 = ./secrets/linux-tracker-peer-minipc1.age;
|
||||
linux-tracker-peer-minipc2 = ./secrets/linux-tracker-peer-minipc2.age;
|
||||
linux-tracker-peer-minipc3 = ./secrets/linux-tracker-peer-minipc3.age;
|
||||
linux-tracker-peer-bigbox1 = ./secrets/linux-tracker-peer-bigbox1.age;
|
||||
linux-tracker-peer-bigbox2 = ./secrets/linux-tracker-peer-bigbox2.age;
|
||||
linux-tracker-peer-terra1 = ./secrets/linux-tracker-peer-terra1.age;
|
||||
scrypted-envs = ./secrets/scrypted-envs.age;
|
||||
nbot-slack = ./secrets/nbot-slack.age;
|
||||
nbot-goose = ./secrets/nbot-goose.age;
|
||||
nbot-cluster = ./secrets/nbot-cluster.age;
|
||||
nbot-cluster-hl-fws1 = ./secrets/nbot-cluster-hl-fws1.age;
|
||||
github-runner-token-fws1 = ./secrets/github-runner-token-fws1.age;
|
||||
};
|
||||
inherit
|
||||
hyprlauncher
|
||||
hyprland
|
||||
nixpkgs-unstable
|
||||
nixpkgs-slack
|
||||
my-nixpkgs
|
||||
dms
|
||||
dank-greeter
|
||||
@@ -188,12 +218,13 @@
|
||||
hermes-agent
|
||||
skygqts
|
||||
hermenix
|
||||
skyg-linux-tracker
|
||||
nbot
|
||||
looprail
|
||||
hhstream
|
||||
flox
|
||||
determinate
|
||||
tether
|
||||
herdr
|
||||
ai-usagebar
|
||||
;
|
||||
};
|
||||
}
|
||||
@@ -212,11 +243,40 @@
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
qtDocs = pkgs.qt6.qtdoc;
|
||||
# Hook: run skyg pkgs update --all at most once a week; fail if it bumped
|
||||
# anything under pkgs/ so bumps get reviewed and staged, never auto-committed.
|
||||
pkgs-update-script = pkgs.writeShellScriptBin "skyg-pkgs-update" ''
|
||||
set -euo pipefail
|
||||
export PATH=${pkgs.bash}/bin:${pkgs.coreutils}/bin:${pkgs.curl}/bin:${pkgs.jq}/bin:${pkgs.git}/bin:${pkgs.gnused}/bin:${pkgs.gawk}/bin:$PATH
|
||||
root=$(${pkgs.git}/bin/git rev-parse --show-toplevel)
|
||||
cd "$root"
|
||||
stamp=$(${pkgs.git}/bin/git rev-parse --git-path pkgs-update-last-success)
|
||||
now=$(date +%s)
|
||||
last_run=$(date -r "$stamp" +%s 2>/dev/null || echo 0)
|
||||
if (( now - last_run < 604800 )); then
|
||||
exit 0
|
||||
fi
|
||||
${pkgs.nushell}/bin/nu --commands 'use ./bin/lib/cmds.nu *; skyg pkgs update --all'
|
||||
touch "$stamp"
|
||||
if ! ${pkgs.git}/bin/git diff --quiet -- pkgs/; then
|
||||
echo ""
|
||||
echo "pkgs-update: version bumps applied under pkgs/ — review 'git diff pkgs/',"
|
||||
echo "stage them ('git add pkgs/') and commit again."
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
pre-commit-check = git-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
nixpkgs-fmt.enable = true;
|
||||
stylua.enable = true;
|
||||
pkgs-update = {
|
||||
enable = true;
|
||||
entry = "${pkgs-update-script}/bin/skyg-pkgs-update";
|
||||
language = "system";
|
||||
pass_filenames = false;
|
||||
always_run = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
@@ -236,6 +296,7 @@
|
||||
agenix.packages.${system}.default
|
||||
age
|
||||
yq
|
||||
nak
|
||||
home-manager.packages.${system}.home-manager
|
||||
rustc
|
||||
cargo
|
||||
@@ -294,9 +355,9 @@
|
||||
skyg-dns-records = dnsRecordsFile;
|
||||
ds4 = my-nixpkgs.legacyPackages.${system}.ds4;
|
||||
buzz-desktop = lib.pkgs.${system}.buzz-desktop;
|
||||
superset-desktop = lib.pkgs.${system}.superset-desktop;
|
||||
delta-editor = lib.pkgs.${system}.delta-editor;
|
||||
colibri = lib.pkgs.${system}.colibri;
|
||||
llama-cpp-halo = lib.pkgs.${system}.llama-cpp-halo;
|
||||
herdr = herdr.packages.${system}.default;
|
||||
}
|
||||
);
|
||||
@@ -326,6 +387,7 @@
|
||||
./hosts/hl-fws1.disko.nix
|
||||
nixos-hardware.nixosModules.framework-11th-gen-intel
|
||||
disko.nixosModules.disko
|
||||
nbot.nixosModules.host
|
||||
];
|
||||
};
|
||||
hl-fwdesk = lib.makeNixOs {
|
||||
@@ -336,6 +398,7 @@
|
||||
nixos-hardware.nixosModules.framework-desktop-amd-ai-max-300-series
|
||||
hermenix.nixosModules.default
|
||||
buildbot-nix.nixosModules.buildbot-worker
|
||||
nbot.nixosModules.host
|
||||
];
|
||||
};
|
||||
hl-bigbox1 = lib.makeNixOs {
|
||||
|
||||
+6
-6
@@ -31,13 +31,13 @@ hosts/
|
||||
| Folder | Host | Role |
|
||||
| ------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `fwbook/` | fwbook | Framework 13 AMD — personal laptop / daily driver |
|
||||
| `hl-fwdesk/` | hl-fwdesk | Framework Desktop AI Max 300 — AI workstation; buildbot-nix CI worker (4 cores) |
|
||||
| `hl-fws1/` | hl-fws1 | Framework 11th Intel — K3s server node |
|
||||
| `hl-bigbox1/` | hl-bigbox1 | AI/compute server (NVIDIA + AMD); Immich machine-learning (CUDA) |
|
||||
| `hl-fwdesk/` | hl-fwdesk | Framework Desktop AI Max 300 — AI workstation; buildbot-nix CI worker (4 cores); nbot master |
|
||||
| `hl-fws1/` | hl-fws1 | Framework 11th Intel — K3s server node; nbot worker |
|
||||
| `hl-bigbox1/` | hl-bigbox1 | AI/compute server (NVIDIA + AMD); Immich machine-learning (CUDA); CPU idle capped at C1 (`processor.max_cstate=1`) against Ryzen idle freezes |
|
||||
| `hl-bigbox2/` | hl-bigbox2 | NFS storage server; Immich server/db (docker, `immich.home.sosnovsky.ca`) |
|
||||
| `hl-minipc1/` | hl-minipc1 | Core infra: Gitea (native or containerized), nix-serve, registry, Buzz (docker, `buzz-manage` CLI) |
|
||||
| `hl-minipc2/` | hl-minipc2 | Container/media server |
|
||||
| `hl-minipc3/` | hl-minipc3 | K3s worker node; central Caddy reverse-proxy (`*.home.sosnovsky.ca`, plus `gitea.skyg.ca` HTTP/SSH); buildbot-nix CI master + worker (2 cores) |
|
||||
| `hl-minipc1/` | hl-minipc1 | Core infra: Gitea (native or containerized), nix-serve, registry, Buzz (docker, `buzz-manage` CLI), monitoring (Grafana, Prometheus, Loki, OTel collector) |
|
||||
| `hl-minipc2/` | hl-minipc2 | Container/media server; Umami for LoopRail telemetry (own nspawn container, `10.0.101.14`, reachable only from Caddy) |
|
||||
| `hl-minipc3/` | hl-minipc3 | K3s worker node; central Caddy reverse-proxy (`*.home.sosnovsky.ca`, plus `gitea.skyg.ca` HTTP/SSH); serves LoopRail docs at `looprails.skyg.ca`, plus its guarded telemetry route `/t/v1` → Umami and the LAN-only `umami.home.sosnovsky.ca`; buildbot-nix CI master + worker (2 cores) |
|
||||
| `hl-pi1/` | hl-pi1 | Raspberry Pi CM4 (aarch64) — headless server, SSH only |
|
||||
| `hl-pi2/` | hl-pi2 | Raspberry Pi 4 (aarch64) — headless server, SSH only |
|
||||
| `hl-terra1/` | hl-terra1 | NFS storage + Jellyfin backup |
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
imports = [
|
||||
./hardware-configuration
|
||||
./packages.nix
|
||||
./slack.nix
|
||||
./services.nix
|
||||
./networking.nix
|
||||
./hardware.nix
|
||||
./systemd.nix
|
||||
./omarchy.nix
|
||||
];
|
||||
|
||||
skyg = {
|
||||
@@ -28,6 +30,7 @@
|
||||
printers.enable = true;
|
||||
fixes = {
|
||||
airpod-bluetooth.enabled = true;
|
||||
fingerprint-autosuspend.enabled = true;
|
||||
};
|
||||
tiler = {
|
||||
enable = true;
|
||||
|
||||
@@ -19,7 +19,7 @@ in
|
||||
"x-scheme-handler/mailto" = "chromium-browser.desktop";
|
||||
"x-scheme-handler/sgnl" = "signal.desktop";
|
||||
"x-scheme-handler/signalcaptcha" = "signal.desktop";
|
||||
"x-scheme-handler/slack" = "slack.desktop";
|
||||
"x-scheme-handler/slack" = "slack-link-picker.desktop";
|
||||
"x-scheme-handler/terminal" = "com.mitchellh.ghostty.desktop";
|
||||
"application/pdf" = "chromium-browser.desktop";
|
||||
"application/xhtml+xml" = "chromium-browser.desktop";
|
||||
|
||||
@@ -13,6 +13,7 @@ in
|
||||
};
|
||||
networking.firewall.allowedUDPPorts = openPorts;
|
||||
networking.firewall.allowedTCPPorts = openPorts;
|
||||
programs.mosh.enable = true;
|
||||
networking.hosts = {
|
||||
"0.0.0.0" = [
|
||||
"auth.me.internal"
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
{ pkgs, nixarchy, skygUtils, config, ... }:
|
||||
let
|
||||
# Omarchy shell build
|
||||
dedent = "${pkgs.gawk}/bin/awk 'BEGIN{m=9999} {l[NR]=$0; match($0,/^ */); if ($0 ~ /[^ ]/ && RLENGTH<m) m=RLENGTH} END{for(i=1;i<=NR;i++) print substr(l[i],m+1)}'";
|
||||
omarchy = ((pkgs.extend nixarchy.overlays.default).omarchy).overrideAttrs (old: {
|
||||
installPhase = builtins.replaceStrings
|
||||
[ "python3 -c '" "' $menu\n" ]
|
||||
[ "python3 -c \"$(printf '%s' '" "' | ${dedent})\" $menu\n" ]
|
||||
old.installPhase;
|
||||
});
|
||||
# The shell's runtime deps, minus hyprland (we keep the flake's Hyprland).
|
||||
# Omarchy runtime deps
|
||||
omarchyRuntime = builtins.filter
|
||||
(d: !(pkgs.lib.hasPrefix "hyprland-" (d.name or "")))
|
||||
omarchy.passthru.runtimeDeps;
|
||||
in
|
||||
{
|
||||
# Omarchy env vars (shell resolves paths via OMARCHY_PATH)
|
||||
environment.sessionVariables.OMARCHY_PATH = "${omarchy}/share/omarchy";
|
||||
environment.sessionVariables.OMARCHY_SCREENSHOT_EDITOR = "satty-edit";
|
||||
|
||||
# Omarchy config link: ~/.config/omarchy -> configs/fwbook/omarchy
|
||||
system.userActivationScripts.omarchyConfig.text =
|
||||
skygUtils.makeHyperlinkScriptToConfigs {
|
||||
filePath = "fwbook/omarchy";
|
||||
targetPath = "omarchy";
|
||||
configSource = "/home/${config.skyg.user.name}/nixos-setup/configs";
|
||||
};
|
||||
|
||||
# Packages
|
||||
environment.systemPackages =
|
||||
[ omarchy ]
|
||||
++ omarchyRuntime;
|
||||
}
|
||||
+81
-127
@@ -1,24 +1,5 @@
|
||||
{ pkgs, unstablePkgs, ai-usagebar, hermes-agent, nixarchy, skygUtils, config, ... }:
|
||||
{ pkgs, unstablePkgs, looprail, ... }:
|
||||
let
|
||||
# Omarchy (nixarchy) shell, hand-wired — no nixarchy modules. The shell is
|
||||
# launched from configs/fwbook/hypr/conf/autostart.lua (omarchy-launch-shell).
|
||||
#
|
||||
# Workaround for an upstream bug in nixarchy v4.0.4-1: the omarchy package's
|
||||
# installPhase is one '' string whose least-indented lines are the shell-quoted
|
||||
# omarchy-theme-set patterns (indent 4), so Nix dedents the whole string by 4
|
||||
# and the inline `python3 -c '...'` menu check stays indented -> IndentationError.
|
||||
# Wrap that one invocation so its code is dedented before Python sees it.
|
||||
dedent = "${pkgs.gawk}/bin/awk 'BEGIN{m=9999} {l[NR]=$0; match($0,/^ */); if ($0 ~ /[^ ]/ && RLENGTH<m) m=RLENGTH} END{for(i=1;i<=NR;i++) print substr(l[i],m+1)}'";
|
||||
omarchy = ((pkgs.extend nixarchy.overlays.default).omarchy).overrideAttrs (old: {
|
||||
installPhase = builtins.replaceStrings
|
||||
[ "python3 -c '" "' $menu\n" ]
|
||||
[ "python3 -c \"$(printf '%s' '" "' | ${dedent})\" $menu\n" ]
|
||||
old.installPhase;
|
||||
});
|
||||
# The shell's runtime deps, minus hyprland (we keep the flake's Hyprland).
|
||||
omarchyRuntime = builtins.filter
|
||||
(d: !(pkgs.lib.hasPrefix "hyprland-" (d.name or "")))
|
||||
omarchy.passthru.runtimeDeps;
|
||||
gdk = pkgs.google-cloud-sdk.withExtraComponents (
|
||||
with pkgs.google-cloud-sdk.components;
|
||||
[
|
||||
@@ -26,10 +7,6 @@ let
|
||||
kubectl
|
||||
]
|
||||
);
|
||||
# Resolve bundles its own Qt5, which has no wayland platform plugin. The
|
||||
# Hyprland session exports QT_QPA_PLATFORM=wayland globally
|
||||
# (configs/fwbook/hypr/conf/env.lua), so Resolve aborts at startup. Force
|
||||
# xcb — Resolve is X11-only and runs under XWayland anyway.
|
||||
davinci-resolve-wrapped = pkgs.symlinkJoin {
|
||||
name = "davinci-resolve";
|
||||
paths = [ pkgs.davinci-resolve ];
|
||||
@@ -40,144 +17,121 @@ let
|
||||
};
|
||||
in
|
||||
{
|
||||
# The shell resolves everything through OMARCHY_PATH.
|
||||
environment.sessionVariables.OMARCHY_PATH = "${omarchy}/share/omarchy";
|
||||
environment.sessionVariables.OMARCHY_SCREENSHOT_EDITOR = "satty-edit";
|
||||
|
||||
# ~/.config/omarchy -> configs/fwbook/omarchy (same pattern as hypr/noctalia).
|
||||
system.userActivationScripts.omarchyConfig.text =
|
||||
skygUtils.makeHyperlinkScriptToConfigs {
|
||||
filePath = "fwbook/omarchy";
|
||||
targetPath = "omarchy";
|
||||
configSource = "/home/${config.skyg.user.name}/nixos-setup/configs";
|
||||
};
|
||||
|
||||
environment.systemPackages =
|
||||
[ omarchy ]
|
||||
++ omarchyRuntime
|
||||
# Theme application: omarchy-theme-set-gnome writes gsettings, and every
|
||||
# theme names a Yaru icon variant.
|
||||
++ (with pkgs; [
|
||||
(with pkgs; [
|
||||
# Desktop & theme
|
||||
glib
|
||||
gsettings-desktop-schemas
|
||||
gnome-themes-extra
|
||||
yaru-theme
|
||||
adwaita-icon-theme
|
||||
])
|
||||
++ (with pkgs; [
|
||||
oreo-cursors-plus
|
||||
|
||||
# Screen & images
|
||||
grim
|
||||
slurp
|
||||
wl-clipboard
|
||||
tesseract
|
||||
wl-screenrec
|
||||
gpu-screen-recorder
|
||||
gifski
|
||||
imagemagick
|
||||
zbar
|
||||
curl
|
||||
translate-shell
|
||||
wl-screenrec
|
||||
tesseract
|
||||
|
||||
# Media & creative
|
||||
obs-studio
|
||||
davinci-resolve-wrapped
|
||||
shotcut
|
||||
ffmpeg
|
||||
gifski
|
||||
libusb1
|
||||
lshw
|
||||
jq
|
||||
parted
|
||||
gparted-full
|
||||
f3
|
||||
nixd
|
||||
kdePackages.qtdeclarative
|
||||
krita
|
||||
gimp-with-plugins
|
||||
simple-scan
|
||||
orca-slicer
|
||||
|
||||
# Chat & meetings
|
||||
zoom-us
|
||||
discord
|
||||
betterdiscordctl
|
||||
signal-desktop
|
||||
telegram-desktop
|
||||
|
||||
# Office
|
||||
onlyoffice-desktopeditors
|
||||
darling-dmg
|
||||
piper-tts
|
||||
ffmpeg
|
||||
oreo-cursors-plus
|
||||
|
||||
postgresql
|
||||
google-cloud-sdk
|
||||
awscli
|
||||
openfortivpn
|
||||
openfortivpn-webview
|
||||
openfortivpn-webview-qt
|
||||
nodejs
|
||||
|
||||
# Wine
|
||||
wineWow64Packages.stable
|
||||
winetricks
|
||||
wineWow64Packages.waylandFull
|
||||
|
||||
obs-studio
|
||||
davinci-resolve-wrapped
|
||||
grim
|
||||
slurp
|
||||
wl-clipboard
|
||||
tesseract
|
||||
imagemagick
|
||||
zbar
|
||||
curl
|
||||
translate-shell
|
||||
wl-screenrec
|
||||
ffmpeg
|
||||
gifski
|
||||
jq
|
||||
# Cloud, VPN & data
|
||||
postgresql
|
||||
google-cloud-sdk
|
||||
gdk
|
||||
awscli
|
||||
openfortivpn
|
||||
openfortivpn-webview
|
||||
openfortivpn-webview-qt
|
||||
bitwarden-cli
|
||||
|
||||
krita
|
||||
gimp-with-plugins
|
||||
shotcut
|
||||
simple-scan
|
||||
|
||||
zoom-us
|
||||
betterdiscordctl
|
||||
discord
|
||||
signal-desktop
|
||||
telegram-desktop
|
||||
# Disks & hardware
|
||||
libusb1
|
||||
lshw
|
||||
parted
|
||||
gparted-full
|
||||
f3
|
||||
rpi-imager
|
||||
rpiboot
|
||||
libimobiledevice
|
||||
ifuse
|
||||
idevicerestore
|
||||
|
||||
# Languages & dev tools
|
||||
nodejs
|
||||
python313
|
||||
python314
|
||||
uv
|
||||
pipx
|
||||
cargo
|
||||
rustc
|
||||
go
|
||||
pipx
|
||||
rust-analyzer
|
||||
|
||||
vscode
|
||||
unstablePkgs.zed-editor-fhs
|
||||
devenv
|
||||
nixd
|
||||
kdePackages.qtdeclarative
|
||||
just
|
||||
rpi-imager
|
||||
rpiboot
|
||||
code-cursor-fhs
|
||||
nix-prefetch
|
||||
orca-slicer
|
||||
devcontainer
|
||||
gpu-screen-recorder
|
||||
unstablePkgs.devcontainer
|
||||
unstablePkgs.devenv
|
||||
flox_dev
|
||||
|
||||
darling-dmg
|
||||
|
||||
bitwarden-cli
|
||||
|
||||
onlyoffice-desktopeditors
|
||||
|
||||
nix-prefetch
|
||||
gh
|
||||
gdk
|
||||
unstablePkgs.slack
|
||||
bubblewrap
|
||||
delta-editor
|
||||
|
||||
libimobiledevice
|
||||
ifuse
|
||||
|
||||
idevicerestore
|
||||
# Editors
|
||||
unstablePkgs.vscode
|
||||
unstablePkgs.zed-editor-fhs
|
||||
code-cursor-fhs
|
||||
|
||||
# Agents & LLM tools
|
||||
unstablePkgs.claude-code
|
||||
unstablePkgs.claude-agent-acp
|
||||
unstablePkgs.grok-build
|
||||
unstablePkgs.pi-coding-agent
|
||||
unstablePkgs.goose-cli
|
||||
unstablePkgs.claude-agent-acp
|
||||
unstablePkgs.claude-code
|
||||
buzz-desktop
|
||||
bubblewrap
|
||||
delta-editor
|
||||
herdr
|
||||
superset-desktop
|
||||
ai-usagebar.packages.${pkgs.stdenv.hostPlatform.system}.default
|
||||
hermes-agent.packages.${pkgs.stdenv.hostPlatform.system}.default
|
||||
|
||||
skygqts
|
||||
unstablePkgs.herdr
|
||||
unstablePkgs.codex
|
||||
unstablePkgs.codex-acp
|
||||
looprail.packages.${pkgs.stdenv.hostPlatform.system}.looprail
|
||||
hermenix
|
||||
config.services.hyprland-headless-stream.package
|
||||
unstablePkgs.pi-coding-agent
|
||||
|
||||
# Remote & CLI tools
|
||||
unstablePkgs.et
|
||||
curl
|
||||
jq
|
||||
translate-shell
|
||||
buzz-desktop
|
||||
skygqts
|
||||
]);
|
||||
}
|
||||
@@ -1,20 +1,8 @@
|
||||
{ pkgs, unstablePkgs, config, hyprland, ... }:
|
||||
{ unstablePkgs, ... }:
|
||||
{
|
||||
services.tailscale.enable = true;
|
||||
services.tailscale.extraDaemonFlags = [ "--statedir=/var/lib/tailscale" ];
|
||||
|
||||
programs.tether = {
|
||||
enable = true;
|
||||
wifi = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
};
|
||||
bluetooth = {
|
||||
enable = true;
|
||||
adapters = [ "hci0" ];
|
||||
};
|
||||
};
|
||||
|
||||
services.flatpak.enable = true;
|
||||
services.flatpak.packages = [
|
||||
"io.github.kolunmi.Bazaar"
|
||||
@@ -30,7 +18,7 @@
|
||||
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
extest.enable = true;
|
||||
extest.enable = false;
|
||||
remotePlay.openFirewall = true;
|
||||
dedicatedServer.openFirewall = true;
|
||||
localNetworkGameTransfers.openFirewall = true;
|
||||
@@ -53,9 +41,4 @@
|
||||
"modesetting"
|
||||
"fbdev"
|
||||
];
|
||||
services.hyprland-headless-stream = {
|
||||
enable = true;
|
||||
hyprlandPackage = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
|
||||
sessions.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{ pkgs, nixpkgs-slack, ... }:
|
||||
let
|
||||
slack = (import nixpkgs-slack {
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
config.allowUnfreePredicate = pkg: pkgs.lib.getName pkg == "slack";
|
||||
}).slack;
|
||||
slackIcon = "${slack}/share/icons/hicolor/512x512/apps/slack.png";
|
||||
makeSlack =
|
||||
{ id, name, color }:
|
||||
let
|
||||
icon = pkgs.runCommand "slack-${id}-icon.png" { nativeBuildInputs = [ pkgs.imagemagick ]; } ''
|
||||
magick ${slackIcon} -modulate 100,0 -fill '${color}' -tint 100 $out
|
||||
'';
|
||||
bin = pkgs.writeShellScriptBin "slack-${id}" ''
|
||||
exec ${slack}/bin/slack --user-data-dir="''${XDG_CONFIG_HOME:-$HOME/.config}/Slack-${name}" "$@"
|
||||
'';
|
||||
desktop = pkgs.makeDesktopItem {
|
||||
name = "slack-${id}";
|
||||
desktopName = "Slack (${name})";
|
||||
exec = "${bin}/bin/slack-${id} -s %U";
|
||||
inherit icon;
|
||||
startupWMClass = "Slack";
|
||||
categories = [ "Network" "InstantMessaging" ];
|
||||
};
|
||||
in
|
||||
pkgs.symlinkJoin {
|
||||
name = "slack-${id}";
|
||||
paths = [ bin desktop ];
|
||||
};
|
||||
slack-sibli = makeSlack { id = "sibli"; name = "Sibli"; color = "#2EB67D"; };
|
||||
slack-personal = makeSlack { id = "personal"; name = "Personal"; color = "#4A154B"; };
|
||||
|
||||
# Opens slack:// links in the Slack you pick.
|
||||
slack-link-picker =
|
||||
let
|
||||
bin = pkgs.writeShellScriptBin "slack-link-picker" ''
|
||||
choice=$(printf '%s\n' "Slack" "Slack (Sibli)" "Slack (Personal)" \
|
||||
| ${pkgs.rofi}/bin/rofi -dmenu -i -p "Open Slack link in")
|
||||
case "$choice" in
|
||||
"Slack") exec ${slack}/bin/slack -s "$@" ;;
|
||||
"Slack (Sibli)") exec ${slack-sibli}/bin/slack-sibli -s "$@" ;;
|
||||
"Slack (Personal)") exec ${slack-personal}/bin/slack-personal -s "$@" ;;
|
||||
esac
|
||||
'';
|
||||
desktop = pkgs.makeDesktopItem {
|
||||
name = "slack-link-picker";
|
||||
desktopName = "Slack Link Picker";
|
||||
exec = "${bin}/bin/slack-link-picker %U";
|
||||
icon = "slack";
|
||||
noDisplay = true;
|
||||
mimeTypes = [ "x-scheme-handler/slack" ];
|
||||
};
|
||||
in
|
||||
pkgs.symlinkJoin {
|
||||
name = "slack-link-picker";
|
||||
paths = [ bin desktop ];
|
||||
};
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [
|
||||
slack-sibli
|
||||
slack-personal
|
||||
slack-link-picker
|
||||
];
|
||||
}
|
||||
@@ -1,4 +1,10 @@
|
||||
{ ... }:
|
||||
{
|
||||
systemd.services.systemd-udev-settle.enable = false;
|
||||
|
||||
# Snapper needs a .snapshots subvolume in each snapshotted volume
|
||||
systemd.tmpfiles.rules = [
|
||||
"v /.snapshots 0750 root root -"
|
||||
"v /home/.snapshots 0750 root root -"
|
||||
];
|
||||
}
|
||||
@@ -10,14 +10,16 @@
|
||||
skyg = {
|
||||
user.enable = true;
|
||||
server.admin.enable = true;
|
||||
server.exporters.enable = true;
|
||||
|
||||
nixos = {
|
||||
desktop = {
|
||||
enable = false;
|
||||
gnome.enable = false;
|
||||
};
|
||||
common.ssh-server.enable = true;
|
||||
common.containers.openMetricsPort = true;
|
||||
common.diagnix.enable = true;
|
||||
|
||||
common.dns.enable = true;
|
||||
common.hardware = {
|
||||
nvidia.enable = true;
|
||||
amdgpu.enable = true;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
services.fwupd.enable = true;
|
||||
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
||||
boot.kernelPackages = pkgs.linuxPackages;
|
||||
boot.kernelParams = [ "processor.max_cstate=1" ];
|
||||
networking.interfaces.enp4s0.wakeOnLan.enable = true;
|
||||
networking.interfaces.lo.wakeOnLan.enable = true;
|
||||
}
|
||||
@@ -4,5 +4,7 @@
|
||||
./immich-ml.nix
|
||||
./portainer.nix
|
||||
./timers.nix
|
||||
./linux-tracker.nix
|
||||
./llama-cpp.nix
|
||||
];
|
||||
}
|
||||
@@ -6,6 +6,7 @@ in
|
||||
skyg.nixos.common.container-services.jellyfin = {
|
||||
enable = true;
|
||||
autoUpdate.enable = true;
|
||||
networks.lan = config.skyg.nixos.common.containers.networks.ipvlanLab.compose;
|
||||
services.jellyfin = {
|
||||
image = "jellyfin/jellyfin";
|
||||
deploy.resources.reservations.devices = [
|
||||
@@ -34,7 +35,7 @@ in
|
||||
JELLYFIN_CONFIG_DIR = "/mnt/apps/jellyfin/config";
|
||||
NVIDIA_VISIBLE_DEVICES = "all";
|
||||
};
|
||||
ports = [ "8096:8096" ];
|
||||
networks.lan.ipv4_address = app.ip;
|
||||
};
|
||||
volumes = {
|
||||
torrents = {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
services.skyg-linux-tracker = {
|
||||
enable = true;
|
||||
bind = "0.0.0.0";
|
||||
openFirewall = true;
|
||||
docker.enable = config.virtualisation.docker.enable;
|
||||
# Reachable only by its lab FQDN; the short name does not resolve.
|
||||
allowedHosts = [ "bigbox1.lab.internal" ];
|
||||
# OTLP out to the collector on minipc1.
|
||||
settings.otel = {
|
||||
enabled = true;
|
||||
endpoint = "http://minipc1.lab.internal:4317";
|
||||
protocol = "grpc";
|
||||
export_logs = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
# llama.cpp with DFlash2 speculative decoding on RTX 3060 (12GB VRAM).
|
||||
#
|
||||
# Off by default: it needs ~19 GB of weights on disk. Fetch the files, then
|
||||
# flip enable:
|
||||
#
|
||||
# sudo install -d -o ari -g users /var/lib/llama-cpp
|
||||
# cd /var/lib/llama-cpp
|
||||
# curl -L -O https://huggingface.co/ggml-org/Qwen3.8-27B-GGUF/resolve/main/Qwen3.8-27B-Q4_K_M.gguf
|
||||
# curl -L -O https://huggingface.co/z-lab/Qwen3.8-27B-DFlash2-GGUF/resolve/main/Qwen3.8-27B-DFlash2-Q8_0.gguf
|
||||
#
|
||||
# Measured expectation: ~15-25 tok/s (RTX 3060 has less bandwidth than Strix
|
||||
# Halo, but the dedicated VRAM is snappier for inference).
|
||||
skyg.nixos.server.services.llama-cpp = {
|
||||
enable = false;
|
||||
|
||||
package = "llama-cpp-cuda";
|
||||
model = "/var/lib/llama-cpp/Qwen3.8-27B-Q4_K_M.gguf";
|
||||
draftModel = "/var/lib/llama-cpp/Qwen3.8-27B-DFlash2-Q8_0.gguf";
|
||||
specType = "draft-dflash";
|
||||
specDraftNMax = 7;
|
||||
|
||||
ctx = 32768;
|
||||
kvCacheType = "q8_0";
|
||||
cacheReuse = 256;
|
||||
|
||||
# RTX 3060: 12GB VRAM, offload most layers but leave headroom for context.
|
||||
gpuLayers = 30;
|
||||
parallel = 2;
|
||||
|
||||
host = "0.0.0.0";
|
||||
port = 8081;
|
||||
openFirewall = true;
|
||||
};
|
||||
}
|
||||
@@ -13,14 +13,18 @@
|
||||
user.enable = true;
|
||||
nixos.common = {
|
||||
ssh-server.enable = true;
|
||||
containers.openMetricsPort = true;
|
||||
diagnix.enable = true;
|
||||
|
||||
dns.enable = true;
|
||||
|
||||
containers.networks.ipvlanLab = {
|
||||
enable = true;
|
||||
parent = "enp3s0";
|
||||
};
|
||||
cachePush.enable = false;
|
||||
cacheReceive.enable = true;
|
||||
};
|
||||
server.exporters.enable = true;
|
||||
|
||||
networkDrives = {
|
||||
enable = true;
|
||||
bigBox2.enable = false;
|
||||
|
||||
@@ -1,4 +1,39 @@
|
||||
{ ... }:
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
services.fwupd.enable = true;
|
||||
|
||||
# Interim: the box loses power under load. Use less power and heat, log more.
|
||||
# Remove this block once the new board is in and stable.
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
# No turbo. Lost on reboot unless set here.
|
||||
"w /sys/devices/system/cpu/cpufreq/boost - - - - 0"
|
||||
# Max clock 2.5 GHz. Steps on this CPU: 3.5, 3.0, 2.5, 2.0, 1.4.
|
||||
"w /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq - - - - 2500000"
|
||||
];
|
||||
|
||||
# Keep logs on disk and flush often, so the last seconds before a crash survive.
|
||||
services.journald.extraConfig = ''
|
||||
Storage=persistent
|
||||
SystemMaxUse=2G
|
||||
SyncIntervalSec=5s
|
||||
'';
|
||||
|
||||
# Reboot 10 s after a kernel panic instead of hanging.
|
||||
boot.kernel.sysctl."kernel.panic" = 10;
|
||||
|
||||
# Watch disk health and log warnings. No mail set up.
|
||||
services.smartd = {
|
||||
enable = true;
|
||||
autodetect = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.smartmontools
|
||||
pkgs.lm_sensors
|
||||
pkgs.dmidecode
|
||||
pkgs.stress-ng
|
||||
pkgs.memtester
|
||||
pkgs.ethtool
|
||||
config.boot.kernelPackages.cpupower
|
||||
];
|
||||
}
|
||||
@@ -4,5 +4,6 @@
|
||||
./nix-serve.nix
|
||||
./nfs-server.nix
|
||||
./immich.nix
|
||||
./linux-tracker.nix
|
||||
];
|
||||
}
|
||||
@@ -34,7 +34,7 @@ in
|
||||
environmentFiles = [ config.age.secrets.immich-shared.path ];
|
||||
environment = envVars;
|
||||
deploy.resources.limits = {
|
||||
cpus = "4";
|
||||
cpus = "1";
|
||||
memory = "8G";
|
||||
};
|
||||
networks = {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
services.skyg-linux-tracker = {
|
||||
enable = true;
|
||||
bind = "0.0.0.0";
|
||||
openFirewall = true;
|
||||
docker.enable = config.virtualisation.docker.enable;
|
||||
# Reachable only by its lab FQDN; the short name does not resolve.
|
||||
allowedHosts = [ "bigbox2.lab.internal" ];
|
||||
# OTLP out to the collector on minipc1.
|
||||
settings.otel = {
|
||||
enabled = true;
|
||||
endpoint = "http://minipc1.lab.internal:4317";
|
||||
protocol = "grpc";
|
||||
export_logs = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
{ pkgs, unstablePkgs, myPkgs, my-nixpkgs, ... }:
|
||||
{ pkgs, my-nixpkgs, ... }:
|
||||
let
|
||||
ports = {
|
||||
tabby = 11029;
|
||||
@@ -40,11 +40,18 @@ in
|
||||
|
||||
environment.sessionVariables.ELECTRON_OZONE_PLATFORM_HINT = "wayland";
|
||||
|
||||
programs.nh.clean = {
|
||||
dates = "daily";
|
||||
extraArgs = "--keep-since 2d --keep 5";
|
||||
};
|
||||
|
||||
skyg = {
|
||||
user.enable = true;
|
||||
core.qemu.enable = true;
|
||||
nixos = {
|
||||
common.ssh-server.enable = true;
|
||||
common.diagnix.enable = true;
|
||||
common.dns.enable = true;
|
||||
common.cachePush.enable = true;
|
||||
common.hardware = {
|
||||
pipewire.enable = true;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.tailscale.enable = true;
|
||||
|
||||
systemd.network.wait-online.enable = false;
|
||||
}
|
||||
@@ -16,6 +16,13 @@
|
||||
lmstudio
|
||||
signal-cli
|
||||
blueman
|
||||
unstablePkgs.devenv
|
||||
|
||||
unstablePkgs.grok-build
|
||||
unstablePkgs.pi-coding-agent
|
||||
unstablePkgs.goose-cli
|
||||
unstablePkgs.claude-agent-acp
|
||||
unstablePkgs.claude-code
|
||||
])
|
||||
++ [ myPkgs.ds4-rocm ];
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
{
|
||||
imports = [
|
||||
./ds4.nix
|
||||
./llama-cpp.nix
|
||||
./ollama.nix
|
||||
./libretranslate.nix
|
||||
./hermenix.nix
|
||||
./wyoming.nix
|
||||
./steam.nix
|
||||
./buildbot.nix
|
||||
./linux-tracker.nix
|
||||
./nbot.nix
|
||||
];
|
||||
}
|
||||
@@ -4,7 +4,7 @@ let
|
||||
in
|
||||
{
|
||||
services.ds4 = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
package = (myPkgs.ds4-rocm.override { rocmArch = "gfx1151"; });
|
||||
user = "ari";
|
||||
group = "users";
|
||||
|
||||
@@ -4,9 +4,11 @@ let
|
||||
hermes = 8642;
|
||||
hermesDashboard = 9119;
|
||||
hhstreamView = 9988;
|
||||
hermenixDocs = 9989;
|
||||
hermesCache = 5001;
|
||||
ollama = 11434;
|
||||
ds4 = 8000;
|
||||
tracker = 1984;
|
||||
};
|
||||
in
|
||||
{
|
||||
@@ -22,13 +24,14 @@ in
|
||||
hostLanAddress = "10.0.10.11";
|
||||
lanGateway = "10.0.0.1";
|
||||
};
|
||||
vcpu = 2;
|
||||
vcpu = 3;
|
||||
mem = 8000;
|
||||
hermesHome = "/var/lib/hermes/.hermes";
|
||||
hostCache.port = ports.hermesCache;
|
||||
hostAccess = [
|
||||
{ port = ports.ollama; }
|
||||
{ port = ports.ds4; }
|
||||
{ port = ports.tracker; }
|
||||
];
|
||||
lanAccess = [
|
||||
{ address = "10.0.12.1"; port = 80; }
|
||||
@@ -38,11 +41,14 @@ in
|
||||
{ address = "10.0.101.3"; port = 8080; }
|
||||
{ address = "10.0.101.3"; port = 9102; }
|
||||
{ address = "10.0.101.8"; port = 3000; }
|
||||
{ address = "10.0.10.0/24"; port = 22; }
|
||||
|
||||
];
|
||||
publish = [
|
||||
{ hostPort = ports.hermes; guestPort = 8642; }
|
||||
{ hostPort = ports.hermesDashboard; guestPort = 9119; }
|
||||
{ hostPort = ports.hhstreamView; guestPort = ports.hhstreamView; }
|
||||
{ hostPort = ports.hermenixDocs; guestPort = 80; }
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{ config, lib, skyg-secrets, ... }:
|
||||
let
|
||||
# Hosts this primary tracker consolidates.
|
||||
peers = [ "minipc1" "minipc2" "minipc3" "bigbox1" "bigbox2" "terra1" ];
|
||||
secretName = peer: "linux-tracker-peer-${peer}";
|
||||
in
|
||||
{
|
||||
age.secrets = lib.genAttrs (map secretName peers) (name: {
|
||||
file = skyg-secrets.${name};
|
||||
owner = "root";
|
||||
mode = "0400";
|
||||
});
|
||||
|
||||
services.skyg-linux-tracker = {
|
||||
enable = true;
|
||||
bind = "0.0.0.0";
|
||||
openFirewall = true;
|
||||
docker.enable = config.virtualisation.docker.enable;
|
||||
# The Hermes VM reaches this host at 10.77.0.1.
|
||||
allowedHosts = [ "fwdesk.lab.internal" "10.77.0.1" ];
|
||||
# Primary: one endpoint for the whole lab (Hermes only talks to this one).
|
||||
peers = {
|
||||
enable = true;
|
||||
peers = lib.genAttrs peers (peer: {
|
||||
url = "http://${peer}.lab.internal:1984";
|
||||
tokenFile = config.age.secrets.${secretName peer}.path;
|
||||
# Trackers have no TLS; token travels in the clear on the lab LAN.
|
||||
allowPlainHttp = true;
|
||||
});
|
||||
};
|
||||
# OTLP out to the collector on minipc1.
|
||||
settings.otel = {
|
||||
enabled = true;
|
||||
endpoint = "http://minipc1.lab.internal:4317";
|
||||
protocol = "grpc";
|
||||
export_logs = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
# llama.cpp with DFlash2 speculative decoding.
|
||||
#
|
||||
# Off by default: it needs ~19 GB of weights on disk and a first build of the
|
||||
# ROCm package. Fetch the files, then flip enable:
|
||||
#
|
||||
# sudo install -d -o ari -g users /var/lib/llama-cpp
|
||||
# cd /var/lib/llama-cpp
|
||||
# curl -L -O https://huggingface.co/ggml-org/Qwen3.8-27B-GGUF/resolve/main/Qwen3.8-27B-Q4_K_M.gguf
|
||||
# curl -L -O https://huggingface.co/z-lab/Qwen3.8-27B-DFlash2-GGUF/resolve/main/Qwen3.8-27B-DFlash2-Q8_0.gguf
|
||||
#
|
||||
# Measured expectation for this box: ~25-40 tok/s, not the 380 tok/s in the
|
||||
# post that prompted this — that figure is a 3090 copying a document.
|
||||
skyg.nixos.server.services.llama-cpp = {
|
||||
enable = false;
|
||||
|
||||
model = "/var/lib/llama-cpp/Qwen3.8-27B-Q4_K_M.gguf";
|
||||
draftModel = "/var/lib/llama-cpp/Qwen3.8-27B-DFlash2-Q8_0.gguf";
|
||||
specType = "draft-dflash";
|
||||
specDraftNMax = 7;
|
||||
|
||||
ctx = 32768;
|
||||
kvCacheType = "q8_0";
|
||||
cacheReuse = 256;
|
||||
|
||||
host = "0.0.0.0";
|
||||
port = 8081;
|
||||
openFirewall = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
{ config, lib, pkgs, skyg-secrets, ... }:
|
||||
let
|
||||
ports = { cluster = 7946; };
|
||||
homes = "/data/nbot";
|
||||
goCache = "/data/nbot-cache/go";
|
||||
secrets = [ "nbot-slack" "nbot-goose" "nbot-cluster" ];
|
||||
settings = {
|
||||
# The system each container boots (nbot's agent + gh); updated on every rebuild.
|
||||
system = "${config.skyg.nixos.server.services.nbot-agent.system}";
|
||||
machines_dir = "/var/lib/machines";
|
||||
state_dir = "/var/lib/nbot";
|
||||
agent_cwd = "/root";
|
||||
|
||||
idle_timeout = "6h";
|
||||
max_idle_timeout = "0s";
|
||||
allow_indefinite = true;
|
||||
boot_timeout = "2m";
|
||||
|
||||
# Go caches shared by all containers on this node (see ABOUTME). Env vars are in agent_env.
|
||||
rw_binds = [
|
||||
"${goCache}/mod:/var/cache/go/mod:idmap"
|
||||
"${goCache}/build:/var/cache/go/build:idmap"
|
||||
];
|
||||
|
||||
summaries = {
|
||||
timeout = "10s";
|
||||
};
|
||||
|
||||
# Goose settings sent to every container (also on fws1).
|
||||
# Values come from the nbot-goose secret.
|
||||
agent_env = {
|
||||
COMMAND_CODE_API_KEY = "$COMMAND_CODE_API_KEY";
|
||||
GH_TOKEN = "$GH_TOKEN";
|
||||
DIAGNIX_KEY = "$DIAGNIX_KEY";
|
||||
GOMODCACHE = "/var/cache/go/mod";
|
||||
GOCACHE = "/var/cache/go/build";
|
||||
};
|
||||
|
||||
model_providers = [
|
||||
{
|
||||
id = "custom_commandcode";
|
||||
name = "Command Code";
|
||||
key_env = "COMMAND_CODE_API_KEY";
|
||||
models = [
|
||||
"deepseek/deepseek-v4-flash"
|
||||
"minimax/minimax-m3.1-flash"
|
||||
"minimaxai/minimax-m3"
|
||||
"anthropic/claude-opus-5-5"
|
||||
"anthropic/claude-sonnet-5-5"
|
||||
"anthropic/claude-haiku-5-5"
|
||||
"reflection/beam:free"
|
||||
"moonshotai/kimi-k3"
|
||||
"moonshotai/kimi-k2.7-code"
|
||||
"zai-org/glm-5.3"
|
||||
"z-ai/glm-5.3-flash"
|
||||
"xai/grok-4.7"
|
||||
"openai/gpt-6.1-sol"
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
container = { memory_mb = 4096; cpus = 1.0; };
|
||||
max_container = { memory_mb = 16384; cpus = 4; };
|
||||
host_reserve = { memory_mb = 32768; cpus = 4.0; };
|
||||
storage = { min = "2G"; max = "5G"; limit = "20G"; };
|
||||
drives = [{ path = homes; reserve = "40G"; allow_subdir = true; }];
|
||||
|
||||
cluster = {
|
||||
node_secrets = { hl-fws1 = "$HL_FWS1_CLUSTER_SECRET"; };
|
||||
listen = ":${toString ports.cluster}";
|
||||
};
|
||||
|
||||
# Only read on first start; after that, manage permissions from Slack.
|
||||
permissions = {
|
||||
managers = [ "U0CBGSS4U6A" ];
|
||||
default.U0CBGSS4U6A = [ "all" ];
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
age.secrets = lib.genAttrs secrets (name: {
|
||||
file = skyg-secrets.${name};
|
||||
owner = "root";
|
||||
mode = "0400";
|
||||
});
|
||||
|
||||
# nbot flake input; options and docs in its repo.
|
||||
services.nbot = {
|
||||
enable = true;
|
||||
mode = "master";
|
||||
clusterPort = ports.cluster;
|
||||
kvm = true;
|
||||
drives = [ homes ];
|
||||
stateDir = "/var/lib/nbot";
|
||||
configFile = (pkgs.formats.toml { }).generate "nbot.toml" settings;
|
||||
};
|
||||
|
||||
# The module takes one env file; these add to it.
|
||||
systemd.services.nbot.serviceConfig.EnvironmentFile =
|
||||
map (name: config.age.secrets.${name}.path) secrets;
|
||||
|
||||
# Container links belong to systemd-networkd.
|
||||
networking.networkmanager.unmanaged = [ "interface-name:ve-*" ];
|
||||
networking.dhcpcd.denyInterfaces = [ "ve-*" ];
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${homes} 0700 root root -"
|
||||
"d ${goCache}/mod 0700 root root -"
|
||||
"d ${goCache}/build 0700 root root -"
|
||||
];
|
||||
}
|
||||
@@ -3,8 +3,6 @@ let
|
||||
ports = { ollama = 11434; };
|
||||
in
|
||||
{
|
||||
services.open-webui.enable = true;
|
||||
|
||||
users.users.ollama = {
|
||||
enable = true;
|
||||
home = "/var/lib/ollama";
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
{ ... }:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
extest.enable = true;
|
||||
extraPackages = [ pkgs.pulseaudio ];
|
||||
remotePlay.openFirewall = true;
|
||||
dedicatedServer.openFirewall = true;
|
||||
localNetworkGameTransfers.openFirewall = true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
imports = [
|
||||
./services.nix
|
||||
./services
|
||||
./hardware-configuration
|
||||
./hardware.nix
|
||||
./systemd.nix
|
||||
@@ -11,6 +11,8 @@
|
||||
user.enable = true;
|
||||
nixos = {
|
||||
common.ssh-server.enable = true;
|
||||
common.diagnix.enable = true;
|
||||
common.dns.enable = true;
|
||||
common.hardware.pipewire.enable = true;
|
||||
desktop = {
|
||||
enable = true;
|
||||
@@ -53,6 +55,11 @@
|
||||
playerctl
|
||||
];
|
||||
|
||||
programs.nh.clean = {
|
||||
dates = "daily";
|
||||
extraArgs = "--keep-since 2d --keep 5";
|
||||
};
|
||||
|
||||
services.flatpak.enable = true;
|
||||
services.flatpak.packages = [ "com.spotify.Client" ];
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [ ./nbot.nix ./github-runners.nix ];
|
||||
|
||||
services.pipewire = {
|
||||
extraConfig.pipewire-pulse."10-raop-discover" = {
|
||||
context.modules = [
|
||||
@@ -31,4 +33,18 @@
|
||||
enable = true;
|
||||
arguments = "-o pipewire";
|
||||
};
|
||||
|
||||
services.skyg-linux-tracker = {
|
||||
enable = true;
|
||||
bind = "0.0.0.0";
|
||||
openFirewall = true;
|
||||
allowedHosts = [ "fws1.lab.internal" ];
|
||||
# OTLP out to the collector on minipc1.
|
||||
settings.otel = {
|
||||
enabled = true;
|
||||
endpoint = "http://minipc1.lab.internal:4317";
|
||||
protocol = "grpc";
|
||||
export_logs = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
{ config, lib, skyg-secrets, ... }:
|
||||
let
|
||||
concurrency = 4;
|
||||
runnerNames = map (i: "runner-${toString i}") (lib.range 1 concurrency);
|
||||
stateVersion = config.system.stateVersion;
|
||||
cache = "/var/cache/github-runners/go";
|
||||
credentials = "/run/github-runner-registration";
|
||||
|
||||
# The same numeric identity owns the bind-mounted caches on the host and in every container.
|
||||
runnerUser = {
|
||||
users.github-runner = {
|
||||
uid = 915;
|
||||
isSystemUser = true;
|
||||
group = "github-runner";
|
||||
};
|
||||
groups.github-runner.gid = 915;
|
||||
};
|
||||
in
|
||||
{
|
||||
age.secrets.github-runner-token-fws1 = {
|
||||
file = skyg-secrets.github-runner-token-fws1;
|
||||
path = "${credentials}/token";
|
||||
# The containers mount this directory and must see token rotations.
|
||||
symlink = false;
|
||||
mode = "0400";
|
||||
};
|
||||
|
||||
users = runnerUser;
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${credentials} 0700 root root -"
|
||||
"d ${cache} 0755 root root -"
|
||||
"d ${cache}/build 0700 github-runner github-runner -"
|
||||
"d ${cache}/mod 0700 github-runner github-runner -"
|
||||
];
|
||||
|
||||
systemd.services = lib.genAttrs (map (name: "container@${name}") runnerNames) (_: {
|
||||
serviceConfig = {
|
||||
MemoryLow = "4G";
|
||||
MemoryMax = "8G";
|
||||
CPUQuota = "200%";
|
||||
};
|
||||
});
|
||||
|
||||
containers = lib.genAttrs runnerNames (name: {
|
||||
autoStart = true;
|
||||
bindMounts = {
|
||||
"${credentials}".isReadOnly = true;
|
||||
"/var/cache/go" = {
|
||||
hostPath = cache;
|
||||
isReadOnly = false;
|
||||
};
|
||||
};
|
||||
|
||||
config = { pkgs, ... }: {
|
||||
system.stateVersion = stateVersion;
|
||||
users = runnerUser;
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
services.github-runners.${name} = {
|
||||
enable = true;
|
||||
inherit name;
|
||||
replace = true;
|
||||
url = "https://github.com/SkyG-Org";
|
||||
tokenFile = "${credentials}/token";
|
||||
user = "github-runner";
|
||||
group = "github-runner";
|
||||
extraLabels = [ "fws1" "nixos" "go" ];
|
||||
extraPackages = [ pkgs.go ];
|
||||
extraEnvironment = {
|
||||
NIX_REMOTE = "daemon";
|
||||
GOCACHE = "/var/cache/go/build";
|
||||
GOMODCACHE = "/var/cache/go/mod";
|
||||
};
|
||||
serviceOverrides.ReadWritePaths = [ "/var/cache/go" ];
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
{ config, pkgs, skyg-secrets, ... }:
|
||||
let
|
||||
homes = "/var/lib/nbot/homes";
|
||||
goCache = "/var/lib/nbot-cache/go";
|
||||
settings = {
|
||||
# The system each container boots (nbot's agent + gh); updated on every rebuild.
|
||||
system = "${config.skyg.nixos.server.services.nbot-agent.system}";
|
||||
machines_dir = "/var/lib/machines";
|
||||
state_dir = "/var/lib/nbot";
|
||||
agent_cwd = "/root";
|
||||
|
||||
idle_timeout = "6h";
|
||||
max_idle_timeout = "0s";
|
||||
allow_indefinite = true;
|
||||
boot_timeout = "2m";
|
||||
|
||||
# Go caches shared by all containers on this node (see ABOUTME). Env vars come from the master.
|
||||
rw_binds = [
|
||||
"${goCache}/mod:/var/cache/go/mod:idmap"
|
||||
"${goCache}/build:/var/cache/go/build:idmap"
|
||||
];
|
||||
|
||||
container = { memory_mb = 4096; cpus = 1.0; };
|
||||
max_container = { memory_mb = 51200; cpus = 6; };
|
||||
host_reserve = { memory_mb = 8192; cpus = 2.0; };
|
||||
storage = { min = "2G"; max = "10G"; limit = "50G"; };
|
||||
drives = [{ path = homes; reserve = "200G"; allow_subdir = true; }];
|
||||
|
||||
# Worker of the master on fwdesk. Slack tokens and goose settings come
|
||||
# from the master. Trusts the first certificate it sees (saved in
|
||||
# state_dir/master.fingerprint); pin it in master_fingerprint if wanted.
|
||||
cluster = {
|
||||
name = "hl-fws1";
|
||||
master = "wss://fwdesk.lab.internal:7946";
|
||||
master_fingerprint = [ "ce08c6b0f3aec855cc8b936d81449c1a34074d181089b26acbdddacfca60af1d" ];
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
age.secrets.nbot-cluster = {
|
||||
file = skyg-secrets.nbot-cluster-hl-fws1;
|
||||
owner = "root";
|
||||
mode = "0400";
|
||||
};
|
||||
|
||||
# nbot flake input; options and docs in its repo.
|
||||
services.nbot = {
|
||||
enable = true;
|
||||
mode = "slave";
|
||||
kvm = true;
|
||||
drives = [ homes ];
|
||||
stateDir = "/var/lib/nbot";
|
||||
configFile = (pkgs.formats.toml { }).generate "nbot.toml" settings;
|
||||
environmentFile = config.age.secrets.nbot-cluster.path;
|
||||
};
|
||||
|
||||
# Container links belong to systemd-networkd.
|
||||
networking.networkmanager.unmanaged = [ "interface-name:ve-*" ];
|
||||
networking.dhcpcd.denyInterfaces = [ "ve-*" ];
|
||||
# networkd only has the container links here (NetworkManager owns wlan),
|
||||
# so wait-online would always time out.
|
||||
systemd.network.wait-online.enable = false;
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${homes} 0700 root root -"
|
||||
"d ${goCache}/mod 0700 root root -"
|
||||
"d ${goCache}/build 0700 root root -"
|
||||
];
|
||||
}
|
||||
@@ -33,24 +33,25 @@ in
|
||||
imports = [
|
||||
./services
|
||||
./hardware-configuration
|
||||
./hardware.nix
|
||||
];
|
||||
|
||||
skyg.user.enable = true;
|
||||
skyg.nixos.common.ssh-server.enable = true;
|
||||
skyg.nixos.common.diagnix.enable = true;
|
||||
skyg.nixos.common.dns.enable = true;
|
||||
skyg.server.dns.routing = {
|
||||
enable = false;
|
||||
openFirewall = true;
|
||||
addressesSecretName = "dns-addresses.conf";
|
||||
};
|
||||
skyg.nixos.common.containers.runtime = "docker";
|
||||
skyg.nixos.common.containers.openMetricsPort = true;
|
||||
|
||||
skyg.nixos.common.containers.networks.ipvlanLab = {
|
||||
enable = true;
|
||||
parent = "eno1";
|
||||
};
|
||||
skyg.server.admin.enable = true;
|
||||
skyg.server.exporters.enable = true;
|
||||
|
||||
skyg.nixos.server.k3s.enable = false;
|
||||
skyg.networkDrives.enable = true;
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.fwupd.enable = true;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ let
|
||||
domain = app.effectiveDns;
|
||||
publicDomain = builtins.elemAt app.aliases 0;
|
||||
port = 3000;
|
||||
pairPort = 5000;
|
||||
ip = app.ip;
|
||||
bucket = "buzz-media";
|
||||
images = {
|
||||
@@ -41,6 +42,7 @@ in
|
||||
redis.condition = "service_healthy";
|
||||
minio.condition = "service_healthy";
|
||||
minio-init.condition = "service_completed_successfully";
|
||||
relay-index-prebuild.condition = "service_completed_successfully";
|
||||
};
|
||||
networks = [ "internal" ];
|
||||
environmentFiles = [ config.age.secrets.buzz-env.path ];
|
||||
@@ -52,6 +54,7 @@ in
|
||||
BUZZ_MEDIA_BASE_URL = "https://${buzz.publicDomain}/media";
|
||||
BUZZ_MEDIA_SERVER_DOMAIN = buzz.publicDomain;
|
||||
BUZZ_CORS_ORIGINS = "https://${buzz.publicDomain}";
|
||||
BUZZ_PAIRING_RELAY_URL = "wss://${buzz.publicDomain}/pair";
|
||||
BUZZ_S3_ENDPOINT = "http://minio:9000";
|
||||
BUZZ_S3_REGION = "us-east-1";
|
||||
BUZZ_S3_ADDRESSING_STYLE = "path";
|
||||
@@ -70,9 +73,18 @@ in
|
||||
start_period = "30s";
|
||||
};
|
||||
};
|
||||
pair = {
|
||||
image = buzz.images.relay;
|
||||
networks = [ "internal" ];
|
||||
environment.BUZZ_PAIR_RELAY_BIND_ADDR = "0.0.0.0:${toString buzz.pairPort}";
|
||||
extraConfig.entrypoint = [ "/usr/local/bin/buzz-pair-relay" ];
|
||||
};
|
||||
caddy = {
|
||||
image = buzz.images.caddy;
|
||||
extraConfig.depends_on.relay.condition = "service_healthy";
|
||||
extraConfig.depends_on = {
|
||||
relay.condition = "service_healthy";
|
||||
pair.condition = "service_started";
|
||||
};
|
||||
networks = {
|
||||
internal = { };
|
||||
lan = { ipv4_address = buzz.ip; };
|
||||
@@ -81,7 +93,13 @@ in
|
||||
${buzz.publicDomain} {
|
||||
tls /etc/caddy/tls/fullchain.pem /etc/caddy/tls/key.pem
|
||||
encode zstd gzip
|
||||
reverse_proxy relay:${toString buzz.port}
|
||||
# Only /pair goes to the pairing service
|
||||
handle /pair {
|
||||
reverse_proxy pair:${toString buzz.pairPort}
|
||||
}
|
||||
handle {
|
||||
reverse_proxy relay:${toString buzz.port}
|
||||
}
|
||||
}
|
||||
http://${buzz.domain} {
|
||||
redir https://${buzz.publicDomain}{uri} permanent
|
||||
@@ -173,6 +191,47 @@ in
|
||||
};
|
||||
restart = "no";
|
||||
};
|
||||
relay-index-prebuild = {
|
||||
image = buzz.images.posgres;
|
||||
networks = [ "internal" ];
|
||||
environmentFiles = [ config.age.secrets.buzz-env.path ];
|
||||
environment = {
|
||||
POSTGRES_DB = "buzz";
|
||||
POSTGRES_USER = "buzz";
|
||||
};
|
||||
files."/usr/local/bin/prebuild-indexes.sh" = ''
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
export PGPASSWORD="$POSTGRES_PASSWORD"
|
||||
|
||||
run_psql() {
|
||||
psql -v ON_ERROR_STOP=1 -h postgres -U "$POSTGRES_USER" -d "$POSTGRES_DB" "$@"
|
||||
}
|
||||
|
||||
ensure_index() {
|
||||
name="$1"
|
||||
sql="$2"
|
||||
state=$(run_psql -tAc "SELECT coalesce((SELECT CASE WHEN i.indisvalid AND i.indisready AND i.indislive THEN 'valid' ELSE 'invalid' END FROM pg_index i WHERE i.indexrelid = to_regclass('public.$name')), 'missing')")
|
||||
if [ "$state" = valid ]; then
|
||||
return 0
|
||||
fi
|
||||
if [ "$state" = invalid ]; then
|
||||
run_psql -c "DROP INDEX CONCURRENTLY IF EXISTS public.$name"
|
||||
fi
|
||||
run_psql -c "$sql"
|
||||
}
|
||||
|
||||
ensure_index artifact_heads_modified "CREATE INDEX CONCURRENTLY artifact_heads_modified ON public.artifact_heads (community_id, modified_at, artifact_id);"
|
||||
ensure_index artifact_heads_channel "CREATE INDEX CONCURRENTLY artifact_heads_channel ON public.artifact_heads (community_id, channel_id, artifact_id);"
|
||||
ensure_index channel_members_sync "CREATE INDEX CONCURRENTLY channel_members_sync ON public.channel_members (community_id, pubkey, sync_modified_at, channel_id);"
|
||||
ensure_index artifact_revisions_moves "CREATE INDEX CONCURRENTLY artifact_revisions_moves ON public.artifact_revisions (community_id, modified_at, event_id) WHERE source_channel_id IS NOT NULL;"
|
||||
'';
|
||||
extraConfig = {
|
||||
entrypoint = [ "/bin/sh" "/usr/local/bin/prebuild-indexes.sh" ];
|
||||
depends_on.postgres.condition = "service_healthy";
|
||||
};
|
||||
restart = "no";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -12,5 +12,10 @@
|
||||
./iu.nix
|
||||
./audiobookshelf.nix
|
||||
./buzz.nix
|
||||
./linux-tracker.nix
|
||||
./otel-collector.nix
|
||||
./prometheus.nix
|
||||
./loki.nix
|
||||
./grafana.nix
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{ config, skyg-secrets, ... }:
|
||||
let
|
||||
ports = {
|
||||
grafana = 3001;
|
||||
prometheus = 9090;
|
||||
loki = 3100;
|
||||
};
|
||||
in
|
||||
{
|
||||
age.secrets.grafana-secret-key = {
|
||||
file = skyg-secrets.grafana-secret-key;
|
||||
owner = "grafana";
|
||||
group = "grafana";
|
||||
};
|
||||
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
|
||||
settings = {
|
||||
server = {
|
||||
http_addr = "0.0.0.0";
|
||||
http_port = ports.grafana;
|
||||
};
|
||||
security.secret_key = "$__(file){${config.age.secrets.grafana-secret-key.path}}";
|
||||
};
|
||||
|
||||
provision = {
|
||||
enable = true;
|
||||
datasources.settings.datasources = [
|
||||
{
|
||||
name = "Prometheus";
|
||||
type = "prometheus";
|
||||
access = "proxy";
|
||||
url = "http://127.0.0.1:${toString ports.prometheus}";
|
||||
isDefault = true;
|
||||
}
|
||||
{
|
||||
name = "Loki";
|
||||
type = "loki";
|
||||
access = "proxy";
|
||||
url = "http://127.0.0.1:${toString ports.loki}";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
services.skyg-linux-tracker = {
|
||||
enable = true;
|
||||
bind = "0.0.0.0";
|
||||
openFirewall = true;
|
||||
docker.enable = config.virtualisation.docker.enable;
|
||||
# Reachable only by its lab FQDN; the short name does not resolve.
|
||||
allowedHosts = [ "minipc1.lab.internal" ];
|
||||
# OTLP out to the collector on this box (see ./otel-collector.nix).
|
||||
settings.otel = {
|
||||
enabled = true;
|
||||
endpoint = "http://127.0.0.1:4317";
|
||||
protocol = "grpc";
|
||||
export_logs = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
{ ... }:
|
||||
let
|
||||
ports = {
|
||||
loki = 3100;
|
||||
grpc = 9096;
|
||||
};
|
||||
dataDir = "/var/lib/loki";
|
||||
in
|
||||
{
|
||||
services.loki = {
|
||||
enable = true;
|
||||
|
||||
# Single-binary Loki on the filesystem: no object store, no ring.
|
||||
configuration = {
|
||||
auth_enabled = false;
|
||||
|
||||
server = {
|
||||
http_listen_port = ports.loki;
|
||||
grpc_listen_port = ports.grpc;
|
||||
};
|
||||
|
||||
common = {
|
||||
instance_addr = "127.0.0.1";
|
||||
path_prefix = dataDir;
|
||||
replication_factor = 1;
|
||||
ring.kvstore.store = "inmemory";
|
||||
storage.filesystem = {
|
||||
chunks_directory = "${dataDir}/chunks";
|
||||
rules_directory = "${dataDir}/rules";
|
||||
};
|
||||
};
|
||||
|
||||
schema_config.configs = [
|
||||
{
|
||||
from = "2026-10-01";
|
||||
store = "tsdb";
|
||||
object_store = "filesystem";
|
||||
schema = "v13";
|
||||
index = {
|
||||
prefix = "index_";
|
||||
period = "24h";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
# The compactor is what enforces the 24h window below.
|
||||
compactor = {
|
||||
working_directory = "${dataDir}/compactor";
|
||||
retention_enabled = true;
|
||||
delete_request_store = "filesystem";
|
||||
};
|
||||
|
||||
limits_config = {
|
||||
retention_period = "24h";
|
||||
reject_old_samples = true;
|
||||
reject_old_samples_max_age = "168h";
|
||||
# Required for OTLP ingestion; on by default since 3.0.
|
||||
allow_structured_metadata = true;
|
||||
};
|
||||
|
||||
ruler = {
|
||||
storage.type = "local";
|
||||
storage.local.directory = "${dataDir}/rules";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Loki data lives on tnas1. Prometheus and Grafana stay on local disk, since
|
||||
# their databases do not work well on NFS.
|
||||
# The export must exist on the NAS and be writable by uid 985 / gid 981.
|
||||
# The mount is ordered after network-online so tnas1's name resolves at boot.
|
||||
fileSystems.${dataDir} = {
|
||||
device = "tnas1.lab.internal:/mnt/SmallG/monitoring/loki";
|
||||
fsType = "nfs";
|
||||
options = [
|
||||
"nfsvers=4.0"
|
||||
"hard"
|
||||
"noatime"
|
||||
"nofail"
|
||||
"_netdev"
|
||||
"x-systemd.automount"
|
||||
"x-systemd.requires=network-online.target"
|
||||
"x-systemd.after=network-online.target"
|
||||
];
|
||||
};
|
||||
systemd.services.loki.unitConfig.RequiresMountsFor = [ dataDir ];
|
||||
|
||||
# NFS ownership is numeric, so pin the ids instead of letting NixOS assign
|
||||
# them by name order (a new user sorting before "loki" would shift them).
|
||||
users.users.loki.uid = 985;
|
||||
users.groups.loki.gid = 981;
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ ports.loki ];
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
ports = {
|
||||
otlpGrpc = 4317;
|
||||
otlpHttp = 4318;
|
||||
# Loopback scrape target for the Prometheus below.
|
||||
metrics = 9464;
|
||||
};
|
||||
in
|
||||
{
|
||||
services.opentelemetry-collector = {
|
||||
enable = true;
|
||||
# The prometheus exporter is a contrib component, not core.
|
||||
package = pkgs.opentelemetry-collector-contrib;
|
||||
|
||||
settings = {
|
||||
receivers.otlp.protocols = {
|
||||
grpc.endpoint = "0.0.0.0:${toString ports.otlpGrpc}";
|
||||
http.endpoint = "0.0.0.0:${toString ports.otlpHttp}";
|
||||
};
|
||||
|
||||
processors.batch.timeout = "5s";
|
||||
|
||||
exporters = {
|
||||
# Pull endpoint. Resource attributes (host.name, service.name) only
|
||||
# become labels when conversion is enabled — off by default, which
|
||||
# would leave every host's series with an identical label set.
|
||||
prometheus = {
|
||||
endpoint = "127.0.0.1:${toString ports.metrics}";
|
||||
resource_to_telemetry_conversion.enabled = true;
|
||||
};
|
||||
# The contrib `loki` exporter was removed upstream; Loki ingests
|
||||
# OTLP/HTTP natively at /otlp instead.
|
||||
"otlphttp/loki".endpoint = "http://127.0.0.1:3100/otlp";
|
||||
nop = { };
|
||||
};
|
||||
|
||||
service.pipelines = {
|
||||
metrics = {
|
||||
receivers = [ "otlp" ];
|
||||
processors = [ "batch" ];
|
||||
exporters = [ "prometheus" ];
|
||||
};
|
||||
logs = {
|
||||
receivers = [ "otlp" ];
|
||||
processors = [ "batch" ];
|
||||
exporters = [ "otlphttp/loki" ];
|
||||
};
|
||||
# The tracker ships its own spans; nothing here stores them.
|
||||
traces = {
|
||||
receivers = [ "otlp" ];
|
||||
processors = [ "batch" ];
|
||||
exporters = [ "nop" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Only the OTLP listeners face the lab; 9464 stays on loopback.
|
||||
networking.firewall.allowedTCPPorts = [ ports.otlpGrpc ports.otlpHttp ];
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{ ... }:
|
||||
let
|
||||
ports = { prometheus = 9090; };
|
||||
in
|
||||
{
|
||||
services.prometheus = {
|
||||
enable = true;
|
||||
port = ports.prometheus;
|
||||
listenAddress = "0.0.0.0";
|
||||
retentionTime = "48h";
|
||||
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "lab-trackers";
|
||||
static_configs = [{ targets = [ "127.0.0.1:9464" ]; }];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ ports.prometheus ];
|
||||
}
|
||||
@@ -1,19 +1,15 @@
|
||||
{ pkgs, config, ... }:
|
||||
let
|
||||
staticIp = ip: {
|
||||
lan = { ipv4_address = ip; };
|
||||
};
|
||||
in
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./services
|
||||
./hardware-configuration
|
||||
./hardware.nix
|
||||
./systemd.nix
|
||||
];
|
||||
|
||||
skyg.user.enable = true;
|
||||
skyg.nixos.common.ssh-server.enable = true;
|
||||
skyg.nixos.common.diagnix.enable = true;
|
||||
skyg.nixos.common.dns.enable = true;
|
||||
skyg.nixos.common.containers.networks.ipvlanLab = {
|
||||
enable = true;
|
||||
parent = "enp2s0";
|
||||
@@ -23,8 +19,8 @@ in
|
||||
openFirewall = true;
|
||||
addressesSecretName = "dns-addresses.conf";
|
||||
};
|
||||
skyg.nixos.common.containers.openMetricsPort = true;
|
||||
skyg.server.exporters.enable = true;
|
||||
|
||||
|
||||
skyg.networkDrives.enable = true;
|
||||
|
||||
networking.firewall.enable = false;
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.fwupd.enable = true;
|
||||
}
|
||||
@@ -6,5 +6,7 @@
|
||||
./stack1.nix
|
||||
./stack2.nix
|
||||
./timers.nix
|
||||
./linux-tracker.nix
|
||||
./umami.nix
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
services.skyg-linux-tracker = {
|
||||
enable = true;
|
||||
bind = "0.0.0.0";
|
||||
openFirewall = true;
|
||||
docker.enable = config.virtualisation.docker.enable;
|
||||
# Reachable only by its lab FQDN; the short name does not resolve.
|
||||
allowedHosts = [ "minipc2.lab.internal" ];
|
||||
# OTLP out to the collector on minipc1.
|
||||
settings.otel = {
|
||||
enabled = true;
|
||||
endpoint = "http://minipc1.lab.internal:4317";
|
||||
protocol = "grpc";
|
||||
export_logs = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
{ config, ... }:
|
||||
{ config, skyg-secrets, ... }:
|
||||
let
|
||||
app = config.skyg.internalNetworkingMap.apps.nvr;
|
||||
in
|
||||
{
|
||||
age.secrets.scrypted-envs.file = skyg-secrets.scrypted-envs;
|
||||
skyg.nixos.common.container-services.scrypted = {
|
||||
enable = true;
|
||||
autoUpdate.enable = true;
|
||||
@@ -16,7 +17,11 @@ in
|
||||
"/opt/homelab/scrypted/db:/server/volume"
|
||||
"scrypted-nvr:/nvr"
|
||||
];
|
||||
devices = [ "/dev/dri:/dev/dri" ];
|
||||
environment.SCRYPTED_NVR_VOLUME = "/nvr";
|
||||
environmentFiles = [
|
||||
config.age.secrets.scrypted-envs.path
|
||||
];
|
||||
};
|
||||
volumes.scrypted-nvr = {
|
||||
driver = "local";
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
{ config, skyg-secrets, ... }:
|
||||
# Umami collects LoopRail's telemetry. Caddy on minipc3 sends it the public
|
||||
# POST looprails.skyg.ca/t/v1 and the LAN-only dashboard. It runs in its own
|
||||
# nspawn container with its own LAN address, and only Caddy can reach it.
|
||||
let
|
||||
app = config.skyg.internalNetworkingMap.apps.umami;
|
||||
caddy = config.skyg.internalNetworkingMap.apps.caddy;
|
||||
appNetwork = config.skyg.internalNetworkingMap.appNetwork;
|
||||
parent = config.skyg.nixos.common.containers.networks.ipvlanLab.parent;
|
||||
# nspawn names the ipvlan link iv-<parent>.
|
||||
lanIf = "iv-${parent}";
|
||||
port = 3000;
|
||||
secretPath = "/run/secrets/umami-app-secret";
|
||||
hostStateVersion = config.system.stateVersion;
|
||||
in
|
||||
{
|
||||
age.secrets.umami-app-secret.file = skyg-secrets.umami-app-secret;
|
||||
|
||||
containers.umami = {
|
||||
autoStart = true;
|
||||
# Own network: an ipvlan link on the LAN, like the docker apps get.
|
||||
privateNetwork = true;
|
||||
extraFlags = [ "--network-ipvlan=${parent}" ];
|
||||
bindMounts.${secretPath} = {
|
||||
hostPath = config.age.secrets.umami-app-secret.path;
|
||||
isReadOnly = true;
|
||||
};
|
||||
|
||||
config = { lib, ... }: {
|
||||
system.stateVersion = hostStateVersion;
|
||||
|
||||
networking = {
|
||||
useDHCP = false;
|
||||
interfaces.${lanIf}.ipv4.addresses = [{
|
||||
address = app.ip;
|
||||
prefixLength = lib.toInt (lib.last (lib.splitString "/" appNetwork.subnet));
|
||||
}];
|
||||
defaultGateway = { address = appNetwork.gateway; interface = lanIf; };
|
||||
nftables.enable = true;
|
||||
firewall = {
|
||||
enable = true;
|
||||
# Only Caddy may reach Umami, at most ~20 new connections a second.
|
||||
# Caddy opens one connection per telemetry request, so this caps requests.
|
||||
extraInputRules = ''
|
||||
ip saddr ${caddy.ip} tcp dport ${toString port} ct state new limit rate 20/second burst 100 packets accept
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# Postgres only on its local socket.
|
||||
services.postgresql.settings.listen_addresses = lib.mkForce "";
|
||||
|
||||
services.umami = {
|
||||
enable = true;
|
||||
createPostgresqlDatabase = true;
|
||||
settings = {
|
||||
APP_SECRET_FILE = secretPath;
|
||||
HOSTNAME = "0.0.0.0";
|
||||
PORT = port;
|
||||
DISABLE_UPDATES = true;
|
||||
DISABLE_TELEMETRY = true;
|
||||
# looprail's User-Agent would look like a bot.
|
||||
DISABLE_BOT_CHECK = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# A flood can't starve the rest of the host.
|
||||
systemd.services."container@umami".serviceConfig = {
|
||||
MemoryMax = "1G";
|
||||
CPUQuota = "100%";
|
||||
};
|
||||
}
|
||||
@@ -2,4 +2,8 @@
|
||||
{
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
services.journald.extraConfig = ''
|
||||
SystemMaxUse=1G
|
||||
'';
|
||||
}
|
||||
@@ -2,20 +2,21 @@
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration
|
||||
./hardware.nix
|
||||
./systemd.nix
|
||||
./services
|
||||
];
|
||||
|
||||
skyg.user.enable = true;
|
||||
skyg.nixos.common.ssh-server.enable = true;
|
||||
skyg.nixos.common.diagnix.enable = true;
|
||||
skyg.nixos.common.dns.enable = true;
|
||||
skyg.server.dns.routing = {
|
||||
enable = false;
|
||||
openFirewall = true;
|
||||
addressesSecretName = "dns-addresses.conf";
|
||||
};
|
||||
skyg.nixos.common.containers.openMetricsPort = true;
|
||||
skyg.server.exporters.enable = true;
|
||||
|
||||
|
||||
skyg.nixos.server.k3s = {
|
||||
enable = true;
|
||||
envPath = "/opt/k3s/k3s.env";
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.fwupd.enable = true;
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
{
|
||||
layer4 {
|
||||
:22 {
|
||||
route {
|
||||
proxy {$GITEA_IP}:22
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Common: the wildcard cert.
|
||||
(shared) {
|
||||
tls /etc/caddy/tls/fullchain.pem /etc/caddy/tls/key.pem
|
||||
}
|
||||
|
||||
# Only LAN (10/8) + Tailscale clients. Others get dropped.
|
||||
(lan_only) {
|
||||
import shared
|
||||
@notlan not remote_ip 10.0.0.0/8 100.64.0.0/10
|
||||
abort @notlan
|
||||
}
|
||||
|
||||
# Open to anyone who can reach caddy.
|
||||
(public_access) {
|
||||
import shared
|
||||
}
|
||||
|
||||
nvr.home.sosnovsky.ca {
|
||||
import lan_only
|
||||
reverse_proxy {$NVR_IP}:11080
|
||||
}
|
||||
|
||||
jellyfin.home.sosnovsky.ca {
|
||||
import public_access
|
||||
reverse_proxy {$JELLYFIN_IP}:8096
|
||||
}
|
||||
|
||||
castle.home.sosnovsky.ca {
|
||||
import public_access
|
||||
reverse_proxy castle.hub.internal
|
||||
}
|
||||
|
||||
immich.home.sosnovsky.ca {
|
||||
import lan_only
|
||||
reverse_proxy {$IMMICH_IP}:2283
|
||||
}
|
||||
|
||||
portainer.home.sosnovsky.ca {
|
||||
import lan_only
|
||||
reverse_proxy {$PORTAINER_IP}:9000
|
||||
}
|
||||
|
||||
gitea.skyg.ca {
|
||||
tls /etc/caddy/tls/gitea/fullchain.pem /etc/caddy/tls/gitea/key.pem
|
||||
reverse_proxy {$GITEA_IP}:80
|
||||
}
|
||||
|
||||
looprails.skyg.ca {
|
||||
tls /etc/caddy/tls/gitea/fullchain.pem /etc/caddy/tls/gitea/key.pem
|
||||
|
||||
# Telemetry: only looprail's own requests reach Umami.
|
||||
@telemetry {
|
||||
method POST
|
||||
path /t/v1
|
||||
header Content-Type application/json*
|
||||
header User-Agent looprail/*
|
||||
header X-Looprail-Telemetry {$LOOPRAIL_TELEMETRY_KEY}
|
||||
}
|
||||
handle @telemetry {
|
||||
request_body {
|
||||
max_size 256KB
|
||||
}
|
||||
rewrite * /api/batch
|
||||
reverse_proxy {$UMAMI_IP}:3000 {
|
||||
# Umami never sees the sender's IP.
|
||||
header_up -X-Forwarded-For
|
||||
header_up -X-Real-IP
|
||||
header_up -Forwarded
|
||||
header_up -CF-Connecting-IP
|
||||
header_up -True-Client-IP
|
||||
header_up -X-Client-IP
|
||||
header_up -X-Looprail-Telemetry
|
||||
# One connection per request, so Umami's rate limit counts requests.
|
||||
transport http {
|
||||
keepalive off
|
||||
}
|
||||
}
|
||||
}
|
||||
handle /t/* {
|
||||
respond 404
|
||||
}
|
||||
|
||||
handle {
|
||||
root * /srv/looprails
|
||||
redir /looprail.html / permanent
|
||||
file_server
|
||||
}
|
||||
}
|
||||
|
||||
# Umami dashboard for LoopRail telemetry, LAN only.
|
||||
umami.home.sosnovsky.ca {
|
||||
import lan_only
|
||||
reverse_proxy {$UMAMI_IP}:3000
|
||||
}
|
||||
|
||||
# Buzz: straight to its own caddy, LAN only.
|
||||
buzz.home.sosnovsky.ca {
|
||||
import lan_only
|
||||
reverse_proxy https://{$BUZZ_IP}:443 {
|
||||
header_up Host {http.request.host}
|
||||
transport http {
|
||||
tls
|
||||
tls_server_name {http.request.host}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Fallback: any other *.home.sosnovsky.ca host goes to the k8s Traefik.
|
||||
# Host + SNI are preserved so Traefik routes on the original hostname.
|
||||
*.home.sosnovsky.ca {
|
||||
import lan_only
|
||||
reverse_proxy https://{$K8S_INGRESS}:443 {
|
||||
header_up Host {http.request.host}
|
||||
transport http {
|
||||
tls
|
||||
tls_server_name {http.request.host}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
orderBefore = [ "container-services-caddy" ];
|
||||
};
|
||||
certs."gitea.skyg.ca" = {
|
||||
extraDomains = [ "looprails.skyg.ca" ];
|
||||
postRun = "${pkgs.docker}/bin/docker restart caddy-caddy-1";
|
||||
orderBefore = [ "container-services-caddy" ];
|
||||
};
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
{ config, ... }:
|
||||
{ config, looprail, pkgs, ... }:
|
||||
let
|
||||
looprailPackages = looprail.packages.${pkgs.stdenv.hostPlatform.system};
|
||||
app = config.skyg.internalNetworkingMap.apps.caddy;
|
||||
nvr = config.skyg.internalNetworkingMap.apps.nvr;
|
||||
jellyfin = config.skyg.internalNetworkingMap.apps.jellyfin;
|
||||
immich = config.skyg.internalNetworkingMap.apps.immich;
|
||||
portainer = config.skyg.internalNetworkingMap.apps.portainer;
|
||||
buzz = config.skyg.internalNetworkingMap.apps.buzz;
|
||||
publicGitea = config.skyg.internalNetworkingMap.apps.public-gitea;
|
||||
umami = config.skyg.internalNetworkingMap.apps.umami;
|
||||
# Sent by release looprail binaries on telemetry posts. It ships in the
|
||||
# binary, so it only filters out scanners; it is not a secret.
|
||||
looprailTelemetryKey = "70c685d238cc9ec7229e557a8de7b0d25527b1a402805251";
|
||||
certDomain = "home.sosnovsky.ca";
|
||||
giteaCertDomain = "gitea.skyg.ca";
|
||||
# k8s Traefik ingress — fallback for hosts caddy doesn't handle itself.
|
||||
@@ -18,53 +24,30 @@ in
|
||||
networks.lan = config.skyg.nixos.common.containers.networks.ipvlanLab.compose;
|
||||
services.caddy = {
|
||||
image = "livekit/caddyl4:v2.11.3";
|
||||
extraConfig.entrypoint = [ "caddy" ];
|
||||
extraConfig = {
|
||||
entrypoint = [ "caddy" ];
|
||||
dns = [ config.skyg.internalNetworkingMap.appNetwork.gateway ];
|
||||
};
|
||||
command = [ "run" "--config" "/etc/caddy/Caddyfile" "--adapter" "caddyfile" ];
|
||||
networks.lan.ipv4_address = app.ip;
|
||||
files."/etc/caddy/Caddyfile" = ''
|
||||
{
|
||||
layer4 {
|
||||
:22 {
|
||||
route {
|
||||
proxy ${publicGitea.ip}:22
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
nvr.home.sosnovsky.ca {
|
||||
tls /etc/caddy/tls/fullchain.pem /etc/caddy/tls/key.pem
|
||||
reverse_proxy ${nvr.ip}:11080
|
||||
}
|
||||
jellyfin.home.sosnovsky.ca {
|
||||
tls /etc/caddy/tls/fullchain.pem /etc/caddy/tls/key.pem
|
||||
reverse_proxy bigbox1.lab.internal:8096
|
||||
}
|
||||
immich.home.sosnovsky.ca {
|
||||
tls /etc/caddy/tls/fullchain.pem /etc/caddy/tls/key.pem
|
||||
reverse_proxy ${immich.ip}:2283
|
||||
}
|
||||
portainer.home.sosnovsky.ca {
|
||||
tls /etc/caddy/tls/fullchain.pem /etc/caddy/tls/key.pem
|
||||
reverse_proxy ${portainer.ip}:9000
|
||||
}
|
||||
gitea.skyg.ca {
|
||||
tls /etc/caddy/tls/gitea/fullchain.pem /etc/caddy/tls/gitea/key.pem
|
||||
reverse_proxy ${publicGitea.ip}:80
|
||||
}
|
||||
# Fallback: any other *.home.sosnovsky.ca host goes to the k8s Traefik.
|
||||
# Host + SNI are preserved so Traefik routes on the original hostname.
|
||||
*.home.sosnovsky.ca {
|
||||
tls /etc/caddy/tls/fullchain.pem /etc/caddy/tls/key.pem
|
||||
reverse_proxy https://${k8sIngress}:443 {
|
||||
header_up Host {http.request.host}
|
||||
transport http {
|
||||
tls
|
||||
tls_server_name {http.request.host}
|
||||
}
|
||||
}
|
||||
}
|
||||
'';
|
||||
# Routes live in ./Caddyfile; IPs come in as env vars.
|
||||
files."/etc/caddy/Caddyfile" = builtins.readFile ./Caddyfile;
|
||||
environment = {
|
||||
GITEA_IP = publicGitea.ip;
|
||||
NVR_IP = nvr.ip;
|
||||
IMMICH_IP = immich.ip;
|
||||
PORTAINER_IP = portainer.ip;
|
||||
JELLYFIN_IP = jellyfin.ip;
|
||||
BUZZ_IP = buzz.ip;
|
||||
UMAMI_IP = umami.ip;
|
||||
LOOPRAIL_TELEMETRY_KEY = looprailTelemetryKey;
|
||||
K8S_INGRESS = k8sIngress;
|
||||
};
|
||||
volumes = [
|
||||
(if looprailPackages ? looprail-site then
|
||||
"${looprailPackages.looprail-site}:/srv/looprails:ro"
|
||||
else
|
||||
"${looprail}/docs/looprail.html:/srv/looprails/index.html:ro")
|
||||
"/var/lib/acme/${certDomain}/fullchain.pem:/etc/caddy/tls/fullchain.pem:ro"
|
||||
"/var/lib/acme/${certDomain}/key.pem:/etc/caddy/tls/key.pem:ro"
|
||||
"/var/lib/acme/${giteaCertDomain}/fullchain.pem:/etc/caddy/tls/gitea/fullchain.pem:ro"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
imports = [
|
||||
./caddy.nix
|
||||
./acme.nix
|
||||
./linux-tracker.nix
|
||||
# ./buildbot.nix
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
services.skyg-linux-tracker = {
|
||||
enable = true;
|
||||
bind = "0.0.0.0";
|
||||
openFirewall = true;
|
||||
docker.enable = config.virtualisation.docker.enable;
|
||||
# Reachable only by its lab FQDN; the short name does not resolve.
|
||||
allowedHosts = [ "minipc3.lab.internal" ];
|
||||
# OTLP out to the collector on minipc1.
|
||||
settings.otel = {
|
||||
enabled = true;
|
||||
endpoint = "http://minipc1.lab.internal:4317";
|
||||
protocol = "grpc";
|
||||
export_logs = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
minimal = true;
|
||||
fonts.minimal = true;
|
||||
ssh-server.enable = true;
|
||||
diagnix.enable = true;
|
||||
containers.enable = false;
|
||||
networking.nfsServer.enable = false;
|
||||
hardware.pipewire.enable = true;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
user.enable = true;
|
||||
nixos = {
|
||||
common.ssh-server.enable = true;
|
||||
common.diagnix.enable = true;
|
||||
common.hardware.pipewire.enable = true;
|
||||
desktop = {
|
||||
enable = true;
|
||||
|
||||
@@ -15,12 +15,12 @@ in
|
||||
imports = [
|
||||
./services.nix
|
||||
./hardware-configuration
|
||||
./hardware.nix
|
||||
./systemd.nix
|
||||
];
|
||||
|
||||
skyg.user.enable = true;
|
||||
skyg.nixos.common.ssh-server.enable = true;
|
||||
skyg.nixos.common.diagnix.enable = true;
|
||||
skyg.server.dns.routing = {
|
||||
enable = false;
|
||||
openFirewall = true;
|
||||
@@ -28,8 +28,6 @@ in
|
||||
};
|
||||
skyg.nixos.desktop.enable = false;
|
||||
skyg.server.admin.enable = true;
|
||||
skyg.server.exporters.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [ btrfs-progs ];
|
||||
|
||||
networking.firewall.allowedUDPPorts = openPorts;
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.fwupd.enable = true;
|
||||
}
|
||||
@@ -1,6 +1,20 @@
|
||||
{ ... }:
|
||||
{
|
||||
skyg.nixos.common.networking.nfsServer.enable = true;
|
||||
services.skyg-linux-tracker = {
|
||||
enable = true;
|
||||
bind = "0.0.0.0";
|
||||
openFirewall = true;
|
||||
# Reachable only by its lab FQDN; the short name does not resolve.
|
||||
allowedHosts = [ "terra1.lab.internal" ];
|
||||
# OTLP out to the collector on minipc1.
|
||||
settings.otel = {
|
||||
enabled = true;
|
||||
endpoint = "http://minipc1.lab.internal:4317";
|
||||
protocol = "grpc";
|
||||
export_logs = true;
|
||||
};
|
||||
};
|
||||
services.nfs.server = {
|
||||
lockdPort = 4001;
|
||||
mountdPort = 4002;
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ All reusable NixOS and Home Manager modules. Every host gets the full module tre
|
||||
```
|
||||
modules/
|
||||
├── lib.nix # makeNixOs / makeIso / makeHomeManagerUsers / makeDarwinModule / eachSystem
|
||||
│ # (registers flake-input NixOS modules: tether → programs.tether.*,
|
||||
│ # (registers flake-input NixOS modules:
|
||||
│ # hhstream → services.hyprland-headless-stream)
|
||||
├── main.nix # Base module imported by every host: core/ + nixos/ + network-drives.nix
|
||||
│ # + skyg.internalNetworkingMap (global app registry + appNetwork)
|
||||
@@ -23,7 +23,7 @@ modules/
|
||||
│ ├── common/ # Core system settings, networking, SSH, QEMU, fonts, hardware
|
||||
│ ├── server/ # Server services: K3s/K8s, DNS, AI stack, ARRs, media…
|
||||
│ └── desktop/ # Desktop: tiler (niri/hyprland), packages, theming, crypto
|
||||
└── openwrt/ # OpenWrt router config generator
|
||||
├── openwrt/ # OpenWrt router config generator
|
||||
```
|
||||
|
||||
## Option Namespace
|
||||
|
||||
@@ -28,7 +28,8 @@ core/
|
||||
- **Substituters** (`nix-substituters.nix`): the standing list of caches (local `minipc1`
|
||||
and `bigbox2` caches, cache.nixos.org, cachix caches for cuda/cosmic/ai/noctalia/nixarchy,
|
||||
flox, devenv) and the trusted public keys. Extra entries can be appended per-host via
|
||||
`skyg.core.substituters.{urls,keys}`.
|
||||
`skyg.core.substituters.{urls,keys}`. Also sets `http-connections = 8` and
|
||||
`download-attempts = 10` so flaky links (Wi-Fi) don't disable cache.nixos.org mid-build.
|
||||
- **Lab CA trust** (`lab-ca.nix`): adds `configs/pki/lab-ca.crt` to
|
||||
`security.pki.certificateFiles` so every machine trusts the lab internal CA
|
||||
(created by `skyg ca init`, see `configs/pki/ABOUTME.md`). Eval fails if the
|
||||
|
||||
@@ -22,12 +22,16 @@
|
||||
# colibrì (JustVugg/colibri) — GLM-5.2/OLMoE local inference, see pkgs/colibri.
|
||||
colibri = final.callPackage ../../pkgs/colibri { };
|
||||
colibri-rocm = final.callPackage ../../pkgs/colibri { backend = "rocm"; };
|
||||
# llama.cpp v0.8.0 with DFlash2 speculative decoding, see pkgs/llama-cpp.
|
||||
llama-cpp-halo = final.callPackage ../../pkgs/llama-cpp { };
|
||||
llama-cpp-halo-cpu = final.callPackage ../../pkgs/llama-cpp { backend = "cpu"; };
|
||||
llama-cpp-cuda = final.callPackage ../../pkgs/llama-cpp { backend = "cuda"; };
|
||||
# Touchscreen gesture bridge for niri, see pkgs/niri-touchscreen-gestures.
|
||||
niri-touchscreen-gestures = final.callPackage ../../pkgs/niri-touchscreen-gestures { };
|
||||
# Buzz Desktop AppImage wrapper, see pkgs/buzz-desktop.
|
||||
buzz-desktop = final.callPackage ../../pkgs/buzz-desktop { };
|
||||
# Superset Desktop AppImage wrapper, see pkgs/superset-desktop.
|
||||
superset-desktop = final.callPackage ../../pkgs/superset-desktop { };
|
||||
# Buzz CLI (`buzz`), built from source, see pkgs/buzz-cli.
|
||||
buzz-cli = final.callPackage ../../pkgs/buzz-cli { };
|
||||
# Delta Editor (Zed Industries) prebuilt tarball, see pkgs/delta-editor.
|
||||
delta-editor = final.callPackage ../../pkgs/delta-editor { };
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ in
|
||||
"cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M="
|
||||
] ++ cfg.keys;
|
||||
nix.settings.trusted-users = [ "root" skygUser.name ];
|
||||
nix.settings.http-connections = 8;
|
||||
nix.settings.download-attempts = 10;
|
||||
nix.extraOptions = ''
|
||||
# Ensure we can still build when missing-server is not accessible
|
||||
fallback = true
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@ let
|
||||
colibri = final.callPackage ../pkgs/colibri { };
|
||||
niri-touchscreen-gestures = final.callPackage ../pkgs/niri-touchscreen-gestures { };
|
||||
buzz-desktop = final.callPackage ../pkgs/buzz-desktop { };
|
||||
superset-desktop = final.callPackage ../pkgs/superset-desktop { };
|
||||
buzz-cli = final.callPackage ../pkgs/buzz-cli { };
|
||||
delta-editor = final.callPackage ../pkgs/delta-editor { };
|
||||
})
|
||||
];
|
||||
@@ -49,8 +49,8 @@ let
|
||||
specialArgs.dank-greeter.nixosModules.default
|
||||
specialArgs.nix-index-database.nixosModules.nix-index
|
||||
specialArgs.hermes-agent.nixosModules.default
|
||||
specialArgs.tether.nixosModules.default
|
||||
specialArgs.hhstream.nixosModules.default
|
||||
specialArgs.skyg-linux-tracker.nixosModules.default
|
||||
{ programs.nix-index-database.comma.enable = true; }
|
||||
];
|
||||
makeHomeConfig = {}: import ./home { };
|
||||
|
||||
@@ -111,6 +111,8 @@ in
|
||||
public-gitea = { ip = "10.0.101.9"; };
|
||||
immich = { ip = "10.0.101.10"; };
|
||||
immich-ml = { ip = "10.0.101.11"; };
|
||||
gilix = { ip = "10.0.101.13"; };
|
||||
umami = { ip = "10.0.101.14"; };
|
||||
jellyfin = { ip = "10.0.101.5"; };
|
||||
nvr = { ip = "10.0.101.6"; };
|
||||
portainer = { ip = "10.0.101.241"; };
|
||||
@@ -122,6 +124,8 @@ in
|
||||
"portainer.home.sosnovsky.ca"
|
||||
"immich.home.sosnovsky.ca"
|
||||
"gitea.skyg.ca"
|
||||
"looprails.skyg.ca"
|
||||
"umami.home.sosnovsky.ca"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ nixos/
|
||||
skyg.nixos.common.* → common/
|
||||
skyg.nixos.desktop.* → desktop/
|
||||
skyg.nixos.server.* → server/ (most services)
|
||||
skyg.server.* → server/ (arrs, admin, exporters, timers, dns — legacy prefix)
|
||||
skyg.server.* → server/ (arrs, admin, timers, dns — legacy prefix)
|
||||
skyg.core.qemu.* → common/qemu.nix
|
||||
```
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ common/
|
||||
├── user.nix # skyg.user.createSystemUser — creates the system user/groups + zsh shell
|
||||
├── fonts.nix # System font packages + fontconfig defaults (Fira Code, Noto, …); skyg.nixos.common.fonts.minimal
|
||||
├── ssh-server.nix # skyg.nixos.common.ssh-server — hardened sshd + master public keys (list)
|
||||
├── diagnix/ # skyg.nixos.common.diagnix — read-only user nbot uses to diagnose hosts
|
||||
|
||||
├── qemu.nix # skyg.core.qemu — QEMU/quickemu + SPICE guest tooling
|
||||
├── binary-cache.nix # skyg.nixos.common.cachePush — push finished builds to the bigbox2 cache
|
||||
@@ -38,6 +39,23 @@ common/
|
||||
- **`ssh-server.nix`** ships the master public keys (`masterPubKeys`, a list so a key can be
|
||||
rotated by adding the new one before dropping the old) and a hardened sshd config
|
||||
(key-only auth, long keepalives). Disabled by default.
|
||||
- **`diagnix/`** adds a read-only `diagnix` user (uid 2950) that nbot uses over SSH, via
|
||||
`lab-ssh` in the agent system (`server/services/nbot-agent.nix`). It reads logs
|
||||
(`systemd-journal` group), units, `/proc` and the store, and can't change anything. It
|
||||
can't read root-only files. Through sudo it can run only the fixed `diag-*` scripts
|
||||
(docker ps/logs, smart, ports, firewall, btrfs, io, pstore). The key is `restrict,pty` and only
|
||||
works from the nbot hosts (`hosts.nix`). `diag-pstore` prints the kernel's saved crash
|
||||
records from `/sys/fs/pstore` (root-only), the one trace a hard freeze can leave behind.
|
||||
The hermenix VM has its own key (`hosts.nix` → `hermenix`), with the same limits, accepted
|
||||
only from hl-fwdesk's addresses (the VM is NAT'ed out of fwdesk). Turn it off per host
|
||||
with `skyg.nixos.common.diagnix.hermenix.enable = false`. fwdesk's `hermenix.nix` lets
|
||||
the VM reach port 22 on `10.0.10.0/24`. Hosts running nbot also let their own containers
|
||||
reach port 22 and accept them from private IPs outside the LAN. Their IPs are random, so
|
||||
they can't be listed. Resources are capped (1G memory, 1 CPU, 256 tasks). The Nix daemon
|
||||
is left open on purpose: an allow-list would break nix-serve/buildbot.
|
||||
The private key (base64) is `DIAGNIX_KEY` in the `nbot-goose` secret; fwdesk passes it to
|
||||
every container via `agent_env`.
|
||||
`hosts.nix` also holds each host's address and host key; the agent pins those keys.
|
||||
|
||||
## Option Namespace
|
||||
|
||||
@@ -46,6 +64,7 @@ skyg.core.hostName → networking.nix
|
||||
skyg.user.createSystemUser → user.nix
|
||||
skyg.core.qemu.* → qemu.nix
|
||||
skyg.nixos.common.ssh-server.* → ssh-server.nix
|
||||
skyg.nixos.common.diagnix.* → diagnix/
|
||||
|
||||
skyg.nixos.common.cachePush.* → binary-cache.nix
|
||||
skyg.nixos.common.minimal → core.nix (skip heavy always-on system packages)
|
||||
|
||||
Loaded 100 of 183 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user