Migrate to Den
Start Small
Section titled “Start Small”Den can be adopted incrementally. You don’t need to rewrite your entire configuration — start by adding one Den-managed host alongside your existing setup.
From Flake-Parts Dendritic
Section titled “From Flake-Parts Dendritic”If you’re already using flake.modules, migration is direct:
# Before (flake-parts dendritic)flake.modules.nixos.desktop = { ... };flake.modules.homeManager.games = { ... };
# After (Den)den.aspects.desktop.nixos = { ... };den.aspects.games.homeManager = { ... };Import Existing Modules
Section titled “Import Existing Modules”You don’t need to convert all modules. Import them directly:
{ inputs, ... }: { den.aspects.desktop.nixos.imports = [ inputs.disko.nixosModules.disko inputs.self.modules.nixos.desktop # existing module ];}Mix Den with Existing nixosSystem
Section titled “Mix Den with Existing nixosSystem”Use mainModule to integrate Den into existing configurations:
let denCfg = (lib.evalModules { modules = [ (import-tree ./modules) ]; specialArgs = { inherit inputs; }; }).config;in lib.nixosSystem { modules = [ ./hardware-configuration.nix # your existing modules ./networking.nix denCfg.den.hosts.x86_64-linux.igloo.mainModule # Den modules ]; }Use import-tree for Gradual Migration
Section titled “Use import-tree for Gradual Migration”The import-tree battery auto-imports files by class directory:
non-dendritic/ hosts/ my-laptop/ _nixos/ hardware.nix networking.nix _homeManager/ shell.nixden.ctx.host.includes = [ (den._.import-tree._.host ./non-dendritic/hosts)];Files in _nixos/ import as NixOS modules, _homeManager/ as HM modules.
Access Den Configurations Directly
Section titled “Access Den Configurations Directly”Den’s outputs are standard Nix configurations:
# These are normal nixosSystem / homeManagerConfiguration resultsconfig.flake.nixosConfigurations.iglooconfig.flake.homeConfigurations.tuxExpose them directly in your flake outputs alongside existing ones.
Recommended Migration Path
Section titled “Recommended Migration Path”- Add Den inputs to your flake
- Create a
modules/directory withhosts.nix - Add one host with
den.hosts - Move one aspect at a time from existing modules
- Use
import-treefor files you haven’t converted yet - Gradually expand Den-managed aspects