full deprecation

This commit is contained in:
ari committed 2026-10-16 15:07:11 -04:00
1 parent a8fa1f83af
commit 1e6cf7251f
11 files changed
+130 -212

No files matched your search

+91 -117
View File
@@ -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.
+3 -3
View File
@@ -7,14 +7,14 @@ 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`
├── pkgs.nu # `skyg pkgs update`
├── flake.nu # `skyg flake update/check/check-versions`
-4
View File
@@ -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"
-59
View File
@@ -29,62 +29,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
}
+5
View File
@@ -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
Generated
+4 -4
View File
@@ -3221,11 +3221,11 @@
]
},
"locked": {
"lastModified": 1791000487,
"narHash": "sha256-47Zz59CN0ugQF2i4RP1jN8U+QWlmnyhJKxcEUMTotEI=",
"lastModified": 1792175309,
"narHash": "sha256-Z4ywYzinnBQDhO1hexUdpJ034sRULeFLESR/+1eW8dw=",
"ref": "refs/heads/main",
"rev": "cee938adb9a9810432672331cd481b8870ef6f6b",
"revCount": 32,
"rev": "10ffe765b03e1c038107f65d8ce01f992d85d83e",
"revCount": 34,
"type": "git",
"url": "ssh://gitea@gitea.app.internal:22/ari/skygqts.git"
},
@@ -174,7 +174,7 @@ Notes:
- `env_file:` entries in the external file resolve **relative to**
`/var/lib/container-services/<group>/`. Use absolute paths (e.g. another
agenix secret path) or inline `environment:` instead.
- Create the secret with `skyg encrypt <secret-name>`.
- Create the secret with `skyg secrets edit <secret-name>`.
---
@@ -221,7 +221,7 @@ group starts; groups only reference it (`external: true`) and never create it.
Internal DNS names are declared centrally in `skyg.internalNetworkingMap` (see
`modules/main.nix`), not per service. Each app gets an internal name (`<name>` + `rootDns`,
e.g. `drawdb.app.internal`) and an optional public alias, and the flake renders them into
the OpenWrt router's `dnsmasq.conf` via `skyg openwrt`. **Nothing is configured on the host.**
the OpenWrt router's `dnsmasq.conf` via `skyg build openwrt`. **Nothing is configured on the host.**
```nix
# modules/main.nix
@@ -247,8 +247,8 @@ Verify and deploy:
```sh
nix eval .#dnsRecords --json | jq # every record
skyg openwrt --dry-run # render dnsmasq.conf locally
skyg openwrt # diff + confirm + apply
skyg build openwrt --dry-run # render dnsmasq.conf locally
skyg build openwrt # diff + confirm + apply
```
---
+6 -5
View File
@@ -5,27 +5,28 @@ by the Rust-based generator in `modules/openwrt/generator/`.
## Contents
| File | Description |
|---|---|
| File | Description |
| ------------ | --------------------------------------------------------------------- |
| `glmain.nix` | Configuration for the `glmain` GL.iNet router (gateway at `10.0.0.1`) |
## How It Works
1. `glmain.nix` declares the router's network topology, firewall zones, DHCP, and DNS in Nix
2. `modules/openwrt/default.nix` passes it through the generator binary
3. `skyg openwrt` SSHes to the router and applies the generated UCI config
3. `skyg build openwrt` SSHes to the router and applies the generated UCI config
## Deploying
```bash
skyg openwrt
skyg build openwrt # diff + confirm + apply
skyg build openwrt --dry-run # render to .tmp/openwrt-<router>/ only
```
## Adding a New Router
1. Create `openwrt-routers/<name>.nix` modelled on `glmain.nix`
2. Add a `openwrt-<name>` package output in `flake.nix` using the `openwrt` helper
3. Add a deploy target in `bin/lib/cmds.nu`
3. Deploy with `skyg build openwrt <name>` (router names tab-complete from `openwrt-routers/*.nix`)
## Notes
+2 -2
View File
@@ -59,7 +59,7 @@ age -d secrets/glmain.json.age | openwrt-deploy
is passed as a command-line argument (default `glmain`).
```bash
skyg openwrt --dry-run
skyg build openwrt --dry-run
# → .tmp/openwrt-glmain/dnsmasq.conf
# → .tmp/openwrt-glmain/dns-records.json # the Nix-rendered internalNetworkingMap fragment merged in
# → .tmp/openwrt-glmain/ethers
@@ -67,7 +67,7 @@ skyg openwrt --dry-run
```
Use this to inspect what a deploy _would_ do (especially the firewall rules) before running
the real `skyg openwrt`.
the real `skyg build openwrt`.
`router.ip` / `router.user` are taken from the `config` passed into `default.nix`.
+6 -5
View File
@@ -5,27 +5,28 @@ by the Rust-based generator in `modules/openwrt/generator/`.
## Contents
| File | Description |
|---|---|
| File | Description |
| ------------ | --------------------------------------------------------------------- |
| `glmain.nix` | Configuration for the `glmain` GL.iNet router (gateway at `10.0.0.1`) |
## How It Works
1. `glmain.nix` declares the router's network topology, firewall zones, DHCP, and DNS in Nix
2. `modules/openwrt/default.nix` passes it through the generator binary
3. `skyg openwrt` SSHes to the router and applies the generated UCI config
3. `skyg build openwrt` SSHes to the router and applies the generated UCI config
## Deploying
```bash
skyg openwrt
skyg build openwrt # diff + confirm + apply
skyg build openwrt --dry-run # render to .tmp/openwrt-<router>/ only
```
## Adding a New Router
1. Create `openwrt-routers/<name>.nix` modelled on `glmain.nix`
2. Add a `openwrt-<name>` package output in `flake.nix` using the `openwrt` helper
3. Add a deploy target in `bin/lib/cmds.nu`
3. Deploy with `skyg build openwrt <name>` (router names tab-complete from `openwrt-routers/*.nix`)
## Notes
+9 -9
View File
@@ -33,27 +33,27 @@ Editing them outside of `agenix` will corrupt the secret.
```bash
# List known secret names
skyg secrets
skyg secrets list
# Decrypt a secret for editing (writes .tmp/unencrypted-<name>)
skyg decrypt dns-addresses.conf
skyg secrets show dns-addresses.conf
# Re-encrypt after editing (reads .tmp/unencrypted-<name> by default)
skyg encrypt dns-addresses.conf
# Edit and re-encrypt (reads .tmp/unencrypted-<name> by default)
skyg secrets edit dns-addresses.conf
# Verify your working copy matches the stored secret
skyg compare-secret dns-addresses.conf
skyg secrets compare dns-addresses.conf
```
**Re-keying** (e.g. after adding a host key to `secrets.nix`): there is no bulk
re-key command — for each affected secret run `skyg decrypt <name>` followed by
`skyg encrypt <name>` to re-encrypt it against the updated key set.
re-key command — for each affected secret run `skyg secrets show <name>` followed by
`skyg secrets edit <name>` to re-encrypt it against the updated key set.
## Adding a New Secret
1. Add the `.age` filename and authorized public keys to `secrets.nix`
2. Create the plaintext in `.tmp/unencrypted-<name>` (or pass `--source <file>`) and run
`skyg encrypt <name>` (add `--yaml` to validate YAML before encrypting)
2. Create the plaintext in `.tmp/unencrypted-<name>` (or pass a file: `skyg secrets edit <name> <file>`) and run
`skyg secrets edit <name>` (add `--yaml` to validate YAML before encrypting)
3. Reference it in a module via `config.age.secrets.<name>.path`
See `docs/agenix.md` for the full workflow reference.