-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy .nix files to /etc/nixos as well? #39
Comments
Some sort of find / scp / rsync combo is not good , because I also have some |
The best option is to delete /etc/nixos on the target machine. You can do that by using the "remote-exec" provisioner, or by adding it in a systemd unit in the machine configuration.nix. It would be nice if it was possible to copy all the nix files onto the server, so that it can be rebuilt manually, but that's quite difficult to achieve. To reproduce the config, deploy_nixos would have to capture not only the configuration.nix, but also be able to follow all the imported modules. And which version of nixpkgs is being used. |
I came up with this "contraption" 🙂
Obviously this is just an approximation, since nixpkgs might be different on remote machine. |
🙈 Another thing you can do is set |
There is also https://search.nixos.org/options?channel=20.09&show=system.copySystemConfiguration&from=0&size=30&sort=relevance&query=copy , but that only works if the config is self-contained into a single file. |
First apologies for asking a noob question. I am playing around with deploy_nixos w/ DigitalOcean droplets and everything works great so far. I use a templatefile to generate configuration.nix (for IPs and stuff) and have some imports ala
Now what I would like to achieve is beside applying the configuration also copying the closure of all nix files to /etc/nixos on the machine somehow (you might imagine that also common.nix imports some
blahblah/one.nix
and that should become/etc/nixos/blahblah/one.nix
then and so on). The server is converted through nixos-infect from Ubuntu 20.04 so in /etc/nixos there is still the stuff left fromnixos-infect
. Of course the usually way should beterraform apply
from my workstation but I am worried that I might callnixos-rebuild switch
by mistake directly on the server which could lead to problems. Or should I justrm -rf /etc/nixos
on the server?The text was updated successfully, but these errors were encountered: