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.