elitak / nixos-infect

[GPLv3+] install nixos over the existing OS in a DigitalOcean droplet (and others with minor modifications)
GNU General Public License v3.0
1.37k stars 221 forks source link

`mkdir: cannot create directory ‘/etc/nixos’: File exists` #219

Closed InAnYan closed 1 week ago

InAnYan commented 1 week ago

I've passed my custom config into /etc/nixos/custom.nix.

But it fails when I run the nixos-infect. Line is: https://github.com/elitak/nixos-infect/blob/master/nixos-infect#L24.

How do you properly pass a custom config?

InAnYan commented 1 week ago

It means that there is a file nixos in /etc, but how?

I use Terraform and Hetzner Cloud

InAnYan commented 1 week ago

Okay, here is the update. I'll close the issue.

I used Terraform and provisioner "file" like this:

provisioner "file" {
    source = "configuration.nix"
    destination = "/etc/nixos/custom.nix"
}

Turned out it somehow messed with the files and made nixos file. Whatever, I copied the config to /tmp and then back again in installation script (remote-exec) to /etc/nixos/.

Sorry for the false alert