Improve providers fix dns (#58)

* remove digitalocean as default; fix digitalocean dns; update channels

fixes #53
fixes #49

* fix doNetConf check
This commit is contained in:
DavHau 2020-08-21 22:57:57 +07:00 committed by GitHub
parent e65ec1dba5
commit 30441b1236
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View file

@ -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.

View file

@ -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!