1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00
home-manager/format
Austin Horstman 760eed5959
flake.nix: remove treefmt-nix input (#6782)
Removing input until I have time to migrate usage to a dev flake for all
the dev dependencies.
2025-04-08 13:52:13 -05:00

35 lines
864 B
Text
Executable file

#! /usr/bin/env nix-shell
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/42a1c966be226125b48c384171c44c651c236c22.tar.gz -i bash -p git gnugrep gnused findutils nixfmt-tree
# Avoid being affected by system and user git config.
export GIT_CONFIG_NOSYSTEM=1
export HOME=
export XDG_CONFIG_HOME=
nixfmt_args=()
files=()
for arg do
case $arg in
-h)
echo "$0 [-c]"
exit
;;
--ci)
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 treefmt "${nixfmt_args[@]}"