# matthiasbenaets/nix-config architecture

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

- Interactive diagram: https://gitdiagram.com/matthiasbenaets/nix-config
- Repository: https://github.com/matthiasbenaets/nix-config

## Overview

##### Project type and purpose
- This is an “infrastructure-as-code” repository: a Nix flake that declares system configurations for multiple hosts (NixOS and macOS via Nix-Darwin), plus reusable modules (desktops, editors, hardware, programs, services, shells, theming) and shell environments.
- Purpose: provide a single, declarative, reproducible configuration for different machines (“hosts”) using NixOS (Wayland, Xorg) or Nix-Darwin, plus development shells.

##### File structure
- Top-level entries
- flake.nix / flake.lock – the flake entrypoint with inputs (nixpkgs, home-manager, nix-darwin) and outputs (nixosConfigurations, darwinConfigurations, homeConfigurations, and custom shells).
- darwin/ – Nix-Darwin host definitions and module imports.
- hosts/ – per-host NixOS configurations, each with default.nix and hardware-configuration.nix.
- modules/ – a library of NixOS modules grouped by category: desktops, editors, hardware, programs, services, shell, theming.
- nix/ – general-purpose Nix modules (e.g., pacman config).
- rsc/ – archived reference configurations and config snippets for various tools (bspwm, Hyprland, polybar, kitty, etc.).
- shells/ – nix shell definitions for various development environments (Python, JS, Electron, etc.).
- Documentation files (.org) describing setup and installation.

##### README for additional insights
- It enumerates the system components (DM, WM/DE, compositor, bar, hotkeys, launcher, theme, notifications, terminal) per platform.
- Shows how to install on NixOS (multiple host types) and Darwin.
- Indicates use of home-manager for non-NixOS systems.
- Lists external dependencies: nixpkgs, home-manager, nix-darwin.

