How to use `xdg.configFile` with home-manager and nix-darwin?

So I’ve followed the basic instructions to install Nix on my macOS machine, followed by nix-darwin, and finally home-manager. I’ve got all the basics working, including a custom Firefox profile and add-ons. Amazing!

But I can’t seem to get my configuration files to copy over. I have a lua-based neovim config split into many files, so I want to just copy that whole directory structure into my ~/.config directory using home-manager. On Linux I do this:

xdg.configFile."nvim".source = ../conf.d/nvim;

And it copies over my config. But on macOS I get this error:

building the system configuration...
error: builder for '/nix/store/dnznq01p5ks966ya24ya7qlmq18g7z97-home-manager-files.drv' failed with exit code 1;
       last 1 log lines:
       > Error installing file '.config/nvim/init.vim' outside $HOME
       For full logs, run 'nix log /nix/store/dnznq01p5ks966ya24ya7qlmq18g7z97-home-manager-files.drv'.
error: 1 dependencies of derivation '/nix/store/wbrlxfwvw7f8mfp680bnw73wn8757n38-home-manager-generation.drv' failed to build
error: 1 dependencies of derivation '/nix/store/xql73y42ds3xsxq7g4hs41ml4w1bll2g-activation-chianuo.drv' failed to build
error: 1 dependencies of derivation '/nix/store/6xq6k0z6qq0nxcip5ym9pvydk9qrhnvz-darwin-system-21.11.20210606.4df3175+darwin4.007d700.drv' failed to build

Why does it think it’s trying to move it outside $HOME? What is the way to do this on macOS?

2 Likes

What is your home.stateVersion? And what is your home.homeDirectory? (I hope I remember the name of that option correctly)