Closed ydlr closed 3 years ago
I had to make a few changes to get this to work again (DO did some breaking changes...that I was already working on in one of my branch) I'll try and get the fixes for this up soon. Thanks for the tests!
this is what i had a few weeks ago
diff --git a/nixops_digitalocean/backends/droplet.py b/nixops_digitalocean/backends/droplet.py
index fa71cbc..f38448f 100644
--- a/nixops_digitalocean/backends/droplet.py
+++ b/nixops_digitalocean/backends/droplet.py
@@ -127,7 +127,8 @@ class DropletState(MachineState[DropletDefinition]):
networking = {
"defaultGateway": self.default_gateway,
- "nameservers": ["8.8.8.8"], # default provided by DO
+ "nameservers": ["67.207.67.2", "67.207.67.3"], # default provided by DO
+ #("dhcpcd", "enable"): False,
("interfaces", "ens3", "ipv4", "addresses"): [
{"address": self.public_ipv4, "prefixLength": prefix_len(self.netmask)}
],
@@ -236,9 +237,9 @@ class DropletState(MachineState[DropletDefinition]):
self.public_ipv4 = droplet.ip_address
self.log_end("{}".format(droplet.ip_address))
- # Not sure when I'd have more than one interface from the DO
- # API but networks is an array nevertheless.
- self.default_gateway = droplet.networks["v4"][0]["gateway"]
+ for n in droplet.networks["v4"]:
+ if n["ip_address"] == self.public_ipv4:
+ self.default_gateway = n["gateway"]
self.netmask = droplet.networks["v4"][0]["netmask"]
first_ipv6 = {}
diff --git a/nixops_digitalocean/data/nixos-infect b/nixops_digitalocean/data/nixos-infect
index f7bcce6..7c315f2 100644
--- a/nixops_digitalocean/data/nixos-infect
+++ b/nixops_digitalocean/data/nixos-infect
@@ -98,6 +98,7 @@ EOF
];
defaultGateway = "${gateway}";
defaultGateway6 = "${gateway6}";
+ #dhcpcd.enable = false;
interfaces = {
ens3 = {
ipv4.addresses = [$(for a in ${ens3_ip4s[@]}; do echo -n "
@@ -158,13 +159,16 @@ curl -L https://nixos.org/nix/install | sh
source ~/.nix-profile/etc/profile.d/nix.sh
-[ -z "$NIX_CHANNEL" ] && NIX_CHANNEL="nixos-19.03"
+[ -z "$NIX_CHANNEL" ] && NIX_CHANNEL="nixos-20.09"
nix-channel --remove nixpkgs
nix-channel --add "https://nixos.org/channels/$NIX_CHANNEL" nixos
nix-channel --update
export NIXOS_CONFIG=/etc/nixos/configuration.nix
+export LANGUAGE="C"
+export LC_ALL="C"
+
nix-env --set \
-I nixpkgs=$HOME/.nix-defexpr/channels/nixos \
-f '<nixpkgs/nixos>' \
@ydlr do you think this should be good to go? and this has the commits from the other PR too right?
Yes. Should be good to go. It does include everything from the other PR, too. All the tests passed.
This allows DigitalOcean droplets to be brought up and down with
nixops start
andnixops stop