I already have a setup with home-manager. The thing I want to know is if there is an easy way rather than doing home-manager switch every time I do a change.
For example, I have my nvim config in ~/dotfiles/config/nvim and my home-manager/home.nix has this setup:
This is not only for nvim, but for other configs like wezterm, a terminal that reloads the config on save.
Is there a way I could do that with home-manager? Is very tedious to change something and the need of creating a new generation just to see the new change.
it will copy your config to store before creating a symlink and you will need to home-manager switch --flake everytime (note: --impure might bypass copying i didint tried tough)
note: you can use functions to abstract some of abslute paths
This is one of the more helpful threads I found by searching for this issue, so I wanted to add something that might be useful. I’m very new to all this, so I’m sorry if it’s obvious!
if you are using flakes you need to use abslute path as string
According to this comment, you can re-use home-manager’s config variable instead of hardcoding the home path. In other words, use ${config.home.homeDirectory} instead of /home/user. Since home-manager requires that be set anyway, and these symlinks are probably going to be created inside the home directory, it seems like a clear way around the “must use absolute paths” issue, as well, without needing other functions.
Thank you for adding the link. Though it feels critical to mention that there is ALWAYS a need for documentation. Without documentation, the only ways to know this function even exists is to either have read through the code base yourself or be directly told by someone else. There is no mention of this thing anywhere in the home-manager manual (even in the release notes for when it was added).
Again thanks for taking the time to link the specific commit it was added in as well. It does include some useful info in the commit message.