Home-manager, real dry run?

Is there a way to do a real dry run in home manager, that does not do any downloading or building?

Currently home-manager -n switch will still download all the stuff that is necessary to actually do the switch, though it will not build things that are not available from the cache and locally.

And home-manager -n build created a ./result symlink when I tried it right now…

I’m asking, as I want to have a pre-commit hook that checks if my current config is syntactically correct and the options given make sense or even worse are not mutually exclusive.

The --dry-run option only relates to home-manager’s activation script. The hm config is always built when running home-manager.
To only evaluate the config without building it, run

nix-instantiate --eval <home-manager/home-manager/home-manager.nix> \
  --argstr confPath /my/config.nix \
  --argstr confAttr "" \
  -A activationPackage.outPath
1 Like

Thanks, seems to work for my use case!

I’ve updated my solution to just evaluate the config and skip the instantiation of .drv files.