diff options
| author | seth <[email protected]> | 2024-07-06 04:29:17 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2024-07-09 15:38:51 -0400 |
| commit | bb1b2e037e116aa6c704748817c4f29d573266c5 (patch) | |
| tree | d86fe6cd4e41e2030c0e0433b81a850a266a84d8 | |
| parent | b5c11d1d4306218938be8989fb6e7945fd74d897 (diff) | |
tree-wide: use treefmt
| -rw-r--r-- | dev/README.md | 9 | ||||
| -rw-r--r-- | dev/checks.nix | 42 | ||||
| -rw-r--r-- | dev/default.nix | 8 | ||||
| -rw-r--r-- | dev/treefmt.nix | 19 | ||||
| -rw-r--r-- | flake.lock | 23 | ||||
| -rw-r--r-- | flake.nix | 5 |
6 files changed, 52 insertions, 54 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; + }; + }; + }; +} @@ -420,7 +420,8 @@ "nixpkgs-tracker-bot": "nixpkgs-tracker-bot", "openwrt-imagebuilder": "openwrt-imagebuilder", "teawiebot": "teawiebot", - "terranix": "terranix" + "terranix": "terranix", + "treefmt-nix": "treefmt-nix" } }, "rust-overlay": { @@ -510,6 +511,26 @@ "repo": "terranix", "type": "github" } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719887753, + "narHash": "sha256-p0B2r98UtZzRDM5miGRafL4h7TwGRC4DII+XXHDHqek=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "bdb6355009562d8f9313d9460c0d3860f525bc6c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", @@ -146,5 +146,10 @@ bats-assert.follows = ""; }; }; + + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; } |
