summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nix/package/nixfmt-3-space.nix30
1 files changed, 12 insertions, 18 deletions
diff --git a/nix/package/nixfmt-3-space.nix b/nix/package/nixfmt-3-space.nix
index fe2b003..505d71e 100644
--- a/nix/package/nixfmt-3-space.nix
+++ b/nix/package/nixfmt-3-space.nix
@@ -2,29 +2,23 @@
# SPDX-FileCopyrightText: 2025 toastal <https://toast.al/contact/> │
# SPDX-License-Identifier: LGPL-2.1-or-later │
#──────────────────────────────────────────────────────────────────────────────┘
-# I don’t like *this* formatter, but it is *a* formatter. Tweaking it to expand
-# to 3 spaces, helps the maker actually read the code since 2 spaces is not
-# enough contrast (& Nix magic strings don’t support tabs).
{
lib,
- writeTextFile,
- dash,
+ writeDashBinScript,
nixfmt-rfc-style,
- stdenvNoCC,
}:
-writeTextFile {
- name = "nixfmt-3-space";
- executable = true;
- destination = "/bin/nixfmt";
+writeDashBinScript {
+ name = "nixfmt";
text = /* sh */ ''
- #!${lib.getExe dash}
- exec ${lib.getExe nixfmt-rfc-style} --indent=3 "$@"
+ exec ${lib.getExe nixfmt-rfc-style} --indent="3" "$@"
'';
- checkPhase = ''
- runHook preCheck
- ${stdenvNoCC.shellDryRun} "$target"
- runHook postCheck
- '';
- meta.mainProgram = "nixfmt";
+ meta = {
+ description = "nixfmt, but with 3-space indentation";
+ longDescription = ''
+ I don’t like *this* formatter, but it is *a* formatter. Tweaking it to
+ expand to 3 spaces, helps the maker actually read the code since 2
+ spaces is not enough contrast (& Nix magic strings don’t support tabs).
+ '';
+ };
}