Home-manager questions


I’m still building my nixos config. Now I added home-manger to mantain my config files. There are two problems though:

If I add this to home.nix:

".config".source = dotfiles/.config;

Then building fails with:

home-manager switch --flake .#scip                                                                                                      
error: builder for '/nix/store/2w72x7lgqjkmbysxxadldxlamplg7fyw-home-manager-files.drv' failed with exit code 1;                        
       last 1 log lines:                                                                                                                
       > Error installing file '.config/environment.d/10-home-manager.conf' outside $HOME                                               
       For full logs, run 'nix-store -l /nix/store/2w72x7lgqjkmbysxxadldxlamplg7fyw-home-manager-files.drv'.                            
error: 1 dependencies of derivation '/nix/store/k1992lmnnx30crjqxnqpc5znyyk1n1d4-home-manager-generation.drv' failed to build           
make: *** [Makefile:19: build-user] Error 1 

So, do I have to add every single file in .config separately?

And I have a problem with my emacs config. I maintain it in its own git repo so I added a submodule. Now everytime I try to build, I get this message:

error: getting status of '/nix/store/xyv4wrbz1iwr1qhld32c2b53dnphaq0q-source/dotfiles/dot-emacs': No such file or directory

After git commit this goes away. However, I need to commit ANY change to the whole nix config tree in order to be able to build anything. So my repo will end up having thousands of non-sensical commits. Is there a way to circumvent this?

Here’s the nix config repo: GitHub - TLINDEN/nixos-config: My personal nixos config

thanks in advance,

You could try:

home.file.“.config” = {
recursive = true;
source = dotfiles/.config;

I would only include the files that I edit by hand, to avoid any conflicts. Or at least make exceptions for files that the system handles by other means, like .config/environment.d/10-home-manager.conf and .config/systemd/.