Commit ec8bcb7

HPCesia <me@hpcesia.com>
2026-09-08 17:11:55
treefmt: init
1 parent c11c4f1
Changed files (5)
modules/flake-parts/treefmt.nix
@@ -0,0 +1,15 @@
+{inputs, ...}: {
+  flake-file.inputs.treefmt-nix = {
+    url = "github:numtide/treefmt-nix";
+    inputs.nixpkgs-lib.follows = "nixpkgs";
+  };
+
+  imports = [inputs.treefmt-nix.flakeModule];
+
+  perSystem = {
+    treefmt = {
+      programs.alejandra.enable = true;
+      programs.rumdl-format.enable = true;
+    };
+  };
+}
.editorconfig
@@ -0,0 +1,8 @@
+root = true
+
+[*]
+end_of_line = lf
+indent_style = space
+indent_size = 2
+insert_final_newline = true
+trim_trailing_whitespace = true
AGENTS.md
@@ -21,6 +21,9 @@ just build <hostname> --no-nom --diff=never -- --verbose
 # Regenerate flake.nix & flake.lock after modifying flake inputs by flake-file
 just write-flake
 
+# Format all .nix and .md files by treefmt
+nix fmt
+
 # Edit and cache Vaultix secrets, need password and ONLY for human use
 edit-secret <file_path> # `edit-secret` available in nix devshell
 git add <file_path> # or any command to track secret file in git
flake.lock
@@ -269,6 +269,22 @@
         "type": "github"
       }
     },
+    "nixpkgs_2": {
+      "locked": {
+        "lastModified": 1770107345,
+        "narHash": "sha256-tbS0Ebx2PiA1FRW8mt8oejR0qMXmziJmPaU1d4kYY9g=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "4533d9293756b63904b7238acb84ac8fe4c8c2c4",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "ref": "nixpkgs-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
     "nur": {
       "inputs": {
         "flake-parts": [
@@ -368,6 +384,7 @@
         "nur": "nur",
         "nur-hpcesia": "nur-hpcesia",
         "preservation": "preservation",
+        "treefmt-nix": "treefmt-nix",
         "vaultix": "vaultix"
       }
     },
@@ -401,6 +418,24 @@
         "type": "github"
       }
     },
+    "treefmt-nix": {
+      "inputs": {
+        "nixpkgs": "nixpkgs_2"
+      },
+      "locked": {
+        "lastModified": 1786901030,
+        "narHash": "sha256-WSFCsDSE5ffgD2MqzkM2CYjeFiKhRF/dJUN8uedb6YE=",
+        "owner": "numtide",
+        "repo": "treefmt-nix",
+        "rev": "27b3b12a8e6375f28ebe122f07d230ca5459bbfa",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "treefmt-nix",
+        "type": "github"
+      }
+    },
     "utils": {
       "inputs": {
         "systems": "systems"
flake.nix
@@ -55,6 +55,10 @@
       inputs.nixpkgs.follows = "nixpkgs";
     };
     preservation.url = "github:nix-community/preservation";
+    treefmt-nix = {
+      url = "github:numtide/treefmt-nix";
+      inputs.nixpkgs-lib.follows = "nixpkgs";
+    };
     vaultix = {
       url = "github:HPCesia/vaultix";
       inputs = {