Hi there,
I’m planning to store my Nix configuration files on Github. However, I’m not sure what the best practices are for doing this.
Here are some questions I’m trying to figure out:
-
Should I push the configuration directly to GitHub and work with Github Actions to run the script and test the changes or something similair? (Github actions only when I push changes remotely)
-
Should I maintain a separate copy of the configuration? But in this case, I guess I need an extra script that synchronizes the two.
-
Are there other approaches commonly used in the community that I should consider?
I’d really appreciate any advice or examples from your own setups!
Thanks in advance!
Hello
So for me it is a pretty simple setup.
I have my github repo and just commit and push changes directly to git. Of course I test the changes in the config first but that is pretty much it. I have been going with this setup pretty good on my pc and laptop.
A separate copy in my opinion is not really necessary. But if you want to be sure I would save the config periodically on a USB stick or something similar, that is not accessible unless it is plugged in.
I think this setup is pretty used by the most.
I would recommend that you setup the git repo not in /etc/nixos
but rather in your home directory. Than you can write a script, that copies the changes you made in your config that is located in your home-directory to /etc/nixos
.
If you have any further questions feel free to ask