# twilightty/.dotfiles-nix architecture

> Architecture diagram of the GitHub repository twilightty/.dotfiles-nix, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/twilightty/.dotfiles-nix
- Repository: https://github.com/twilightty/.dotfiles-nix

## Overview

##### Project type and purpose
- This is a multi-platform “dotfiles” management system built on Nix flakes.
- It centralizes and version-controls your shell, editor, window manager, and system configuration for both macOS (Darwin) and Linux (NixOS).
- Uses Home Manager for per-user settings and NixOS/darwin-rebuild for system-level configuration.

##### File structure
- Top-level:
- `.gitignore`, `README.md` – repo metadata
- `flake.nix`, `flake.lock` – Nix flake entrypoint and lockfile
- Directories:
- `linux/` – NixOS modules (`sysconfig`), per-desktop environment configs (`de`), package sets (`apps`)
- `shared/` – cross-OS Home Manager modules for nvim, tmux, shell plugins
- Key patterns:
- Each OS has its own `flake.nix` referencing `shared/` for common modules.
- `home-manager` on both platforms plus `nixos-rebuild` under `linux/sysconfig`.
- Cachix is recommended for binary caching.

##### README for additional insights
- Commands:
- `darwin-rebuild switch --flake .` (macOS)
- `home-manager switch --flake .#kirb` + `sudo nixos-rebuild switch --flake .` (Linux)
- Emphasis on enabling Cachix for prebuilt binaries.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer and Flake
    Developer["Developer Git Repo"]:::shared
    Flake["flake.nix\nflake.lock"]:::shared
    Developer --> Flake

    %% macOS Pipeline
    subgraph "macOS Pipeline"
        direction TB
        MacFlake["macos/flake.nix\nmacos/flake.lock"]:::macos
        DarwinRebuild["darwin-rebuild switch"]:::macos
        subgraph "macOS Modules"
            direction TB
            subgraph "Darwin Specific" 
                direction TB
                DarwinDefault["darwin/default.nix"]:::macos
                DarwinHomebrew["darwin/homebrew.nix"]:::macos
                DarwinSkhd["darwin/skhd.nix"]:::macos
                DarwinYabai["darwin/yabai.nix"]:::macos
            end
            subgraph "Home Manager Modules"
                direction TB
                ShellHome["shell/home.nix"]:::macos
                ShellDefault["shell/default.nix"]:::macos
                Alacritty["shell/alacritty.nix"]:::macos
                Nvim["shell/nvim.nix"]:::macos
                Zsh["shell/zsh.nix"]:::macos
                OhMyTmux["shell/ohmytmux.nix"]:::macos
                TmuxConf["shell/tmux.conf"]:::macos
                NvimInit[".nvim/init.lua"]:::macos
                NvimLua["nvim.lua"]:::macos
                Starship["starship.toml"]:::macos
                ItermColors["tokyonight.itermcolors"]:::macos
                Wallpaper["wallpaper"]:::macos
            end
        end
        MacApply["macOS System Apply"]:::macos
        Flake --> MacFlake
        MacFlake --> DarwinRebuild
        DarwinRebuild --> DarwinDefault
        DarwinRebuild --> ShellHome
        ShellHome --> MacApply
    end

    %% Linux Pipeline
    subgraph "Linux Pipeline"
        direction TB
        LinuxFlake["linux/sysconfig/flake.nix\nlinux/sysconfig/flake.lock"]:::linux
        subgraph "Home Manager (User)"
            direction TB
            HomeMgr["home-manager switch"]:::linux
            LinuxHome["linux/home.nix"]:::linux
            HomeMgr --> LinuxHome
            LinuxHome --> UserProfile["Linux User Profile"]:::linux
        end
        subgraph "NixOS Rebuild (System)"
            direction TB
            NixosRebuild["nixos-rebuild switch"]:::linux
            subgraph "System Modules"
                direction TB
                SysConfig["configuration.nix"]:::linux
                HardwareConfig["hardware-configuration.nix"]:::linux
                Apps["apps/apps.nix"]:::linux
                GitApp["apps/git.nix"]:::linux
                GtkApp["apps/gtk.nix"]:::linux
                QtApp["apps/qt.nix"]:::linux
                Spicetify["spicetify.nix"]:::linux
                DE["de/de.nix"]:::linux
                Hyprland["de/hyprland.nix"]:::linux
                Mako["de/mako.nix"]:::linux
                Waybar["de/waybar.nix"]:::linux
                Hyprpaper["de/hyprpaper.nix"]:::linux
            end
            NixosRebuild --> SysConfig
            NixosRebuild --> Apps
            NixosRebuild --> DE
            SysConfig --> LinuxSystem["NixOS System Apply"]:::linux
        end
        Flake --> LinuxFlake
        LinuxFlake --> HomeMgr
        LinuxFlake --> NixosRebuild
    end

    %% External Cachix
    Cachix["Cachix Binary Cache"]:::external
    Cachix --> DarwinRebuild
    Cachix --> NixosRebuild

    %% Click Events
    click Flake "https://github.com/twilightty/.dotfiles-nix/blob/main/flake.nix"
    click MacFlake "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/flake.nix"
    click DarwinDefault "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/darwin/default.nix"
    click DarwinHomebrew "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/darwin/homebrew.nix"
    click DarwinSkhd "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/darwin/skhd.nix"
    click DarwinYabai "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/darwin/yabai.nix"
    click ShellHome "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/shell/home.nix"
    click ShellDefault "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/shell/default.nix"
    click Alacritty "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/shell/alacritty.nix"
    click Nvim "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/shell/nvim.nix"
    click Zsh "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/shell/zsh.nix"
    click OhMyTmux "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/shell/ohmytmux.nix"
    click TmuxConf "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/shell/tmux.conf"
    click NvimInit "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/shell/.nvim/init.lua"
    click NvimLua "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/shell/nvim.lua"
    click Starship "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/starship.toml"
    click ItermColors "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/tokyonight.itermcolors"
    click MacFlake "https://github.com/twilightty/.dotfiles-nix/blob/main/macos/install.sh"
    click LinuxFlake "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/sysconfig/flake.nix"
    click LinuxHome "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/home.nix"
    click SysConfig "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/sysconfig/configuration.nix"
    click HardwareConfig "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/sysconfig/hardware-configuration.nix"
    click Apps "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/apps/apps.nix"
    click GitApp "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/apps/git.nix"
    click GtkApp "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/apps/gtk.nix"
    click QtApp "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/apps/qt.nix"
    click Spicetify "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/spicetify.nix"
    click DE "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/de/de.nix"
    click Hyprland "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/de/hyprland.nix"
    click Mako "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/de/mako.nix"
    click Waybar "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/de/waybar.nix"
    click Hyprpaper "https://github.com/twilightty/.dotfiles-nix/blob/main/linux/de/hyprpaper.nix"

    %% Styles
    classDef shared fill:#e0f7fa,stroke:#006064,color:#004d40
    classDef macos fill:#ffe0b2,stroke:#e65100,color:#bf360c
    classDef linux fill:#e8f5e9,stroke:#1b5e20,color:#2e7d32
    classDef external fill:#f3e5f5,stroke-dasharray: 5 5,stroke:#4a148c,color:#6a1b9a
```
