summaryrefslogtreecommitdiff
path: root/nix/package/nixfmt-3-space.nix
diff options
context:
space:
mode:
author·𐑑𐑴𐑕𐑑𐑩𐑀2025-12-10 13:00:26 +0000
committer·𐑑𐑴𐑕𐑑𐑩𐑀2025-12-10 13:00:26 +0000
commit254b567412a50576d95f5b7c99ce128991e76357 (patch)
treec5642012ef75cf204308d869a94d701349a86031 /nix/package/nixfmt-3-space.nix
parentbcb2ef2eb63031df54e4916b11063b1f22a57a84 (diff)
downloadnixtaml-254b567412a50576d95f5b7c99ce128991e76357.tar
nixtaml-254b567412a50576d95f5b7c99ce128991e76357.tar.gz
nixtaml-254b567412a50576d95f5b7c99ce128991e76357.tar.bz2
nixtaml-254b567412a50576d95f5b7c99ce128991e76357.tar.lz
nixtaml-254b567412a50576d95f5b7c99ce128991e76357.tar.xz
nixtaml-254b567412a50576d95f5b7c99ce128991e76357.tar.zst
nixtaml-254b567412a50576d95f5b7c99ce128991e76357.zip
nix onset
Diffstat (limited to 'nix/package/nixfmt-3-space.nix')
-rw-r--r--nix/package/nixfmt-3-space.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/nix/package/nixfmt-3-space.nix b/nix/package/nixfmt-3-space.nix
new file mode 100644
index 0000000..fe2b003
--- /dev/null
+++ b/nix/package/nixfmt-3-space.nix
@@ -0,0 +1,30 @@
+#──────────────────────────────────────────────────────────────────────────────┐
+# 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,
+ nixfmt-rfc-style,
+ stdenvNoCC,
+}:
+
+writeTextFile {
+ name = "nixfmt-3-space";
+ executable = true;
+ destination = "/bin/nixfmt";
+ text = /* sh */ ''
+ #!${lib.getExe dash}
+ exec ${lib.getExe nixfmt-rfc-style} --indent=3 "$@"
+ '';
+ checkPhase = ''
+ runHook preCheck
+ ${stdenvNoCC.shellDryRun} "$target"
+ runHook postCheck
+ '';
+ meta.mainProgram = "nixfmt";
+}