cleaner cli + pkg update
This commit is contained in:
1 parent
58e0705aca
commit
6fbdcf44cf
19 files changed
+590
-424
No files matched your search
@@ -6,20 +6,21 @@ My comprehensive Nix configurations for managing multiple hosts, including local
|
||||
|
||||
```
|
||||
nixos-setup/
|
||||
├── bin/
|
||||
│ └── skyg # Main CLI tool for managing NixOS configurations
|
||||
├── configs/ # Application-specific configurations
|
||||
├── pkgs/ # Custom packages (niri-touchscreen-gestures, grok-cli)
|
||||
├── hosts/ # Host-specific NixOS configurations
|
||||
│ ├── *.nix # Host configuration files (fwbook, hl-bigbox1, hl-minipc*, etc.)
|
||||
│ ├── *.hardware-configuration.nix # Hardware-specific configurations
|
||||
│ └── scripts/ # Host-specific scripts
|
||||
├── 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
|
||||
│ ├── core/ # Core system modules
|
||||
│ ├── home/ # Home Manager modules
|
||||
│ ├── nixos/ # NixOS-specific modules
|
||||
│ └── *.nix # Utility modules (lib, skyg-utils, network-drives, etc.)
|
||||
├── apps/ # Standalone applications
|
||||
│ └── *.nix # Utility modules (lib, skyg-utils, internal-networking, etc.)
|
||||
├── openwrt-routers/ # OpenWrt router configs (glmain)
|
||||
├── docs/ # Documentation
|
||||
├── flake.nix # Nix flake definition
|
||||
├── flake.lock # Locked dependency versions
|
||||
└── README.md # This file
|
||||
@@ -45,55 +46,77 @@ To use the custom packages in your own NixOS/Home Manager configuration:
|
||||
}
|
||||
```
|
||||
|
||||
You can also import `nixos-setup.lib` to reuse `makeNixOs`, `makeHomeManagerUsers`, and other utilities.
|
||||
You can also import `nixos-setup.lib` to reuse `makeNixOs`, `makeHomeManagerUsers`, `makeIso`, `makeSdImage`, and other utilities.
|
||||
|
||||
See [`pkgs/ABOUTME.md`](pkgs/ABOUTME.md) for details on each package.
|
||||
|
||||
## Quick Start
|
||||
|
||||
The `skyg` script is your main interface for managing these configurations. It's located in `bin/skyg` and uses NuShell.
|
||||
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.
|
||||
|
||||
### Available Commands
|
||||
|
||||
#### System Management
|
||||
#### Local System (`skyg os`)
|
||||
|
||||
- **`skyg build`** - Build the current system configuration
|
||||
- **`skyg switch`** - Switch to a new configuration (with confirmation)
|
||||
- **`skyg test`** - Test a configuration without switching
|
||||
- **`skyg rollback`** - Rollback 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`)
|
||||
|
||||
#### Profile Management
|
||||
|
||||
- **`skyg profiles`** - List all available local profiles
|
||||
- **`skyg profiles --only_remote`** - List only remote profiles (prefixed with `hl-`)
|
||||
|
||||
#### Flake Updates
|
||||
|
||||
- **`skyg update`** - Update all flakes to their latest versions
|
||||
- **`skyg update <flake_name>`** - Update a specific flake (e.g., `skyg update nixpkgs`)
|
||||
|
||||
Displays the diff of `flake.lock` after updating.
|
||||
|
||||
#### Remote Deployments
|
||||
#### Remote Deployments (`skyg remote`)
|
||||
|
||||
- **`skyg remote <command> <target>`** - Deploy to a remote machine
|
||||
|
||||
Supported remote commands: `test`, `dry-activate`, `run`, `switch`, `build`
|
||||
Supported remote commands: `test`, `dry-activate`, `run`, `switch`, `build`, `boot`
|
||||
|
||||
Example: `skyg remote switch bigbox1` deploys using the `hl-bigbox1` profile to `root@bigbox1.lab.internal`
|
||||
|
||||
- **`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.
|
||||
|
||||
#### Home Manager
|
||||
#### Flake Management (`skyg flake`)
|
||||
|
||||
- **`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
|
||||
|
||||
#### Building Images and Routers (`skyg build`)
|
||||
|
||||
- **`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.
|
||||
|
||||
#### Home Manager (`skyg hm`)
|
||||
|
||||
- **`skyg hm switch [profile]`** - Apply home-manager configuration (default: `ari`)
|
||||
- **`skyg hm build [profile]`** - Build home-manager configuration
|
||||
|
||||
Example: `skyg hm switch ari` or `skyg hm switch`
|
||||
|
||||
#### ISO Images
|
||||
#### Secrets (`skyg secrets`)
|
||||
|
||||
- **`skyg build-iso`** - Build a bootable ISO image
|
||||
- **`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
|
||||
|
||||
#### Lab CA (`skyg ca`)
|
||||
|
||||
- **`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`
|
||||
|
||||
#### Custom Packages (`skyg pkgs`)
|
||||
|
||||
- **`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
|
||||
|
||||
@@ -102,20 +125,20 @@ Example: `skyg hm switch ari` or `skyg hm switch`
|
||||
skyg profiles
|
||||
|
||||
# Build and switch to new configuration
|
||||
skyg build
|
||||
skyg switch
|
||||
skyg os build
|
||||
skyg os switch
|
||||
|
||||
# Test configuration before switching
|
||||
skyg test
|
||||
skyg os test
|
||||
|
||||
# Update dependencies
|
||||
skyg update nixpkgs
|
||||
skyg flake update nixpkgs
|
||||
|
||||
# Deploy to a remote server
|
||||
skyg remote switch bigbox1
|
||||
|
||||
# Rollback if something goes wrong
|
||||
skyg rollback
|
||||
skyg os rollback
|
||||
|
||||
# Apply home-manager changes
|
||||
skyg hm switch
|
||||
@@ -141,7 +164,7 @@ Secrets are encrypted using [agenix](https://github.com/ryantm/agenix) and store
|
||||
|
||||
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 decrypt <name>` then `skyg encrypt <name>` to re-encrypt it against the updated key set
|
||||
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
|
||||
|
||||
For more details, see `secrets/ABOUTME.md`.
|
||||
|
||||
@@ -150,7 +173,7 @@ For more details, see `secrets/ABOUTME.md`.
|
||||
Available profiles include:
|
||||
|
||||
- **Local**: `fwbook` (Framework laptop)
|
||||
- **Remote**: `hl-bigbox1`, `hl-bigbox2`, `hl-fwdesk`, `hl-fws1`, `hl-minipc1`, `hl-minipc2`, `hl-minipc3`, `hl-terra1`
|
||||
- **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)
|
||||
|
||||
All profiles automatically have access to the custom packages from the `pkgs/` directory.
|
||||
Reference in new issue
Block a user