mirror of
https://github.com/elitak/nixos-infect.git
synced 2024-12-21 23:58:29 +03: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
|
||||
|
||||
autodetectProvider() {
|
||||
if [ -e /etc/hetzner-build ]; then
|
||||
PROVIDER="hetznercloud"
|
||||
fi
|
||||
}
|
||||
|
||||
makeConf() {
|
||||
# Skip everything if main config already present
|
||||
[[ -e /etc/nixos/configuration.nix ]] && return 0
|
||||
|
@ -375,6 +381,10 @@ infect() {
|
|||
/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" = "lightsail" ] && newrootfslabel="nixos"
|
||||
if [[ "$PROVIDER" = "digitalocean" ]] || [[ "$PROVIDER" = "servarica" ]] || [[ "$PROVIDER" = "hetznercloud" ]]; then
|
||||
|
|
Loading…
Reference in a new issue