# ❄️ Declarative NixOS Workstation ## πŸ“– Overview This repository contains a purely declarative, fully reproducible NixOS configuration tailored for modern software development and multi-host deployment. It serves as the single source of truth for managing a unified Wayland-native environment across different hardware profiles, ensuring identical terminal workflows, editor configurations, and core toolchains on every machine. The bash shell configuration is a modular port of the static Arch-based environment [bash-custom](https://github.com/kiskaadee/bash-custom). The desktop experience is designed to achieve visual and functional parity with [DankMaterialShell (DMS)](https://danklinux.com/docs/dankmaterialshell/). --- ## πŸ›‘ The Problem (Why this exists) Traditional Linux distributions (like Arch Linux) rely on imperative package management and stateful configurations. Over time, this leads to: * **Configuration Drift:** Packages and dotfiles drift out of sync between a desktop and a laptop. * **Imperative Rot:** System stability degrades as manual tweaks, forgotten dependencies, and monolithic Bash configurations (`.bashrc` files spanning hundreds of lines) pile up. * **Replication Friction:** Setting up a new machine requires manually executing scripts, remembering package names, and migrating complex configurations by hand. --- ## 🎯 Goals This repository solves these issues by treating the operating system as code, specifically focusing on: * **Deterministic Multi-Host Architecture:** Define a shared base system ([modules/](./modules)) while maintaining completely isolated hardware profiles and display managers for specific machines (e.g., Hyprland for the desktop, Niri for the laptop). * **Frictionless Development:** Provide a pre-configured, battle-tested toolchain out of the box for backend and systems programming, specifically optimized for Python, Rust, and Java. * **Modular Shell Environment:** Replace monolithic shell scripts with cleanly separated, single-purpose modules (Git workflows, Wayland clipboard utilities, fuzzy navigation). These are natively compiled into the environment via Nix without relying on brittle source chains. * **Maintainability & Discoverability:** Utilize a logical, flat directory structure that avoids the "hyper-abstraction" trap of overly complex Nix flakes. If a configuration needs to be changed, its location should be immediately obvious. --- ## 🚫 Non-Goals To keep the system fast and maintainable, this configuration explicitly avoids: * **Legacy Display Protocols:** There is no support or fallback for X11; this is a pure Wayland environment. * **Full Desktop Environments (DEs):** Avoiding bloated DEs (like GNOME or KDE) in favor of lightweight, composable window managers and standalone system monitors. * **Over-Engineering Nix:** Avoiding deeply nested Nix functions or custom abstract configuration languages. The goal is to use standard NixOS modules and native file inclusion (`builtins.readFile`) to keep the codebase readable for standard Linux users. --- ## πŸ“‚ Architecture The repository relies on a standard Nix Flake structure to enforce isolation: * [flake.nix](./flake.nix): The entry point of the configuration. Defines system inputs, channels, dependencies (like DMS, `dgop`, etc.), and exposes desktop and laptop deployment targets. * [home.nix](./home.nix): Home Manager entrypoint defining the user context (`kiskaadee`) and importing shared user-space configuration modules. * [.sops.yaml](./.sops.yaml): Global rules and public age keys for decrypting repository secrets. * [hosts/](./hosts): Machine-specific configurations. * [hosts/desktop](./hosts/desktop): Target environment for the workstation. * [desktop/configuration.nix](./hosts/desktop/configuration.nix): Desktop-specific packages and NixOS settings. * [desktop/hardware-configuration.nix](./hosts/desktop/hardware-configuration.nix): Autogenerated hardware settings. * [desktop/home.nix](./hosts/desktop/home.nix): Desktop-specific user settings (Hyprland and DankMaterialShell). * [desktop/dynu.nix](./hosts/desktop/dynu.nix) & [monitor.py](./hosts/desktop/monitor.py): Smart Dynamic DNS IP change detector and updater. * [desktop/secrets.yaml](./hosts/desktop/secrets.yaml): Encrypted secrets file (managed by `sops-nix`). * `hosts/laptop`: Target environment for the laptop. * `laptop/configuration.nix`: Laptop-specific NixOS settings. * `laptop/hardware-configuration.nix`: Autogenerated hardware settings. * [laptop/home.nix](./hosts/laptop/home.nix): Laptop-specific user settings (Niri WM placeholder). * [docs/](./docs): Detailed architecture, setup guides, and cheatsheets. * [docs/secrets-management.md](./docs/secrets-management.md): Secure credentials management using `sops-nix` and `age`. * [docs/dynu-ip-monitor.md](./docs/dynu-ip-monitor.md): Smart Dynamic DNS IP monitor and updater script logic. * [docs/tmux.md](./docs/tmux.md): Optimized Tmux terminal multiplexer configuration and keybindings guide. * [docs/antigravity.md](./docs/antigravity.md): Technical details on the Google Antigravity CLI helper. * [modules/](./modules): Shared configurations applied across hosts. * [modules/system](./modules/system): Core OS-level settings (bootloaders, networking, audio, greetd login manager). * [modules/system/base.nix](./modules/system/base.nix): Hardware-agnostic OS base configuration (Docker, Pipewire, SSH, greetd, environment variables). * [modules/system/graphical.nix](./modules/system/graphical.nix): Settings for DMS (DankMaterialShell) daemon, system monitoring, and dynamic theming. * [modules/user](./modules/user): User-space configurations (Home Manager, Neovim, Alacritty, Tmux, Starship, fastfetch). * [modules/user/base.nix](./modules/user/base.nix): Core shell utilities, Git configuration, fastfetch dashboard, aliases, and shell integration. * [modules/user/apps.nix](./modules/user/apps.nix): User packages (Zen Browser, GIMP, MPV, Cloud SDKs, credentials). * [modules/user/graphical.nix](./modules/user/graphical.nix): Neovim configuration, Neovim plugins, and graphical session targets. * [modules/user/terminal.nix](./modules/user/terminal.nix): Terminal emulator (Alacritty), multiplexer (Tmux), and cross-shell prompt (Starship). * [modules/user/shell/](./modules/user/shell): Extracted, domain-specific shell scripts natively compiled into the shell configuration: * [git.sh](./modules/user/shell/git.sh): Git helpers (`gitignore`, `gacp`, `new-repo`). * [jump.sh](./modules/user/shell/jump.sh): Yazi and fzf-based quick navigation wrappers (`cnf`, `pj`, `jump`, etc.). * [pdf.sh](./modules/user/shell/pdf.sh): Helper functions for decrypting PDFs using `qpdf`. * [quicklinks.sh](./modules/user/shell/quicklinks.sh): Fzf interactive menu for running custom saved web links or commands. * [wayland.sh](./modules/user/shell/wayland.sh): Wayland clipboard integration command wrapper (`wlc`). --- ## πŸš€ Quick Start / Deployment ### 1. Clone the Configuration Clone this repository to your home directory (usually target location is `~/Config`): ```bash git clone https://github.com/kiskaadee/nixos-config.git ~/Config cd ~/Config ``` ### 2. Build and Switch the Configuration To apply the configuration for the first time or rebuild after a change, run the `nixos-rebuild` command pointing to the host's flake target: ```bash # Rebuild the system for the 'desktop' target sudo nixos-rebuild switch --flake ~/Config#desktop ``` *Note: For convenience, a shell alias `nix-switch` is pre-configured to automatically run this rebuild command for the current host name.* ### 3. Updating Flake Inputs To update all flake inputs (such as home-manager, nixpkgs, or dms): ```bash nix flake update ``` --- ## πŸ—ΊοΈ Roadmap & Next Steps Here is the current status of features planned to complete the environment and prepare it for dual-host capability: ### Phase 1: Complete DankMaterialShell (DMS) Integration * [ ] **Adding Background Blur:** Configure Hyprland compositor to enable background blur under the shell and terminal elements ([DMS CLI Doctor - Compositor Checks](https://danklinux.com/docs/dankmaterialshell/cli-doctor#compositor-checks)). * [ ] **Cups-pk-helper:** Enable and configure `cups-pk-helper` for privileged printer administration checks ([DMS CLI Doctor - Optional Features](https://danklinux.com/docs/dankmaterialshell/cli-doctor#optional-features)). * [ ] **Set Core Fonts:** Ensure proper font styling settings: * **Normal Font:** Configure *Inter Variable* as the default system-wide sans-serif font ([DMS Fonts](https://danklinux.com/docs/dankmaterialshell/cli-doctor#fonts)). * **Monospace Font:** Ensure *Fira Code* is the primary system monospace font for coding. ### Phase 2: Hardware & Display Greeter Polish * [ ] **Bluetooth Adapter Configuration:** Enable Bluetooth services globally, configure power-on on boot, and enable media controls via Bluetooth. * [ ] **Custom Greetd Configuration:** Clean up the console/login manager setup, styling `tuigreet` or auto-logging to the graphical environment cleanly. ### Phase 3: Laptop Profile (Multi-Host Readiness) * [x] Create `./hosts/laptop/configuration.nix` and `./hosts/laptop/hardware-configuration.nix`. * [ ] Integrate the **Niri** compositor as the default desktop environment for the laptop while sharing 100% of the terminal, editor, toolchain, and styling modules.