mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
Make nix flake info fix backwards compatible
This change handles previous nix versions by testing for the presence of the `metadata` subcommand and falling back on the `info` subcommand if it does not exist.
This commit is contained in:
parent
93752a83ea
commit
4187519820
1 changed files with 7 additions and 1 deletions
|
@ -126,7 +126,13 @@ if [ -n "$flake" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$flake" ]; then
|
if [ -n "$flake" ]; then
|
||||||
flake=$(nix "${flakeFlags[@]}" flake metadata --json "${extraBuildFlags[@]}" "${extraLockFlags[@]}" -- "$flake" | jq -r .url)
|
if nix flake metadata &>/dev/null; then
|
||||||
|
cmd=metadata
|
||||||
|
else
|
||||||
|
cmd=info
|
||||||
|
fi
|
||||||
|
|
||||||
|
flake=$(nix "${flakeFlags[@]}" flake "$cmd" --json "${extraBuildFlags[@]}" "${extraLockFlags[@]}" -- "$flake" | jq -r .url)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$action" != build ] && [ -z "$flake" ]; then
|
if [ "$action" != build ] && [ -z "$flake" ]; then
|
||||||
|
|
Loading…
Reference in a new issue