aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md5
-rw-r--r--apheleia.el2
-rw-r--r--test/formatters/installers/nixfmt.bash4
-rw-r--r--test/formatters/samplecode/nixfmt/in.nix13
-rw-r--r--test/formatters/samplecode/nixfmt/out.nix15
5 files changed, 38 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0f601ec..55a76de 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
@@ -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
diff --git a/apheleia.el b/apheleia.el
index c71121c..1cb1e29 100644
--- a/apheleia.el
+++ b/apheleia.el
@@ -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"))
@@ -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)
diff --git a/test/formatters/installers/nixfmt.bash b/test/formatters/installers/nixfmt.bash
new file mode 100644
index 0000000..213a59b
--- /dev/null
+++ b/test/formatters/installers/nixfmt.bash
@@ -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
diff --git a/test/formatters/samplecode/nixfmt/in.nix b/test/formatters/samplecode/nixfmt/in.nix
new file mode 100644
index 0000000..9f804c8
--- /dev/null
+++ b/test/formatters/samplecode/nixfmt/in.nix
@@ -0,0 +1,13 @@
+{
+
+ nixpkgs = {
+ config.allowUnfree = true;
+ overlays = [ (final: prev: {
+ unstable = import self.inputs.nixpkgs-unstable { system = system;
+ config.allowUnfree = true;
+ };
+ })
+ ];
+ };
+
+}
diff --git a/test/formatters/samplecode/nixfmt/out.nix b/test/formatters/samplecode/nixfmt/out.nix
new file mode 100644
index 0000000..d9965e9
--- /dev/null
+++ b/test/formatters/samplecode/nixfmt/out.nix
@@ -0,0 +1,15 @@
+{
+
+ nixpkgs = {
+ config.allowUnfree = true;
+ overlays = [
+ (final: prev: {
+ unstable = import self.inputs.nixpkgs-unstable {
+ system = system;
+ config.allowUnfree = true;
+ };
+ })
+ ];
+ };
+
+}