##### Elements
- Clear labels: Flake Root, Inputs, Modules Library, Host Configs (NixOS, Darwin), Shell Environments, Reference Configs
- Rectangles for local code artifacts (modules/, hosts/, darwin/, shells/)
- Rounded rectangles for commands/CLIs (nixos-rebuild, darwin-rebuild, home-manager)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Inputs
    subgraph "Inputs"
        PKG["nixpkgs"]:::external
        HM["home-manager"]:::external
        ND["nix-darwin"]:::external
    end

    %% Flake Root
    subgraph "Flake Root"
        FR1["flake.nix"]:::root
        FR2["flake.lock"]:::root
    end

    %% Module Library
    subgraph "Module Library"
        subgraph "Desktops"
            D1["default.nix"]:::module
            D2["bspwm.nix"]:::module
            D3["gnome.nix"]:::module
            D4["hyprland.nix"]:::module
            D5["kde.nix"]:::module
            D6["options.nix"]:::module
            D7["river.nix"]:::module
            D8["sway.nix"]:::module
            D9["virtualisation/*.nix"]:::module
        end
        subgraph "Editors"
            E1["default.nix"]:::module
            E2["emacs/default.nix"]:::module
            E3["emacs/doom-emacs/**"]:::module
            E4["nvim.nix"]:::module
        end
        subgraph "Hardware"
            H1["default.nix"]:::module
            H2["bluetooth.nix"]:::module
            H3["dslr.nix"]:::module
            H4["power.nix"]:::module
            H5["beelink/*.nix"]:::module
            H6["work/*.nix"]:::module
            H7["xps/*.nix"]:::module
        end
        subgraph "Programs"
            P1["default.nix"]:::module
            P2["accounts.nix"]:::module
            P3["alacritty.nix"]:::module
            P4["flatpak.nix"]:::module
            P5["games.nix"]:::module
            P6["eww/**"]:::module
            P7["kitty.nix"]:::module
            P8["obs.nix"]:::module
            P9["rofi.nix"]:::module
            P10["thunar.nix"]:::module
            P11["waybar.nix"]:::module
            P12["wofi.nix"]:::module
        end
        subgraph "Services"
            S1["default.nix"]:::module
            S2["avahi.nix"]:::module
            S3["dunst.nix"]:::module
            S4["flameshot.nix"]:::module
            S5["media.nix"]:::module
            S6["picom.nix"]:::module
            S7["polybar.nix"]:::module
            S8["redshift.nix"]:::module
            S9["samba.nix"]:::module
            S10["swaync.nix"]:::module
            S11["sxhkd.nix"]:::module
            S12["udiskie.nix"]:::module
            S13["x11vnc.nix"]:::module
        end
        subgraph "Shell & Environment"
            SE1["default.nix"]:::module
            SE2["direnv.nix"]:::module
            SE3["git.nix"]:::module
            SE4["zsh.nix"]:::module
        end
        subgraph "Theming"
            T1["default.nix"]:::module
            T2["colors.nix"]:::module
            T3["theming.nix"]:::module
            T4["wall.mp4"]:::module
        end
        subgraph "General Nix"
            N1["default.nix"]:::module
            N2["pacman.nix"]:::module
        end
    end

    %% Host Configurations
    subgraph "Host Configurations"
        subgraph "NixOS Hosts"
            NH0["hosts/default.nix"]:::host
            NH00["hosts/configuration.nix"]:::host
            NH1["beelink/default.nix"]:::host
            NH1h["beelink/hardware-configuration.nix"]:::host
            NH2["h310m/default.nix"]:::host
            NH2h["h310m/hardware-configuration.nix"]:::host
            NH3["probook/default.nix"]:::host
            NH3h["probook/hardware-configuration.nix"]:::host
            NH4["vm/default.nix"]:::host
            NH4h["vm/hardware-configuration.nix"]:::host
            NH5["work/default.nix"]:::host
            NH5h["work/hardware-configuration.nix"]:::host
            NH6["xps/default.nix"]:::host
            NH6h["xps/hardware-configuration.nix"]:::host
        end
        subgraph "Darwin Hosts"
            DH1["darwin/default.nix"]:::host
            DH2["darwin/darwin-configuration.nix"]:::host
            DH3["darwin/intel.nix"]:::host
            DH4["darwin/m1.nix"]:::host
            DH5["darwin/modules/"]:::host
            DH6["darwin/work.nix"]:::host
        end
    end

    %% Shell Environments
    subgraph "Shell Environments"
        SH1["python/shell.nix"]:::shell
        SH2["js/npm/shell.nix"]:::shell
        SH3["js/electron/shell.nix"]:::shell
        SH4["phoenix/shell.nix"]:::shell
        SH5["unstable/shell.nix"]:::shell
        SH6["archive/*.nix"]:::shell
    end

    %% Reference Configurations
    subgraph "Reference Configurations (rsc)"
        R1["rsc/config/**"]:::ref
        R2["rsc/archive/**"]:::ref
    end

    %% Connections
    PKG -->|feeds| FR1
    HM -->|feeds| FR1
    ND -->|feeds| FR1

    FR1 -->|imports| ModuleLibrary["Module Library"]
    FR1 -->|outputs| NixOSHosts["NixOS Hosts"]
    FR1 -->|outputs| DarwinHosts["Darwin Hosts"]
    FR1 -->|outputs| ShellEnvs["Shell Environments"]

    ModuleLibrary -->|used by| NixOSHosts
    ModuleLibrary -->|used by| DarwinHosts

    R1 -.->|reference| NH1
    R2 -.->|reference| NH1

    %% Click Events
    click FR1 "https://github.com/matthiasbenaets/nix-config/blob/master/flake.nix"
    click FR2 "https://github.com/matthiasbenaets/nix-config/blob/master/flake.lock"
    click NH0 "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/default.nix"
    click NH00 "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/configuration.nix"
    click NH1 "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/beelink/default.nix"
    click NH1h "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/beelink/hardware-configuration.nix"
    click NH2 "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/h310m/default.nix"
    click NH2h "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/h310m/hardware-configuration.nix"
    click NH3 "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/probook/default.nix"
    click NH3h "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/probook/hardware-configuration.nix"
    click NH4 "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/vm/default.nix"
    click NH4h "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/vm/hardware-configuration.nix"
    click NH5 "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/work/default.nix"
    click NH5h "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/work/hardware-configuration.nix"
    click NH6 "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/xps/default.nix"
    click NH6h "https://github.com/matthiasbenaets/nix-config/blob/master/hosts/xps/hardware-configuration.nix"
    click DH1 "https://github.com/matthiasbenaets/nix-config/blob/master/darwin/default.nix"
    click DH2 "https://github.com/matthiasbenaets/nix-config/blob/master/darwin/darwin-configuration.nix"
    click DH3 "https://github.com/matthiasbenaets/nix-config/blob/master/darwin/intel.nix"
    click DH4 "https://github.com/matthiasbenaets/nix-config/blob/master/darwin/m1.nix"
    click DH5 "https://github.com/matthiasbenaets/nix-config/tree/master/darwin/modules/"
    click DH6 "https://github.com/matthiasbenaets/nix-config/blob/master/darwin/work.nix"
    click PKG "https://github.com/matthiasbenaets/nix-config/tree/master/nixpkgs"
    click HM "https://github.com/matthiasbenaets/nix-config/tree/master/home-manager"
    click ND "https://github.com/matthiasbenaets/nix-config/tree/master/nix-darwin"

    %% Styles
    classDef external fill:#f9f,stroke:#333,stroke-width:1px;
    classDef root fill:#ccf,stroke:#333,stroke-width:1px;
    classDef module fill:#cfc,stroke:#333,stroke-width:1px;
    classDef host fill:#fcf,stroke:#333,stroke-width:1px;
    classDef shell fill:#cff,stroke:#333,stroke-width:1px;
    classDef ref fill:#eee,stroke:#999,stroke-width:1px;
```
