about summary refs log tree commit diff stats
path: root/treefmt.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-06-06 15:45:11 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-06-06 15:45:11 +0200
commita6baea06697f6c76c695dc4198099deb8ba916e0 (patch)
tree476a3865f6b4bef04751ba20534813a58892811b /treefmt.nix
parentchore: Initial commit (diff)
downloadback-a6baea06697f6c76c695dc4198099deb8ba916e0.zip
feat(treewide): Prepare for first release
This commit contains many changes, as they were developed alongside
`git-bug-rs` and unfortunately not separately committed.

A toplevel summary would include:
- Appropriate redirects,
- The templating moved to `vy` (as this works with rustfmt formatting),
- Search support (via `git-bug-rs`),
- And better layout in the link section.
Diffstat (limited to 'treefmt.nix')
-rw-r--r--treefmt.nix21
1 files changed, 17 insertions, 4 deletions
diff --git a/treefmt.nix b/treefmt.nix
index ebe4157..1768b65 100644
--- a/treefmt.nix
+++ b/treefmt.nix
@@ -11,7 +11,6 @@
 {
   treefmt-nix,
   pkgs,
-  rustfmt,
 }:
 treefmt-nix.lib.evalModule pkgs (
   {pkgs, ...}: {
@@ -22,7 +21,6 @@ treefmt-nix.lib.evalModule pkgs (
       alejandra.enable = true;
       rustfmt = {
         enable = true;
-        package = rustfmt;
         edition = "2024";
       };
       clang-format.enable = true;
@@ -76,8 +74,23 @@ treefmt-nix.lib.evalModule pkgs (
         clang-format = {
           options = ["--style" "GNU"];
         };
-        rustfmt = {
-          options = ["--config-path" "${./rustfmt.toml}"];
+        rustfmt = let
+          config = builtins.fromTOML (builtins.readFile ./rustfmt_config.toml);
+          toValue = value:
+            if builtins.isString value
+            then value
+            else if builtins.isInt value
+            then builtins.toString value
+            else if builtins.isBool value
+            then
+              if value
+              then "true"
+              else "false"
+            else builtins.throw "Unknown value: ${value}";
+          options = pkgs.lib.mapAttrsToList (name: value: "--config=${name}=${toValue value}") config;
+        in {
+          inherit options;
+          excludes = ["vendored/*"];
         };
         shfmt = {
           includes = ["*.bash"];