kiskaadee 6c48a3601d feat(infra): add declarative homeserver container orchestrator
- Create `hosts/desktop/homeserver.nix`: Implement a systemd service to manage the Docker Compose application stack (Traefik, Authelia, etc.).
- Integrate `sops-nix` template generation for homelab secrets, creating an isolated `/run/secrets/homeserver.env` for containerized services.
- Update `secrets.yaml`: Populate keys for ACME, Authelia, and additional infrastructure providers.
- Integrate `homeserver.nix` into the desktop host configuration.

Rationale: Centralizes the orchestration of background services into the NixOS system lifecycle, ensuring reproducible service deployments and secure, dynamic secret injection at runtime.
2026-06-28 15:43:19 -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 Entrypoint] --> B{Host Configuration}
    
    B -->|desktop| C[hosts/desktop]
    B -->|laptop| D[hosts/laptop]
    
    C --> C1[hardware-configuration.nix]
    C --> C2[configuration.nix]
    C --> C3[home.nix]
    C --> C4[dynu.nix + monitor.py]
    
    D --> D1[hardware-configuration.nix]
    D --> D2[configuration.nix]
    D --> D3[home.nix]

    C3 --> H[home.nix base]
    D3 --> H
    
    H --> M[modules/user]
    C2 --> S[modules/system]
    D2 --> S

Directory Structure

  • flake.nix — Main entry point defining dependencies (inputs) and system host targets.
  • 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.
        • 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.sh)

  • Script Location: hosts/desktop/config/hypr/scripts/record.sh
  • Functionality: Uses wf-recorder to record Wayland outputs.
  • Modes:
    • area — Manually drag and draw a target bounding box using slurp.
    • window — Target coordinates dynamically parsed from hyprctl activewindow.
    • output — Matches coordinates of the currently active focused monitor.
    • screen — Default full layout grab.
    • 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. 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%