This repository contains my NixOS and nix-darwin configurations, managed through Nix Flakes.
It is designed for:
- NixOS machines
- macOS machines through
nix-darwin - user-level configuration through
home-manager
The repo follows the dendritic pattern.
In practice, that means:
- small modules do one thing
- branch modules group related settings
- stacks combine reusable modules into host-level choices
- hosts stay short and easy to read
The simplest mental model is:
modules/hosts/= real machinesmodules/= reusable building blocksmodules/stacks/= convenient bundles of those building blocksmodules/profile/= personal settings shared across hosts
- Showcase
- Repository Structure
- Modules and Configurations
- How Composition Works
- How To Read This Repo
- How To Use This Repo For Yourself
- How To Extend It
.
├── assets/ # Generic repo assets such as screenshots
├── modules/ # All configuration modules (auto-imported by import-tree)
│ ├── configurations/ # Host configuration wrappers (nixosSystem, darwinSystem)
│ ├── hosts/ # Concrete machine definitions
│ │ ├── energy/
│ │ └── work-mac/
│ ├── profile/ # Personal cross-host profile data and assets
│ ├── nixos/ # NixOS-only modules
│ ├── darwin/ # nix-darwin-only modules
│ ├── home-manager/ # Home Manager modules
│ └── stacks/ # Host-facing composition modules
├── flake.nix # Flake inputs and top-level imports
├── flake.lock # Locked input versions for reproducibility
├── Makefile # Convenience rebuild/update/check commands
└── README.md # Project documentation
base/: Core system building blocks such as boot, networking, locale, users, packages, fonts, and containers.desktop/: System modules for standalone compositor environments.roles/: Higher-level system roles such as gaming.
Current desktop modules include:
desktop/compositor-common.nix: Shared system settings for standalone compositors.desktop/hyprland.nix: Hyprland system integration.desktop/niri.nix: Niri system integration.
base/: Common macOS settings such as defaults, fonts, sudo, keyboard, and user setup.
base/: Shared packages and user-level defaults.desktop/: Desktop- or window-manager-specific modules.programs/: Modules that configureprograms.*.services/: Modules that configureservices.*.scripts/: Custom helper scripts installed into the user environment.
Stacks connect system modules and Home Manager modules.
Current stacks:
linux-base.nix: Shared Linux system base plus Home Manager base.darwin-base.nix: Shared macOS system base plus Home Manager base.hyprland.nix: Hyprland environment stack.niri.nix: Niri environment stack.aerospace.nix: AeroSpace setup for macOS.
At a high level:
flake.nixusesimport-treeto auto-import all.nixfiles undermodules/modules/exports reusable named modules viaflake.modules.<class>.<name>modules/stacks/combines those modules into host-facing bundlesmodules/hosts/usesconfigurations.nixosorconfigurations.darwinplus stacks to define real machines
That means the flow is roughly:
leaf modules -> branch modules -> stacks -> hosts
This is what "dendritic" means in this repo.
Files and directories starting with _ are ignored by import-tree. This convention is used for non-module helper files that are imported explicitly by their parent module, such as:
_hardware.nix— NixOS hardware configuration (imported by the host'sdefault.nix)_colors.nix,_plugins.nix— helper data files (imported by their parent module)
If you are reading this repo for the first time, use this order:
flake.nix- one real host, for example
modules/hosts/energy/default.nix - a stack used by that host, for example
modules/stacks/hyprland.nix - the underlying modules pulled in by that stack
That gives you the high-level picture before the details.
If you want to fork this repo and adapt it for your own systems, this is the easiest path.
Fork the repository and clone your own copy.
Edit modules/profile/preferences.nix and replace:
- full name
- git key
You can also adjust fonts, icon theme, cursor theme, Catppuccin flavor/accent, locale and time zone in the same file.
Replace the asset files in modules/profile/ to match your identity:
modules/profile/avatar— user avatar imagemodules/profile/wallpaper.jpg— desktop wallpaper
The other files in modules/profile/ (primary-user.nix, primary-user-home.nix) are infrastructure — they define the primaryUser option and wire Home Manager from it. You generally do not need to edit them.
Delete or ignore hosts you do not use.
For example:
- if you only want NixOS, keep
modules/hosts/energy/as a starting point - if you only want macOS, keep
modules/hosts/work-mac/as a starting point
For a new NixOS host:
- Create a new directory under
modules/hosts/, for examplemodules/hosts/laptop/ - Add
default.nix - Generate
_hardware.nix:sudo nixos-generate-config --show-hardware-config > modules/hosts/laptop/_hardware.nix
Start from modules/hosts/energy/default.nix and change:
- hardware imports
- username
- stack choice
The new host will be auto-imported by import-tree — no manual registration needed.
Minimal example:
{ inputs, config, ... }:
let
inherit (config.flake.modules) nixos;
in
{
configurations.nixos.laptop.module = {
imports = [
./_hardware.nix
nixos.stackLinuxBase
nixos.stackHyprland
];
primaryUser = "your-user";
system.stateVersion = "26.05";
};
}For a new macOS host:
- Create
modules/hosts/my-mac/default.nix - Start from
modules/hosts/work-mac/default.nix - Change:
- the configuration attribute name (e.g.
configurations.darwin."my-mac".module) — this becomes the flake output name and should match the machine's hostname so theMakefiledefaults work primaryUser- stack choice
- the configuration attribute name (e.g.
The new host will be auto-imported by import-tree — no manual registration needed.
Common choices:
nixos.stackLinuxBase: common Linux system + Home Manager basenixos.stackHyprland: Hyprland desktop stacknixos.stackNiri: Niri desktop stackdarwin.stackBase: common macOS basedarwin.stackAerospace: AeroSpace desktop setup for macOS
Rule of thumb:
- hosts import stacks
- stacks import modules
- leaf modules stay focused
For NixOS:
sudo nixos-rebuild switch --flake .#your-nixos-machine-nameFor nix-darwin:
darwin-rebuild switch --flake .#your-macos-machine-nameOr use the Makefile:
make nixos-rebuild
make darwin-rebuild
make flake-checkRun make help for the full target list.
The Makefile defaults to:
.#$(hostname)
So it works best when the flake output name matches the machine hostname.
Put it under:
modules/home-manager/programs/<name>/default.nix
Use this for modules that define programs.*.
The file will be auto-imported by import-tree.
Put it under:
modules/home-manager/services/<name>/default.nix
Use this for modules that define services.*.
- Add a NixOS module under
modules/nixos/desktop/ - Add a Home Manager desktop module under
modules/home-manager/desktop/<your_wm_or_de>/ - Reuse
nixos.desktopCompositorCommonandhomeManager.desktopCompositorCommonwhere appropriate - Add a new stack under
modules/stacks/ - Import that stack from a host
This repository is licensed under the MIT License.


