$ show ryan4yin/nix-config
This repository is a personal Nix configuration (dotfiles) for managing a heterogeneous fleet of machines: NixOS desktops and servers, macOS laptops (via nix-darwin), and Kubernetes clusters (k3s, KubeVirt). It is structured as a Nix flake with modular components for system configuration, home-manager profiles, package overlays, secrets management (agenix), and infrastructure monitoring (Grafana, Prometheus, VictoriaMetrics, Loki). The codebase demonstrates advanced Nix patterns: parameterized module generators for K3s and KubeVirt, automatic file scanning for module imports, declarative disk partitioning (disko), ephemeral root filesystems with persistent state (preservation), and sandboxed GUI applications (nixpak, bwrap). It also includes a custom desktop shell (noctalia) and extensive input method customization (Rime/Fcitx5). While highly personalized and not intended for direct reuse, the architectural patterns and modular design serve as a reference for building complex Nix-based infrastructure. The repository is actively maintained with eval tests and CI, but lacks integration tests for runtime services.
The LLM identified 8 files worth highlighting for reuse:
Provides `scanPaths` which recursively imports all `.nix` files in a directory (excluding `default.nix`). This is a reusable pattern for automatically registering modules without manual listing, reducing boilerplate in large Nix configurations.
Generates a NixOS module for a K3s server node given parameters like token, server address, and cluster CIDR. This pattern allows creating multiple cluster nodes with consistent configuration and can be extracted for any K3s deployment.
Generates a NixOS module for a KubeVirt host, configuring libvirt, networking, and storage. Demonstrates how to parameterize complex virtualization setups, reusable for any KubeVirt cluster.
Defines a reusable Nixpak module for sandboxing GUI applications with Wayland, D-Bus, GPU acceleration, and portal integration. This pattern can be applied to any graphical application to improve security without sacrificing functionality.
Configures in-memory zram swap with tuned sysctl parameters (swappiness, vfs_cache_pressure). Gated by a module option, this is a clean, reusable pattern for improving memory pressure on systems with limited RAM.
Demonstrates a pattern for writing Nix eval tests that assert configuration properties (e.g., firewall rules) without building the system. This is a lightweight, reusable approach to validating NixOS module behavior in CI.
Prometheus alert rules for node-exporter metrics (CPU, memory, disk, network). These are standard, well-structured rules that can be reused across any Prometheus monitoring stack with minimal adaptation.
A Grafana dashboard for Kubernetes node monitoring, sourced from the community and adapted with templating variables. The pattern of storing dashboards as JSON in a per-host directory structure is reusable for GitOps-based Grafana provisioning.