diff --git a/nixos-infect b/nixos-infect index b820f41..12fab21 100755 --- a/nixos-infect +++ b/nixos-infect @@ -5,9 +5,15 @@ set -e -o pipefail makeConf() { - export HASHED_PASSWORD=$( mkpasswd -m sha-512 "$PASSWORD" ) # Skip everything if main config already present [[ -e /etc/nixos/configuration.nix ]] && return 0 + if [[ $PASSWORD == null ]]; then + export PASSWORD=$(printf $ENCODED_PASSWORD | base64 --decode) + fi + + export ESCAPED_PASSWORD=$(printf $ENCODED_PASSWORD | base64 --decode | jq -Rs .) + export HASHED_PASSWORD=$( mkpasswd -m sha-512 "$PASSWORD" ) + # NB <<"EOF" quotes / $ ` in heredocs, <