mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
a17d730ab5
This removes the last three formatting excludes so that the entire project is formatted by nixfmt. This is the first step towards moving to the RFC style format.
31 lines
736 B
Text
Executable file
31 lines
736 B
Text
Executable file
#! /usr/bin/env nix-shell
|
|
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/6616de389ed55fba6eeba60377fc04732d5a207c.tar.gz -i bash -p git gnugrep gnused findutils nixfmt
|
|
|
|
nixfmt_args=()
|
|
files=()
|
|
|
|
for arg do
|
|
case $arg in
|
|
-h)
|
|
echo "$0 [-c]"
|
|
exit
|
|
;;
|
|
-c)
|
|
nixfmt_args+=("$arg")
|
|
;;
|
|
-*)
|
|
echo "unrecognised flag: $arg" >&2
|
|
exit 1
|
|
;;
|
|
*)
|
|
files+=("$arg")
|
|
;;
|
|
esac
|
|
done
|
|
|
|
git_root=$(git rev-parse --show-toplevel)
|
|
|
|
git ls-files -z --cached --others --full-name -- "${files[@]}" |
|
|
grep -z '\.nix$' |
|
|
sed -z "s|^|$git_root/|" |
|
|
xargs -0 nixfmt "${nixfmt_args[@]}"
|