Created
December 22, 2020 10:49
-
-
Save zimbatm/217bc9326c0da37ae8089cc1b797f557 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
targetHost=$(basename "$(dirname "$(readlink -f "$0")")") | |
hostname=$(< /proc/sys/kernel/hostname) | |
args=( | |
--flake ".#$targetHost" | |
--use-remote-sudo | |
) | |
if [[ "$hostname" != "$targetHost" ]]; then | |
args+=( | |
--build-host localhost | |
--target-host "${targetHost}.zt" | |
) | |
fi | |
export SUDO_USER=1 | |
exec nixos-rebuild "${args[@]}" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment