Home Manager Modules
Always prefer programs.* over home.packages. Use the NixOS MCP to check if home-manager has a module before falling back.
Adding a New Tool
- •Search home-manager:
mcp__nixos__nix(action="search", source="home-manager", type="programs", query="<tool>") - •Has
programs.<tool>.enable? Use theprograms.*template - •No module? Use the
home.packagesfallback - •Create
modules/home-manager/packages/<tool>/default.nix - •Add
(pkg "tool")to bothhosts/personal.nixandhosts/work.nix
Template: with home-manager module (preferred)
nix
{
pkgs,
...
}:
{
programs.tool = {
enable = true;
enableZshIntegration = true; # if available — usually want true
settings = { }; # if available — declarative config
};
}
Common options: enable, package, enableZshIntegration, enableGitIntegration, settings.
Template: without home-manager module (fallback)
nix
{
pkgs,
...
}:
{
home.packages = [ pkgs.tool ];
}
Template: with settings or external inputs
nix
{
pkgs,
settings,
inputs,
...
}:
{
programs.tool = {
enable = true;
package = inputs.tool-flake.packages.${pkgs.system}.default;
};
}
Cross-Tool References
Always use ${pkgs.tool}/bin/tool — never hardcode paths.
nix
fileWidgetOptions = [
"--preview '${pkgs.bat}/bin/bat --color=always {}'"
];
shellAliases = {
cat = "${pkgs.bat}/bin/bat";
};
Gotchas
- •One
programsblock per module — statix errors on repeated attribute keys - •
enableZshIntegrationprovides aliases and completions — usually wanttrue - •
home.activationfor imperative actions: uselib.hm.dag.entryAfter [ "writeBoundary" ]