summaryrefslogtreecommitdiff
path: root/dev
diff options
context:
space:
mode:
authorseth <[email protected]>2024-07-06 04:29:17 -0400
committerseth <[email protected]>2024-07-09 15:38:51 -0400
commitbb1b2e037e116aa6c704748817c4f29d573266c5 (patch)
treed86fe6cd4e41e2030c0e0433b81a850a266a84d8 /dev
parentb5c11d1d4306218938be8989fb6e7945fd74d897 (diff)
tree-wide: use treefmt
Diffstat (limited to 'dev')
-rw-r--r--dev/README.md9
-rw-r--r--dev/checks.nix42
-rw-r--r--dev/default.nix8
-rw-r--r--dev/treefmt.nix19
4 files changed, 25 insertions, 53 deletions
diff --git a/dev/README.md b/dev/README.md
index f16f659..ac255bc 100644
--- a/dev/README.md
+++ b/dev/README.md
@@ -1,9 +1,5 @@
# ./dev/
-## checks.nix
-
-Runs all of my favorite tools on the code here to make sure it's good to go
-
## devShells.nix
A misnomer - this only contains one shell
@@ -12,3 +8,8 @@ A misnomer - this only contains one shell
Jobs I want to run in CI. Currently built by
[`nix-fast-build`](https://github.com/Mic92/nix-fast-build)
+
+## treefmt.nix
+
+[treefmt](https://github.com/numtide/treefmt) configuration via
+[treefmt-nix](https://github.com/numtide/treefmt-nix)
diff --git a/dev/checks.nix b/dev/checks.nix
deleted file mode 100644
index 56c5038..0000000
--- a/dev/checks.nix
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- perSystem =
- { pkgs, ... }:
- {
- checks = {
- check-formatting =
- pkgs.runCommand "check-formatting" { nativeBuildInputs = [ pkgs.nixfmt-rfc-style ]; }
- ''
- cd ${./.}
-
- echo "running nixfmt..."
- nixfmt --check .
-
- touch $out
- '';
-
- check-lint =
- pkgs.runCommand "check-lint"
- {
- nativeBuildInputs = [
- pkgs.actionlint
- pkgs.deadnix
- pkgs.statix
- ];
- }
- ''
- cd ${./.}
-
- echo "running actionlint..."
- actionlint ./.github/workflows/*
-
- echo "running deadnix..."
- deadnix --fail
-
- echo "running statix..."
- statix check .
-
- touch $out
- '';
- };
- };
-}
diff --git a/dev/default.nix b/dev/default.nix
index 105273c..d1a371e 100644
--- a/dev/default.nix
+++ b/dev/default.nix
@@ -1,13 +1,7 @@
{
imports = [
- ./checks.nix
./devShells.nix
./hydraJobs.nix
+ ./treefmt.nix
];
-
- perSystem =
- { pkgs, ... }:
- {
- formatter = pkgs.nixfmt-rfc-style;
- };
}
diff --git a/dev/treefmt.nix b/dev/treefmt.nix
new file mode 100644
index 0000000..9029cf0
--- /dev/null
+++ b/dev/treefmt.nix
@@ -0,0 +1,19 @@
+{ inputs, ... }:
+{
+ imports = [ inputs.treefmt-nix.flakeModule ];
+
+ perSystem = {
+ treefmt = {
+ projectRootFile = ".git/config";
+
+ # TODO: add actionlint
+ # https://github.com/numtide/treefmt-nix/pull/146
+ programs = {
+ deadnix.enable = true;
+ just.enable = true;
+ nixfmt-rfc-style.enable = true;
+ statix.enable = true;
+ };
+ };
+ };
+}