2020-02-01 20:59:49 +01:00
|
|
|
#! /usr/bin/env nix-shell
|
2020-04-06 12:51:11 +02:00
|
|
|
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/05f0934825c2a0750d4888c4735f9420c906b388.tar.gz -i bash -p findutils nixfmt
|
2020-02-01 20:59:49 +01:00
|
|
|
|
|
|
|
CHECK_ARG=
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
-h)
|
|
|
|
echo "$0 [-c]"
|
|
|
|
;;
|
|
|
|
-c)
|
|
|
|
CHECK_ARG=-c
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# The first block of excludes are files where nixfmt does a poor job,
|
|
|
|
# IMHO. The second block of excludes are files touched by open pull
|
|
|
|
# requests and we want to avoid merge conflicts.
|
|
|
|
find . -name '*.nix' \
|
|
|
|
! -path ./modules/programs/irssi.nix \
|
|
|
|
\
|
|
|
|
! -path ./home-manager/default.nix \
|
|
|
|
! -path ./home-manager/home-manager.nix \
|
|
|
|
! -path ./modules/default.nix \
|
|
|
|
! -path ./modules/files.nix \
|
|
|
|
! -path ./modules/home-environment.nix \
|
|
|
|
! -path ./modules/lib/default.nix \
|
|
|
|
! -path ./modules/lib/file-type.nix \
|
|
|
|
! -path ./modules/manual.nix \
|
|
|
|
! -path ./modules/misc/dconf.nix \
|
|
|
|
! -path ./modules/misc/news.nix \
|
|
|
|
! -path ./modules/misc/nixpkgs.nix \
|
|
|
|
! -path ./modules/misc/xdg.nix \
|
|
|
|
! -path ./modules/modules.nix \
|
|
|
|
! -path ./modules/programs/afew.nix \
|
|
|
|
! -path ./modules/programs/bash.nix \
|
|
|
|
! -path ./modules/programs/firefox.nix \
|
|
|
|
! -path ./modules/programs/gpg.nix \
|
|
|
|
! -path ./modules/programs/lesspipe.nix \
|
|
|
|
! -path ./modules/programs/ssh.nix \
|
|
|
|
! -path ./modules/programs/tmux.nix \
|
|
|
|
! -path ./modules/programs/zsh.nix \
|
|
|
|
! -path ./modules/services/gpg-agent.nix \
|
|
|
|
! -path ./modules/services/kbfs.nix \
|
|
|
|
! -path ./modules/services/keybase.nix \
|
|
|
|
! -path ./modules/services/mpd.nix \
|
|
|
|
! -path ./modules/services/sxhkd.nix \
|
|
|
|
! -path ./modules/services/window-managers/i3.nix \
|
|
|
|
! -path ./modules/systemd.nix \
|
|
|
|
! -path ./nix-darwin/default.nix \
|
|
|
|
! -path ./tests/default.nix \
|
|
|
|
! -path ./tests/modules/home-environment/default.nix \
|
|
|
|
! -path ./tests/modules/home-environment/session-variables.nix \
|
|
|
|
! -path ./tests/modules/programs/gpg/override-defaults.nix \
|
|
|
|
! -path ./tests/modules/programs/tmux/default.nix \
|
|
|
|
! -path ./tests/modules/programs/zsh/session-variables.nix \
|
|
|
|
! -path ./tests/modules/services/sxhkd/service.nix \
|
|
|
|
! -path ./tests/modules/systemd/services.nix \
|
|
|
|
! -path ./tests/modules/systemd/session-variables.nix \
|
|
|
|
-exec nixfmt $CHECK_ARG {} +
|