diff --git a/README.md b/README.md index ded257c..44e585a 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ cat and EOF in the Digital Ocean Web UI (or HTTP API): #cloud-config runcmd: - - curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | PROVIDER=digitalocean NIX_CHANNEL=nixos-19.09 bash 2>&1 | tee /tmp/infect.log + - curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | PROVIDER=digitalocean NIX_CHANNEL=nixos-20.03 bash 2>&1 | tee /tmp/infect.log ``` Potential tweaks: - `/etc/nixos/{,hardware-}configuration.nix`: rudimentary mostly static config @@ -67,7 +67,7 @@ write_files: environment.systemPackages = with pkgs; [ vim ]; } runcmd: - - curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | PROVIDER=digitalocean NIXOS_IMPORT=./host.nix NIX_CHANNEL=nixos-19.09 bash 2>&1 | tee /tmp/infect.log + - curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | PROVIDER=digitalocean NIXOS_IMPORT=./host.nix NIX_CHANNEL=nixos-20.03 bash 2>&1 | tee /tmp/infect.log ``` @@ -78,7 +78,7 @@ To set up a NixOS Vultr server, instantiate an Ubuntu box with the following "St ```bash #!/bin/sh -curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | PROVIDER=vultr NIX_CHANNEL=nixos-19.09 bash +curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-20.03 bash ``` Allow for a few minutes over the usual Ubuntu deployment time for NixOS to download & install itself. diff --git a/nixos-infect b/nixos-infect index 960e49a..ae0f21a 100755 --- a/nixos-infect +++ b/nixos-infect @@ -18,7 +18,7 @@ makeConf() { done local network_import="" - [ "$PROVIDER" = "digitalocean" ] && network_import="./networking.nix # generated at runtime by nixos-infect" + [ ! -z "$doNetConf" ] && network_import="./networking.nix # generated at runtime by nixos-infect" cat > /etc/nixos/configuration.nix << EOF { ... }: { imports = [ @@ -46,7 +46,7 @@ EOF } EOF - if [ "$PROVIDER" = "digitalocean" ] + if [ ! -z "$doNetConf" ] then makeNetworkingConf else @@ -95,9 +95,7 @@ EOF # This file was populated at runtime with the networking # details gathered from the active system. networking = { - nameservers = [$(for a in "${nameservers[@]}"; do echo -n " - \"$a\""; done) - ]; + nameservers = [ "8.8.8.8" ]; defaultGateway = "${gateway}"; defaultGateway6 = "${gateway6}"; dhcpcd.enable = false; @@ -268,7 +266,8 @@ infect() { /nix/var/nix/profiles/system/bin/switch-to-configuration boot } -[ -z "$PROVIDER" ] && PROVIDER="digitalocean" # you may also prepend PROVIDER=vultr to your call instead +[ "$PROVIDER" = "digitalocean" ] && doNetConf=y # digitalocean requires detailed network config to be generated + prepareEnv makeSwap # smallest (512MB) droplet needs extra memory!