Place Actual Files Instead of Symlinks

I am looking for an efficient way to automatically convert my Nix Home Manager dotfiles to regular dotfiles because I want to be able to use them on other distributions without Home Manager. I have been using Home Manager options for configuring various applications, as well as home.file."filenamehere" etc. for managing dotfiles. I was thinking of not only placing them in the ~/.config directory, but also in some sort of ~/dotfiles directory so that I could initialize a repository there and back them up.

However, I have realized that Home Manager doesn’t actually place files; instead it places symbolic links to files it generates in the Nix store. I am now looking for either a way to create actual files, or another way to achieve this functionality.

I should also mention why I don’t just keep the regular dotfiles in my Nix configuration directory and then place them using Home Manager: I am making great use of all the Nix functionality like Nix Colors, Stylix, and just general Nix features, which is the whole point of using Home Manager in the first place.

Any help will be greatly appreciated. Thank you in advance!

There isn’t anything stopping you from installing nix and home-manager on another distro. That would probably be the solution with the least sacrifices.

You might also just be able to make a copy of your home directory using cp -rL and migrate that to another machine as well, but updates could get messy.

1 Like

I still don’t understand why they can’t be symlinks?

cp -rL works like a charm for my needs! Thanks!

Because I want to backup the dotfiles that have already been generated, not just the .nix files. Thanks for the reply!