Skip to content

Commit

Permalink
🐛 Make checks.nixfmt work from everywhere
Browse files Browse the repository at this point in the history
If $nixFiles were expressed as relative to the root of the project,
nixfmt would fail when ran from a sub directory. Now cd to the root
first which will work for both relative and absolute paths.

Since nix (and thus we) have not committed to using flakes this instead
uses git to find the root of the project.
  • Loading branch information
simonrainerson committed Feb 13, 2024
1 parent 123f886 commit f96187f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- `.#checks.nixfmt` can be run from everywhere when nixFiles are relative to project.

## [10.0.0] - 2024-02-06

### Added
Expand Down
2 changes: 2 additions & 0 deletions ci/nixfmt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ if [[ $* =~ (^|[[:space:]])+--fix([[:space:]]|$)+ ]]; then
check=""
fi

cd "$(git rev-parse --show-toplevel)"

if [ $# -eq 0 ] || [ -z "$check" ]; then
exitCode=0
files=()
Expand Down

0 comments on commit f96187f

Please sign in to comment.