Open Zik42 opened 1 week ago
This error occurs when there is a pre-existing configuration file and the home-manager tries to write a new configuration file. This validation prevents the loss of your current configuration file.
The “practical” way would be to move your current configuration file to a backup manually, as I didn't really make that explicit in the settings.
Thank you for pointing out this issue, I will update the order of commands to be executed, but if you are interested in opening a pull request for this fix, know that PRs are appreciated!
@lanjoni I would open, but I am new to nix. I don't know hot to approach this. Ideal solution for is to be able to run home-manager switch -b backup
so it does backup automatically. If you provide solution, I will make PR. Appreciate your fast response. And thank you for amazing example of config.
The backup command should work in case you have at least one configuration already run with home-manager. In this case, as the first run was not performed, there is no possibility of running a backup yet.
I believe that the “simplest” solution would be a script (in bash) that validates which directories and configuration files the home-manager will try to overwrite, performing an automatic backup. In this case, there must be some more practical way to do this directly with Nix, so I'll take a more careful look later, but this was the simplest way I've thought of so far.
I thank you for opening the issue and I'm glad you liked the example of configurations I've been using.
For example, I am having error when I try to do this.
home-manager switch -b backup
is not available. I tried add optionhome-manager.enable = true;
to programs block in home-manger/default.nix file, did rebuild, and did not found executable in result directory to launch home-manager.I guess it will be helpful to add, not only for me.