diff --git a/.pre-commit-entry.sh b/.pre-commit-entry.sh index 3577577..add8ebd 100755 --- a/.pre-commit-entry.sh +++ b/.pre-commit-entry.sh @@ -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 "${@}" diff --git a/README.md b/README.md index 988f5b6..06b659a 100644 --- a/README.md +++ b/README.md @@ -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).