Files
nixos-config/README.md
T
kiskaadee 7245d8c22a feat(system): establish dual-host architecture and finalize environment integrations
This commit finalizes the multi-host deployment framework, introducing the laptop profile alongside the desktop. It integrates essential hardware services, declaratively binds the Hyprland compositor, and thoroughly documents the repository architecture.

- Initialize `hosts/laptop` profile configured for the Niri compositor, utilizing `lib.mkForce` to override default `greetd` logic.
- Declare `hyprland.conf` directly via Home Manager (`home.file`) to ensure reproducible compositor settings (blur, gaps, bindings).
- Enable Bluetooth daemon (`hardware.bluetooth`) and printing services (`cups-pk-helper`) system-wide.
- Configure default system typography with `inter` and `fira-code` via `fonts.fontconfig`.
- Enhance `tuigreet` login screen with session memory, password asterisks, and a custom declarative greeting.
- Add comprehensive inline documentation to all Nix modules and shell scripts, alongside a complete project `README.md`.
- Update the Home Manager declarations in flake.nix to include
  home-manager.backupFileExtension = "backup"

Rationale: Hardcoding the Hyprland configuration and core hardware services ensures the desktop is fully immutable. Branching the host profiles allows the laptop to share 100% of the user-space configurations (terminal, editor, shell aliases) while cleanly swapping the graphical compositor stack to Niri.
2026-06-19 01:53:42 -05:00

114 lines
8.2 KiB
Markdown

# ❄️ 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 user-space configuration modules.
* [hosts/](./hosts): Machine-specific configurations.
* [hosts/desktop](./hosts/desktop): Contains [desktop/configuration.nix](./hosts/desktop/configuration.nix) (machine-specific packages/settings) and [desktop/hardware-configuration.nix](./hosts/desktop/hardware-configuration.nix) (autogenerated hardware specifications).
* `hosts/laptop`: Laptop hardware configuration and Niri implementation (*under construction*).
* [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)
* [ ] 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.