Skip to content

Commit

Permalink
Add nixfmt (#98)
Browse files Browse the repository at this point in the history
* Add nixfmt

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Radon Rosborough <[email protected]>
  • Loading branch information
michzappa and raxod502 authored May 16, 2022
1 parent 363d634 commit cececba
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ The format is based on [Keep a Changelog].
* [dart-format](https://dart.dev/tools/dart-format) for Dart ([#89]).
* [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) for PHP
([#87]).
* [ktlint](https://github.com/pinterest/ktlint) for Kotlin ([#95]).
* [ktlint](https://github.com/pinterest/ktlint) for Kotlin ([#97]).
* [nixfmt](https://github.com/serokell/nixfmt) for Nix ([#98]).

### Features
* Support remote files and buffers that were opened through TRAMP
Expand All @@ -31,6 +32,8 @@ The format is based on [Keep a Changelog].
[#87]: https://github.com/raxod502/apheleia/pull/87
[#89]: https://github.com/raxod502/apheleia/pull/89
[#94]: https://github.com/radian-software/apheleia/pull/94
[#97]: https://github.com/radian-software/apheleia/pull/97
[#98]: https://github.com/radian-software/apheleia/pull/98

## 2.0
### Breaking changes
Expand Down
2 changes: 2 additions & 0 deletions apheleia.el
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ being run, for diagnostic purposes."
(ktlint . ("ktlint" "--stdin" "-F"))
(latexindent . ("latexindent" "--logfile=/dev/null"))
(mix-format . ("mix" "format" "-"))
(nixfmt . ("nixfmt"))
(ocamlformat . ("ocamlformat" "-" "--name" filepath
"--enable-outside-detected-project"))
(phpcs . ("apheleia-phpcs"))
Expand Down Expand Up @@ -1063,6 +1064,7 @@ function: %s" command)))
(kotlin-mode . ktlint)
(latex-mode . latexindent)
(LaTeX-mode . latexindent)
(nix-mode . nixfmt)
(python-mode . black)
(ruby-mode . prettier)
(rustic-mode . rustfmt)
Expand Down
4 changes: 4 additions & 0 deletions test/formatters/installers/nixfmt.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ver="$(latest_release serokell/nixfmt)"

wget "https://github.com/serokell/nixfmt/releases/download/${ver}/nixfmt" -O /usr/local/bin/nixfmt
chmod +x /usr/local/bin/nixfmt
13 changes: 13 additions & 0 deletions test/formatters/samplecode/nixfmt/in.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{

nixpkgs = {
config.allowUnfree = true;
overlays = [ (final: prev: {
unstable = import self.inputs.nixpkgs-unstable { system = system;
config.allowUnfree = true;
};
})
];
};

}
15 changes: 15 additions & 0 deletions test/formatters/samplecode/nixfmt/out.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{

nixpkgs = {
config.allowUnfree = true;
overlays = [
(final: prev: {
unstable = import self.inputs.nixpkgs-unstable {
system = system;
config.allowUnfree = true;
};
})
];
};

}

0 comments on commit cececba

Please sign in to comment.