Skip to content

Flake parts dendritic#1

Closed
GuillaumeLagrange wants to merge 14 commits intomainfrom
flake-parts-dendritic
Closed

Flake parts dendritic#1
GuillaumeLagrange wants to merge 14 commits intomainfrom
flake-parts-dendritic

Conversation

@GuillaumeLagrange
Copy link
Copy Markdown
Owner

No description provided.

Wrap outputs in flake-parts.lib.mkFlake as Phase 1 of the flake-parts
migration. Per-system pkgs/pkgs-unstable are now built once in perSystem
via _module.args, and flake-level outputs pull both linux and darwin
contexts via withSystem.

No behavior change: nixosConfigurations (badlands, gullywash,
guiom-nixos-installation) and homeConfigurations (guillaume, codspeed,
guillaume@gullywash) keep their existing wiring. Host default.nix files
and mkHomeManagerModule are unchanged.
Phase 2 of the flake-parts migration. Break flake.nix into one file per
concern under parts/: systems, per-system pkgs, shared lib (sshPublicKey
and mkHomeManagerModule via _module.args), one file per home
configuration, one file per NixOS host.

Import home-manager's flake-parts module (flakeModules.home-manager) so
flake.homeConfigurations can be merged across multiple files.

No behavior change: all four configurations evaluate to the same
derivation paths as before.
Phase 3 of the flake-parts migration. Replace the explicit imports list
with inputs.import-tree ./parts, and introduce the dendritic
intermediate-option pattern from mightyiam/dendritic so new hosts and
home configurations can drop a single file under parts/ without touching
any shared plumbing.

New parts files:
- flake-parts.nix: imports home-manager's flakeModules so
  flake.homeConfigurations merges cleanly across files.
- configurations-nixos.nix: declares
  configurations.nixos.<name>.module (deferredModule) and derives
  flake.nixosConfigurations via mapAttrs + nixpkgs.lib.nixosSystem.
- configurations-home.nix: declares configurations.home.<name> with
  pkgs/modules/extraSpecialArgs and derives flake.homeConfigurations.

Hosts and home configurations now set configurations.nixos.<name>.module
or configurations.home.<name>.* instead of flake.*. The ISO host sets
nixpkgs.hostPlatform explicitly (the other hosts inherit it from
hosts/common.nix).

No behavior change: all four existing configurations evaluate to the
same derivation paths as Phase 2.
Introduce parts/home-manager-nixos.nix declaring a
flake.modules.nixos.home-manager-base module that centralises
the home-manager-on-NixOS wiring (useGlobalPkgs, extraSpecialArgs,
stylix import, etc.). Hosts now import this named module directly
instead of calling the mkHomeManagerModule helper.

Convert the tmux home-manager module into a named flake module
(flake.modules.homeManager.headless-tmux) under parts/headless/.
Expose the full homeManager namespace as hmModules via
extraSpecialArgs so existing modules/*.nix files can pick up
named modules by reference.

First step of a larger migration of modules/ into parts/.
Move modules/headless/ to parts/headless/ and re-express the headless
profile as a set of named flake modules
(flake.modules.homeManager.headless-{tmux,zellij,zsh,headless}).
Data files (tmux.conf, zellij.kdl, shell scripts, gpg keys) move with
them. Plain-derivation files (gitPushStack, untar) get underscore-
prefixed so import-tree ignores them.

Drop the tmux.enable / zellij.enable / headless.enable gating. These
options only existed because modules were imported unconditionally; in
the new namespace, presence in a host's module list is the gate.

modules/home-manager.nix still aggregates every feature module, so it
imports the four new named modules via hmModules. Hosts-level wiring
is untouched this commit; host evaluation continues to behave the same
(packages, aliases, programs enabled identically).
Move modules/{codspeed,stockly,stylix} into parts/ as named flake
modules. codspeed and stockly keep their .enable flag (host-specific
opt-in) and declare the option on the named module itself. stylix is
declared under both homeManager and nixos classes for cross-class use.

Drop hosts/{badlands,gullywash}/default.nix — these only existed to be
called from the pre-flake-parts output block and have been replaced by
parts/hosts/*.nix.

All references to modules/stylix/common.nix switch to the named module
(config.flake.modules.homeManager.stylix-common or the nixos variant).
Move the top-level home-manager config (xdg userDirs, fontconfig,
sessionVariables, enable-flag defaults) into a named
flake.modules.homeManager.profile module. The list of modules every
host bundles is exposed via a flake-parts option homeProfileModules
(profile + headless + tmux/zellij/zsh + codspeed + stockly + stylix-home
+ the still-unmigrated modules/gui). Using an option rather than cross-
referencing flake.modules.homeManager.* from inside another
flake.modules entry avoids evaluation cycles.

configurations.home.* and home-manager-base now splice
homeProfileModules into their module list. Drop the hmModules
extraSpecialArg — no longer used.
Every file under modules/gui becomes a flake.modules.homeManager.gui-*
named module. The aggregator default.nix becomes flake.modules.homeManager.gui,
dropping its imports list (each sibling is imported explicitly by
homeProfileModules instead).

Assets (swappy.conf, sway.config, waybar.css, wallpapers/, python
scripts) move alongside the modules. move-to-bottom-right, which is a
derivation producer rather than a module, is renamed with an underscore
prefix so import-tree skips it; sway.nix imports it by path.

Every gui-* named module is added to homeProfileModules so every host
receives the same set of gui options regardless of whether gui.enable
is true or false.
modules/secure_boot.nix becomes flake.modules.nixos.secure-boot and
pulls lanzaboote from inputs directly. badlands imports it by name.

The hosts/ directory dissolves entirely. configuration.nix,
hardware-configuration.nix, oneleet.nix, zfs.nix, common.nix,
watch-downloads.sh move into parts/hosts/<hostname>/ (or parts/hosts/
for the shared common.nix). All these files are NixOS modules, not
flake-parts modules, so they're underscore-prefixed to keep
import-tree from picking them up.

With this commit modules/ and hosts/ no longer exist; every Nix file
lives under parts/.
Create flake.modules.homeManager.headless-linux and
flake.modules.homeManager.codspeed-linux, holding the packages and
shell aliases that only make sense on Linux (killall, nh, pciutils,
nh/systemctl aliases, mongodb-compass, kcachegrind, valgrind
wrapper, zsh systemd plugin).

Expose them via a new homeProfileLinuxModules list; Linux hosts
append both lists, darwin appends only homeProfileModules. The
lib.optionals stdenv.isLinux / lib.optionalAttrs pkgs.stdenv.isLinux
branches disappear from the cross-platform files.
Document the conventions: the underscore-prefix rule for non-modules,
the flake.modules.<class>.<name> namespace, the homeProfileModules
split, and walk-throughs for adding a feature / host / home config.
Also note the infinite-recursion gotcha when one named module tries
to import another.
The last remaining pkgs.stdenv.isLinux check in the shared profile
(guarding xdg.userDirs and mimeapps.list) becomes its own
flake.modules.homeManager.profile-linux, added to
homeProfileLinuxModules. The shared profile module is now fully
cross-platform with no runtime Linux check.

Only the sway/hyprland keybinding guards in headless/tmux.nix remain,
which are defensive checks around options that only exist when those
wayland compositors are imported.
Move the sway and hyprland keybindings from headless/tmux.nix into a
new flake.modules.homeManager.headless-tmux-linux and add it to
homeProfileLinuxModules. This drops the last two runtime
pkgs.stdenv.isLinux checks in the repo.
@GuillaumeLagrange GuillaumeLagrange deleted the flake-parts-dendritic branch April 20, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant