kiskaadee 5314db937f refactor(modules): restructure user home-manager modules into clean CLI/GUI tiers
- Update `architecture.md` to reflect the 3-host topology (`server`, `desktop`, `laptop`) and tiered user module design.
- Strip Wayland and GUI dependencies from Tier 1 CLI modules (`base.nix`, `terminal.nix`).
- Centralize Alacritty configuration, Wayland screen tools (`grim`, `slurp`, `wf-recorder`, `obs-studio`), and GUI applications into `modules/user/graphical.nix`.
- Clean up host-specific `home.nix` files to remove duplicated package lists.
- Add `tea` (Gitea CLI) to developer applications.
2026-09-05 07:50:28 -05:00
2026-06-29 00:21:44 -05:00
2026-09-05 07:12:05 -05:00

❄️ Declarative NixOS Workstation Configuration

This repository houses a purely declarative, reproducible NixOS configuration using Nix Flakes and Home Manager. It serves as the single source of truth for provisioning and managing high-performance Wayland-native workstation environments across desktop and laptop profiles.


🏗️ Repository Architecture

This configuration maintains a strict separation between global system defaults, shared user configuration modules, and host-specific profiles to avoid redundancy.

graph TD
    A["flake.nix"] --> B{"Host Targets"}

    subgraph Hosts ["Host Profiles (hosts/)"]
        S["server<br/><i>(Headless Homelab)</i>"]
        D["desktop<br/><i>(Hyprland Workstation)</i>"]
        L["laptop<br/><i>(Niri Workstation)</i>"]
    end

    B -->|"server"| S
    B -->|"desktop"| D
    B -->|"laptop"| L

    subgraph Shared ["Shared Modules (modules/)"]
        SYS["modules/system/<br/><i>(Base OS & System Daemons)</i>"]
        USER["home.nix + modules/user/<br/><i>(User Environment & Apps)</i>"]
    end

    S --> SYS
    D --> SYS
    L --> SYS

    S --> USER
    D --> USER
    L --> USER

Directory Structure

  • flake.nix — Main entry point defining dependencies (inputs) and system host targets (server, desktop, laptop).
  • home.nix — Global Home Manager declaration defining the user context (kiskaadee).
  • hosts/ — Specific hardware configuration files and profiles.
  • modules/ — Reusable, modular system and user configuration files:
    • modules/system/ — Global hardware settings, Docker, greetd, and audio:
    • modules/user/ — User environment settings:
      • base.nix — Core CLI utilities, alias definitions, and fastfetch.
      • apps.nix — Packages including Zen Browser, Neovim, and Cloud SDKs.
      • terminal.nix — Alacritty terminal emulator, Tmux configurations, and Starship.
      • shell/ — Modular, domain-specific shell scripts natively compiled into the shell configuration:
        • git.sh — Automation helpers for Git staging, committing, and repositories.
        • jump.sh — Interactive navigation helper scripts powered by fzf and yazi.
        • pdf.sh — Quick decryption of password-protected PDF files.
        • quicklinks.sh — Quick menu launcher for saved bookmarks and workflows.
        • todo.sh — Productivity shortcuts and syntax highlighter for todo.txt and tuxedo.
        • wayland.sh — Utility to automatically pipe program stdout/stderr to the Wayland clipboard.

🛠️ Specialized Shell & Script Automation

1. Smart Dynamic DNS Monitor

The monitor.py daemon prevents redundant DNS updates by running a local-first check before contacting the provider API:

flowchart TD
    A[Timer triggers monitor script] --> B[Fetch public IP from seq. providers]
    B --> C{Is public IPv4 valid?}
    C -->|No| D[Log error & try next provider]
    C -->|Yes| E[Retrieve last successful IP from local logs]
    E --> F{Has IP changed?}
    F -->|No| G[Exit cleanly]
    F -->|Yes| H[Trigger ddclient.service via systemctl]
    H --> I{Update successful?}
    I -->|Yes| J[Write success status to ip_history.jsonl]
    I -->|No| K[Write failed_update status & alert user]

2. GPU-Accelerated Video Recording (record)

  • Script Location: modules/user/scripts/record.sh
  • Functionality: Uses wf-recorder to record Wayland outputs across both Niri and Hyprland sessions.
  • Modes:
    • area — Manually drag and draw a target bounding box using slurp.
    • window — Target active window or interactively select via slurp.
    • output — Matches coordinates of the currently active focused monitor (niri msg / hyprctl).
    • screen — Full layout capture.
    • audio flag — Parses wpctl to dynamically resolve output system loopback paths from PipeWire/WirePlumber to include sound.

3. Git Automation Shorthand (git.sh)

  • Script Location: modules/user/shell/git.sh
  • Features:
    • gitignore <pattern> — Appends pattern to project-root .gitignore, commits the change, and pushes to remote.
    • gacp <message> — Shorthand to stage all edits, commit with a message, and push directly to the current branch.
    • new-repo <name> — Scaffolds local files, runs git init, and pushes the project to GitHub using the gh CLI.

4. Todo.txt & Tuxedo Productivity Helper (todo.sh)

  • Script Location: modules/user/shell/todo.sh
  • Features:
    • todo — Launches the interactive tuxedo TUI for the local ./todo.txt.
    • todo n / todo next — Displays only the highest-priority focus task.
    • todo n <N> / todo next <N> — Displays the top N priority tasks (e.g. todo n 3).
    • todo dn / todo do-next — Auto-completes the top priority task.
    • _todo_color — Built-in awk parser adding ANSI color formatting for priorities, @contexts, +projects, dates, and key:value tags without broken-pipe errors.

5. Repository Bundler Utility (bundle-project)

  • Script Location: modules/user/scripts/bundle_project.py
  • Features:
    • bundle-project [target_dir] [-o output_file] — Compresses the structure and contents of a target directory (defaults to .) into a single output file (defaults to output.txt).
    • Natively skips binary files and .git repositories to prevent pollution.
    • Automatically runs eza --tree and outputs it as a visual guide at the header of the bundle file.

🔒 Secrets Management (SOPS + age)

No plain text passwords, tokens, or private keys are committed to the public history. Secrets are stored inside encrypted .yaml assets decrypted dynamically on-demand at boot time using sops-nix and SSH host keys.

graph LR
    A[Encrypted secrets.yaml in Git] --> B(sops-nix on system boot)
    C[Host SSH Private Key /etc/ssh/...] --> B
    B --> D[Decrypted RAM filesystem /run/secrets/]
    D --> E[Services read secrets securely]

Adding and Modifying Secrets

  1. Decrypt and open the host secrets file:
    nix-shell -p sops --run "sops hosts/desktop/secrets.yaml"
    
  2. Save changes and exit. sops will automatically re-encrypt the file with the public keys defined in the root .sops.yaml configuration file.

For detailed steps on bootstrapping, key generation, and service decryption, see the Secrets Management Guide.


🚀 Quick Start / Deployment

1. Installation

Clone the configuration workspace directly into your home folder:

git clone https://github.com/kiskaadee/nixos-config.git ~/Config
cd ~/Config

2. Deploy System Configurations

Rebuild and switch to the profile matching your active target host machine:

  • Desktop Workstation:
    sudo nixos-rebuild switch --flake ~/Config#desktop
    
  • Laptop Workstation:
    sudo nixos-rebuild switch --flake ~/Config#laptop
    

Note: The user environment configures nix-switch as an alias to automatically build and switch using the current hostname.


📚 Reference Documentation

S
Description
Declarative, reproducible NixOS workstation and server configurations using Nix Flakes, Home Manager, and SOPS-Nix.
Readme
884 KiB
0 Stars 1 Watchers 0 Forks
Languages
Shell 43.3%
Nix 39.8%
Lua 11.9%
Python 5%