From ce6fc04532ffebfefc0b36a51169d97e5667f961 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Fri, 11 Sep 2026 11:58:32 -0500 Subject: [PATCH] feat(nixos): establish dedicated NixOS project and promote channel tarball migration plan --- README.md | 16 ++- inbox/parking-lot.md | 25 ----- projects/nixos/README.md | 62 ++++++++++ .../plans/channel-tarball-migration-plan.md | 106 ++++++++++++++++++ 4 files changed, 180 insertions(+), 29 deletions(-) delete mode 100644 inbox/parking-lot.md create mode 100644 projects/nixos/README.md create mode 100644 projects/nixos/plans/channel-tarball-migration-plan.md diff --git a/README.md b/README.md index b1d87da..f139d7f 100644 --- a/README.md +++ b/README.md @@ -42,16 +42,24 @@ knowledge/ ``` projects/ -├── homelab/ ← Infrastructure, NixOS, appctl, CI/CD, networking +├── nixos/ ← Declarative multi-machine OS fleet & flake architecture +│ └── plans/ ← Migration and optimization roadmaps +├── homelab/ ← Infrastructure, Docker services, appctl, GitOps, networking │ ├── plans/ ← Migration and strategy documents -│ └── guides/ ← Architecture and how-to documents -├── magnetflix/ ← Media application -└── nekoweb/ ← Web project +│ └── guides/ ← Architecture and runbook documents +├── dynu-monitor/ ← Smart DDNS change detection daemon (Python/Rust) +├── new-repo/ ← Automated repository provisioning CLI +├── magnetflix/ ← Media indexing and streaming application +└── nekoweb/ ← Web showcase and static site generation ``` **Key documents:** +- [NixOS Fleet Overview](projects/nixos/README.md) - [Homelab Overview](projects/homelab/README.md) +- [Dynu Monitor Overview](projects/dynu-monitor/README.md) +- [New-Repo CLI Overview](projects/new-repo/README.md) - [MagNetFlix Overview](projects/magnetflix/README.md) +- [Nekoweb Overview](projects/nekoweb/README.md) --- diff --git a/inbox/parking-lot.md b/inbox/parking-lot.md deleted file mode 100644 index 73fae8e..0000000 --- a/inbox/parking-lot.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -type: inbox -created: 2026-09-05 ---- - -# Parking Lot - -Topics worth studying after they become relevant. - -## Algorithms -- [ ] Tail Call Optimization - -- ## Data Structures - -- [ ] HashMap collision resolution -- [ ] Open addressing -- [ ] Robin Hood hashing -- [ ] Skip Lists - -## Python Features -- [ ] Sequence and Dictionary unpacking (`*`, `**`) - -## FastAPI -- [ ] SQLModel -- [ ] \ No newline at end of file diff --git a/projects/nixos/README.md b/projects/nixos/README.md new file mode 100644 index 0000000..ae769d2 --- /dev/null +++ b/projects/nixos/README.md @@ -0,0 +1,62 @@ +--- +type: project +status: active +tags: + - nixos + - infrastructure + - flake + - linux +--- + +# ❄️ NixOS Fleet & Declarative System Configuration + +## 🎯 Project Overview +This project documents the architecture, flake hierarchy, host specializations, module designs, and operational maintenance for the multi-machine NixOS fleet managed in [`/home/kiskaadee/Config`](file:///home/kiskaadee/Config). + +The fleet operates under a unified Nix Flake repository supporting declarative system rebuilds, user-space management via Home Manager, and encrypted secrets via SOPS-nix. + +--- + +## 🏛️ System Topology & Host Matrix + +```mermaid +graph TD + Flake["Config Flake (flake.nix)"] --> Hosts["hosts/"] + Flake --> Modules["modules/"] + + Hosts --> Server["hosts/server (Headless 24/7 Server)"] + Hosts --> Laptop["hosts/laptop (Mobile Dev Workstation)"] + + Modules --> CoreMod["Core System Modules (nix, security, locale)"] + Modules --> UserMod["Home Manager Modules (shell, git, neovim)"] + Modules --> DesktopMod["Desktop Modules (niri, wayland, audio)"] + + Server -.->|"headless, docker, sops"| CoreMod + Laptop -.->|"graphical, devtools"| DesktopMod + Laptop -.-> UserMod +``` + +| Host | Role | Environment | Key Subsystems | +| :--- | :--- | :--- | :--- | +| **`server`** | 24/7 Homelab Host | Headless Server | Docker daemon, Traefik, Socket-Proxy, `homelab-gitops`, SOPS Age secrets, Dynu DDNS | +| **`laptop`** | Primary Workstation | Graphical Wayland | Niri / Hyprland, Waybar, Alacritty, DevShells, Git/SSH keys, local LLM/GUI clients | + +--- + +## 📑 Plans & Execution Roadmaps + +1. 🟡 [**Adopting Official channels.nixos.org Tarballs**](plans/channel-tarball-migration-plan.md) `[Active]` + - Transitioning from GitHub-hosted Nixpkgs flake inputs to official `channels.nixos.org` zstd-compressed archives. + - Flake registry pinning and evaluation speedup analysis. + +--- + +## 📑 Guides & Reference Documentation + +*(Guides and deep-dive technical specifications for NixOS fleet management will be curated here as documentation expands).* + +--- + +## 🔗 Related Projects & Locations +* **Local Flake Repository**: [`/home/kiskaadee/Config`](file:///home/kiskaadee/Config) +* **Homelab Services Project**: [Homelab & Infrastructure Planning](../homelab/README.md) diff --git a/projects/nixos/plans/channel-tarball-migration-plan.md b/projects/nixos/plans/channel-tarball-migration-plan.md new file mode 100644 index 0000000..c909ddb --- /dev/null +++ b/projects/nixos/plans/channel-tarball-migration-plan.md @@ -0,0 +1,106 @@ +--- +type: plan +status: active +project: nixos +tags: + - nixos + - flake + - optimization + - hydra +--- + +# 📦 Evaluation & Implementation Plan: Adopting Official `channels.nixos.org` Tarballs + +## 🎯 Goal Description + +An evaluation of transitioning from GitHub-hosted Nixpkgs flake references (`github:nixos/nixpkgs/nixos-unstable`) to the official project-hosted channel tarballs (`https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst`), based on the NixOS Discourse community discussion *"PSA: Use nixos.org tarballs for your flake inputs!"*. + +This plan identifies: +1. Every location in the [`/home/kiskaadee/Config`](file:///home/kiskaadee/Config) repository and system configuration where this change can be applied. +2. The architectural, performance, and operational trade-offs of making the change. +3. A safe execution strategy respecting repository invariants (Build, Never Switch). + +--- + +## 🔍 Technical Analysis & Trade-offs + +### Why the Community Proposes This +* **Zstandard (zstd) vs Gzip**: `channels.nixos.org/nixos-unstable/nixexprs.tar.zst` is compressed with `zstd -19` on official NixOS infrastructure. GitHub repository archives only provide gzip compression. Switching reduces download payload by ~20–33%. +* **Forge Independence**: Decreases reliance on GitHub's infrastructure and reduces vulnerability to GitHub rate-limiting (`403 API rate limit exceeded`), service outages, or API changes. +* **Metadata & Channel Integrity**: Channel tarballs are released only when Hydra channel jobs succeed and binary caches (`cache.nixos.org`) are populated. They also bundle channel metadata (such as `programs.sqlite` for `command-not-found`). +* **IPv6 Support**: Fastly / NixOS CDN provides native IPv6 support, which GitHub tarball downloads historically struggled with or throttled. + +### Trade-offs & Caveats in This Configuration +* **Scope of Tarballs**: Only `nixpkgs` is hosted on `channels.nixos.org`. Third-party flake inputs in this configuration (`home-manager`, `dms`, `dgop`, `dank-greeter`, `zen-browser`, `sops-nix`, `antigravity`) do not have official project tarballs and will remain on GitHub. +* **`flake.lock` Invalidation**: Modifying `nixpkgs.url` changes the input node type from `github` to `tarball`. This triggers an update of `nixpkgs` in `flake.lock` to the latest channel snapshot, causing all downstream inputs (`inputs.nixpkgs.follows = "nixpkgs"`) to re-lock against that new channel evaluation. +* **Evaluation Ergonomics**: `https://channels.nixos.org/...` does not have a short URL prefix like `github:`. +* **Tarball Unpack**: A tarball flake input unpacks the full expression tree into `/nix/store` or the Git cache. In incremental Git checkouts, git delta fetching can sometimes be faster than a cold tarball unpack if git objects are already present locally. + +--- + +## 📋 Audit of Candidate Areas + +| Area | Current Declaration | Candidate Change | Recommendation | +| :--- | :--- | :--- | :--- | +| **System Flake Input**
[`flake.nix:L8`](file:///home/kiskaadee/Config/flake.nix#L8) | `nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";` | `nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";` | **Recommended** (Primary candidate) | +| **System Flake Registry**
(CLI `nix run nixpkgs#...`) | Unconfigured (falls back to global registry pointing to `github:NixOS/nixpkgs`) | Add `nix.registry.nixpkgs.flake = inputs.nixpkgs;` to system base | **Recommended** (Ensures CLI tools share the exact channel cache without querying GitHub) | +| **Dev Environments Guide**
[`docs/development-environments.md:L34`](file:///home/kiskaadee/Config/docs/development-environments.md#L34) | `nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";` | `nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.zst";` | **Recommended** (Documents the faster `nixpkgs-unstable` channel for standalone dev flakes) | +| **Antigravity Guide**
[`docs/antigravity.md:L97`](file:///home/kiskaadee/Config/docs/antigravity.md#L97) | `nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";` | `nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";` | **Optional** (Documentation reference) | + +--- + +## 🛠️ Proposed Changes + +### 1. Flake Configuration + +#### [MODIFY] `flake.nix` in `~/Config` + +```diff + inputs = { + # NixOS Unstable channel - used for bleeding-edge package releases +- nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; ++ nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst"; + + # Home Manager - manages user-space configurations, dotfiles, and shell environments + home-manager = { +``` + +--- + +### 2. System Base Module (Optional CLI Registry Pinning) + +#### [MODIFY] `modules/system/base.nix` in `~/Config` + +```diff ++ # Pin nixpkgs flake registry to the flake input to prevent ad-hoc CLI queries to GitHub ++ nix.registry.nixpkgs.flake = inputs.nixpkgs; +``` + +--- + +### 3. Documentation + +* **`docs/development-environments.md`**: Update the boilerplate example to point to `https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.zst` with a note explaining the zstd download efficiency and forge independence. +* **`docs/antigravity.md`**: Update example reference flake input from GitHub URL to the channel tarball URL. + +--- + +## 🧪 Verification Plan + +### Automated Tests +1. **Flake Metadata & Lock Validation**: + ```bash + nix flake lock --update-input nixpkgs + nix flake check + ``` +2. **Dry-Build System Targets (Build, Never Switch)**: + ```bash + nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link + nix build .#nixosConfigurations.server.config.system.build.toplevel --no-link + ``` + +### Manual Verification +1. Inspect `git diff` in `~/Config` to confirm only `nixpkgs` input and lockfile were modified. +2. Verify `nix flake metadata` shows: + - `Resolved URL: https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst` + - Valid locked `tarball` type with `narHash`.