Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

185 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nix

Personal Nix configuration for multiple machines (NixOS + home-manager), built as a single flake.

Repository general structure

The flake wires together flake-parts, import-tree, and den. It is organized with the dendritic pattern and the den framework.

Dendritic pattern

import-tree ./modules recursively imports every .nix file under modules/ except files prefixed with _. As a result:

  • Each file is a self-contained, top-level module implementing one feature (it can contribute NixOS, home-manager, and darwin config at once).
  • There is no manual registry of imports — dropping a file under modules/ activates it.
  • File paths are just organization, not semantics; files can be renamed, merged, or split without changing behavior.
  • _-prefixed files (e.g. _hardware-configuration.nix) are skipped by import-tree and are meant to be imports-ed manually from elsewhere.

Den framework & the aspects pattern

Den layers a few concerns on top of the dendritic module tree. The central one is the aspects pattern:

  • Aspects (den.aspects.<name>) are composable bundles of config that span multiple Nix classes (nixos, homeManager, darwin, ...) in one place — "what a feature does."
  • An aspect can pull in other aspects (or den's built-in batteries) via includes, so features compose transitively.
  • Entities — hosts and users — are declared under den.hosts.<system>.<hostname>.users.<user> and opt into aspects.
  • Aspect functions take typed context parameters ({ host, user, ... }) and Den decides whether an aspect applies based on the available context, instead of enable flags or lib.mkIf conditionals.

Den also automatically creates an aspect for every host and every user. For example, declaring den.hosts.x86_64-linux.zagreus.users.lorenzo yields a den.aspects.zagreus aspect and a den.aspects.lorenzo aspect that hold that entity's own config (see modules/hosts/zagreus/default.nix).

Learn more:

Hosts

Each host is declared under modules/hosts/<name>/default.nix via den.hosts.<system>.<hostname>. The den.default aspect applies to every host, and the user aspect lorenzo (which itself pulls in shell, ai, and sops) applies to its user. For desktops and VMs, Basic features / Services names the desktop environment in use; for servers it lists the services the host runs instead. See Aspects below for the full aspect breakdown behind each host.

Host Machine System Type Basic features / Services
zagreus Beelink SER8 x86_64-linux Desktop Hyprland with Noctalia
nixvm Virtual machine x86_64-linux VM Hyprland with Noctalia
nyx GMKtec G5 (Intel N95, 12GB RAM) x86_64-linux Server Traefik, Technitium DNS, Glance

Build/deploy a host with:

nixos-rebuild switch --flake .#<host>

Aspects

Feature aspects defined under modules/, and the other aspects each one pulls in via includes. Host aspects (zagreus, nixvm, nyx) and the user aspect (lorenzo) are auto-generated by den from the entities declared above and are covered by the Hosts table instead.

Aspect Description Includes
base Foundational config for every machine: SSD trim, bootloader, networking, core CLI packages hardware.ssd, boot.limine, networking.networkmanager
base.nixos NixOS-level extension point for base (currently no active settings)
boot.kernel-cachyos CachyOS kernel overlay (linuxPackages-cachyos-bore)
boot.kernel-latest Latest upstream kernel (linuxPackages_latest)
boot.limine Limine bootloader
boot.plymouth Plymouth boot splash
desktop Core desktop environment: dconf, zram swap, cursor theme, fonts, wallpapers hardware.firmware, desktop.sound, desktop.printing
desktop._1password 1Password GUI + CLI
desktop.bambu-studio Bambu Studio 3D-printing slicer
desktop.base-applications Browsers, terminals, office/media apps installed on every desktop desktop._1password
desktop.bluetooth Blueman applet hardware.bluetooth
desktop.gaming Steam, Proton-GE/CachyOS, Gamescope, ananicy-cpp
desktop.hyprland Hyprland compositor + session management desktop, desktop.wm, desktop.base-applications, desktop.wm-applications, desktop.wlr-which-key, desktop.noctalia-greeter, desktop.noctalia
desktop.messaging Telegram Desktop, Vesktop (Discord)
desktop.noctalia Noctalia shell/bar for Hyprland desktop.noctalia-greeter
desktop.noctalia-greeter noctalia-greeter login greeter
desktop.printing CUPS printing
desktop.sound PipeWire audio stack
desktop.vicinae Vicinae app launcher
desktop.wlr-which-key wlr-which-key keybinding menu
desktop.wm Services needed by any window manager (keyring, gvfs, udisks2, ...)
desktop.wm-applications Nautilus, file-roller, Satty screenshot annotator desktop.vicinae
desktop.work Slack, Teams for Linux
development Dev toolchain: Rust, Node/Deno/Bun, gcc, gdb, direnv, lazygit
docker Docker daemon + user group
glance Glance homelab dashboard
hardware.bluetooth Bluetooth hardware support
hardware.btrfs Weekly Btrfs scrub + smartd
hardware.cpu-amd AMD CPU/pstate/zenpower support
hardware.cpu-intel Intel CPU support
hardware.firmware fwupd firmware updates
hardware.igpu-amd AMD iGPU kernel params, mesa/libva, RADV
hardware.igpu-intel Intel iGPU support
hardware.ssd fstrim
networking Base networking: Avahi/mDNS, cifs-utils networking.networkmanager, networking.firewall, networking.tailscale
networking.firewall Firewall, aggregating ports contributed by other aspects
networking.networkmanager NetworkManager, systemd-resolved networking.firewall
networking.tailscale Tailscale
shell Fish shell, aliases, and interactive-shell HM programs (starship, fzf, zellij, ...)
sops sops-nix secrets management
technitium Technitium DNS server
theming.base Base GTK/Qt theming
theming.catppuccin Catppuccin theme across NixOS and Home Manager apps theming.base
traefik Reverse proxy with Cloudflare DNS-01 ACME

Add a new host

See docs/new-host.md.

Acknowledgments

This configuration's structure is built on top of:

About

Nix config for my homelab

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages