Home-Manager Integration
import { Aside } from ‘@astrojs/starlight/components’;
Automatic HM Detection
Section titled “Automatic HM Detection”Den automatically detects hosts that need Home-Manager. When a host has
users with class = "homeManager" (the default), Den:
- Imports the Home-Manager NixOS/Darwin module
- Creates a
homeManagerclass for each user - Forwards
homeManagerconfigs intohome-manager.users.<name>
No explicit opt-in needed — just declare users.
graph LR
Host["{host}"] -->|"hm-detect"| Check{"class ∈ nixos,darwin?<br/>HM users exist?<br/>HM module available?"}
Check -->|"yes"| HM["ctx.hm-host<br/>imports HM module"]
HM -->|"per user"| FW["forward homeManager<br/>→ home-manager.users.‹name›"]
Check -->|"no"| Skip["HM pipeline skipped"]
Host-Managed Users
Section titled “Host-Managed Users”den.hosts.x86_64-linux.igloo.users.tux = { };den.default.homeManager.home.stateVersion = "25.11";
den.aspects.tux.homeManager.programs.vim.enable = true;The vim config is forwarded into igloo.home-manager.users.tux.
Standalone Home-Manager
Section titled “Standalone Home-Manager”For Home-Manager without an OS host:
den.homes.aarch64-darwin.vic = { };den.default.homeManager.home.stateVersion = "25.11";den.aspects.vic.homeManager.programs.fish.enable = true;Build with home-manager switch --flake .#vic.
The define-user Battery
Section titled “The define-user Battery”Use den._.define-user to automatically set username and home directory:
den.default.includes = [ den._.define-user ];This sets home.username, home.homeDirectory, and
users.users.<name> on both NixOS and Darwin.
useGlobalPkgs
Section titled “useGlobalPkgs”Configure Home-Manager to use the host’s nixpkgs:
den.ctx.hm-host.nixos.home-manager.useGlobalPkgs = true;This only activates for hosts that actually have Home-Manager users. Hosts without users are unaffected.
Custom HM Module
Section titled “Custom HM Module”Override the Home-Manager module source:
den.hosts.x86_64-linux.igloo = { hm-module = inputs.home-manager-unstable.nixosModules.home-manager; users.tux = { };};Standalone with osConfig
Section titled “Standalone with osConfig”Access NixOS config from standalone Home-Manager:
den.homes.x86_64-linux.pingu = { instantiate = { pkgs, modules }: inputs.home-manager.lib.homeManagerConfiguration { inherit pkgs modules; extraSpecialArgs.osConfig = config.flake.nixosConfigurations.igloo.config; };};
den.aspects.pingu.homeManager = { osConfig, ... }: { programs.emacs.enable = osConfig.programs.vim.enable;};Context Hooks
Section titled “Context Hooks”Use den.ctx.hm-host to configure things only when HM is active:
den.ctx.hm-host.nixos.home-manager.useGlobalPkgs = true;den.ctx.hm-host.includes = [ { nixos.home-manager.backupFileExtension = "bak"; }];These only apply to hosts that have Home-Manager users with a supported OS (NixOS or Darwin).