Search code examples
nix

How to refer to user's home directory in configuration.nix?


I can't seem to refer to ${users.users.username.home} within the same file where this configuration is set up:

undefined variable 'users'

How should I refer to this piece of configuration from within the same file? In case it's relevant, both users.users.username and the reference are in a file included by /etc/nixos/configuration.nix.


Solution

  • I just needed config. at the start of the reference: ${config.users.users.username.home}.