Skip to content

Commit

Permalink
nixos_rebuild: allow adding build host
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Jul 12, 2024
1 parent 4bf8618 commit 83b968a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions roles/nixos_rebuild/templates/script.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ fi
export ANSIBLE_JSON={{ loc_json | quote }}

if [ -v NIXOS_ANYWHERE ]; then
if [ -v NIXOS_METHOD ]; then
echo "ERR: Method not supported for NIXOS_ANYWHERE!" >&2
if [ -v NIXOS_METHOD ] || [ -v NIXOS_BUILD_HOST ]; then
echo "ERR: NIXOS_METHOD and/or NIXOS_BUILD_HOST not supported for NIXOS_ANYWHERE!" >&2
fi
{{ nix_wrapper | quote }} nix run github:nix-community/nixos-anywhere -- --option pure-eval "false" --flake {{ flake_url | quote }} {{ target_host | quote }}
else
{{ nix_wrapper | quote }} nix run nixpkgs#nixos-rebuild -- --flake {{ flake_url | quote }} "${NIXOS_METHOD:-switch}" --use-substitutes --impure --target-host {{ target_host | quote }} --show-trace
EXTRA_ARGS=()
if [ -v NIXOS_BUILD_HOST ]; then
EXTRA_ARGS+=("--build-host" "$NIXOS_BUILD_HOST")
fi
{{ nix_wrapper | quote }} nix run nixpkgs#nixos-rebuild -- --flake {{ flake_url | quote }} "${NIXOS_METHOD:-switch}" --use-substitutes --impure --target-host {{ target_host | quote }} --show-trace "${EXTRA_ARGS[@]}"
fi

0 comments on commit 83b968a

Please sign in to comment.