mirror of
https://github.com/elitak/nixos-infect
synced 2024-11-09 21:44:22 +00:00
Add provider autodetection for hetzner (#174)
This commit is contained in:
parent
9c5b46d78e
commit
6712970770
1 changed files with 10 additions and 0 deletions
10
nixos-infect
10
nixos-infect
|
@ -4,6 +4,12 @@
|
||||||
|
|
||||||
set -e -o pipefail
|
set -e -o pipefail
|
||||||
|
|
||||||
|
autodetectProvider() {
|
||||||
|
if [ -e /etc/hetzner-build ]; then
|
||||||
|
PROVIDER="hetznercloud"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
makeConf() {
|
makeConf() {
|
||||||
# Skip everything if main config already present
|
# Skip everything if main config already present
|
||||||
[[ -e /etc/nixos/configuration.nix ]] && return 0
|
[[ -e /etc/nixos/configuration.nix ]] && return 0
|
||||||
|
@ -375,6 +381,10 @@ infect() {
|
||||||
/nix/var/nix/profiles/system/bin/switch-to-configuration boot
|
/nix/var/nix/profiles/system/bin/switch-to-configuration boot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ ! -v PROVIDER ]; then
|
||||||
|
autodetectProvider
|
||||||
|
fi
|
||||||
|
|
||||||
[ "$PROVIDER" = "digitalocean" ] && doNetConf=y # digitalocean requires detailed network config to be generated
|
[ "$PROVIDER" = "digitalocean" ] && doNetConf=y # digitalocean requires detailed network config to be generated
|
||||||
[ "$PROVIDER" = "lightsail" ] && newrootfslabel="nixos"
|
[ "$PROVIDER" = "lightsail" ] && newrootfslabel="nixos"
|
||||||
if [[ "$PROVIDER" = "digitalocean" ]] || [[ "$PROVIDER" = "servarica" ]] || [[ "$PROVIDER" = "hetznercloud" ]]; then
|
if [[ "$PROVIDER" = "digitalocean" ]] || [[ "$PROVIDER" = "servarica" ]] || [[ "$PROVIDER" = "hetznercloud" ]]; then
|
||||||
|
|
Loading…
Reference in a new issue