1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-31 12:37:45 +00:00

feat: more robust pre-commit hook

This commit is contained in:
Kevin Amado 2022-05-06 16:06:11 -06:00
parent 73af6ae9b5
commit 131c177c90
2 changed files with 26 additions and 3 deletions

View file

@ -1,3 +1,26 @@
#! /usr/bin/env sh
nix run github:kamadorueda/alejandra -- -q "$@"
set -eux
if ! command -v nix-build; then
echo 'ERROR: this pre-commit hook requires "nix-build" to be installed first'
exit 1
fi
if !command -v nix-instantiate; then
echo 'ERROR: this pre-commit hook requires "nix-instantiate" to be installed first'
exit 1
fi
echo INFO: computing current system
system="$(nix-instantiate --eval --expr builtins.currentSystem)"
echo INFO: building Alejandra
nix-build \
--attr ${system} \
--out-link result-alejandra \
https://github.com/kamadorueda/alejandra/tarball/1.2.0
echo INFO: running Alejandra:
result-alejandra/bin/alejandra -- -q "${@}"

View file

@ -269,8 +269,7 @@ Thank you ❤️
- [Kevin Amado](https://github.com/kamadorueda) ~
[Email](mailto:kamadorueda@gmail.com),
[Patreon](https://www.patreon.com/kamadorueda),
@kamadorueda:[matrix.org](https://matrix.org/).
[Patreon](https://www.patreon.com/kamadorueda).
- [Thomas Bereknyei](https://github.com/tomberek).
- [Piegames](https://github.com/piegamesde).
- [Joachim Ernst](https://github.com/0x4A6F).
@ -282,6 +281,7 @@ Thank you ❤️
- [Rehno Lindeque](https://github.com/rehno-lindeque).
- [Jörg Thalheim](https://github.com/Mic92).
- [Vincent Ambo](https://github.com/tazjin).
- [Loïc Reynier](https://github.com/loicreynier).
- [Mr Hedgehog](https://github.com/ModdedGamers).
- [Tristan Maat](https://github.com/TLATER).
- [Norbert Melzer](https://github.com/NobbZ).