ryantm / home-manager-template

A quick-start template for using home-manager in a more reproducible way.
https://github.com/ryantm/home-manager-template
Creative Commons Zero v1.0 Universal
112 stars 5 forks source link

Using config.home.username and config.home.homeDirectory in template #7

Closed 573 closed 3 years ago

573 commented 3 years ago

I tried to use {..., config, ...} config.home.username and config.home.homeDirectory in home.nix rather than hardcoding but it rather generates:

while evaluating the attribute 'home.homeDirectory' at undefined position:

573 commented 3 years ago

In case it is needed one can use that as a reference: https://github.com/nix-community/home-manager/blob/ac319fd3149b23a3ad8ee24cb2def6e67acf194c/modules/home-environment.nix#L449 Baseline:

home.username = (builtins.getEnv "USER");
home.homeDirectory = (builtins.getEnv "HOME");

More explanation:
https://github.com/nix-community/home-manager/blob/b95ad632010bf1d135f7585c590f51f6c3dc2896/doc/release-notes/rl-2009.adoc#L21 says that builtins.getEnv was used before (HOME and USER respectively)