diff options
| author | Miran Bastaja <miran.bastaja04@gmail.com> | 2024-08-05 10:55:47 +0200 |
|---|---|---|
| committer | Miran Bastaja <miran.bastaja04@gmail.com> | 2024-08-06 08:07:32 +0200 |
| commit | 0c5caf0a9d46a66862c7382c77a5e3f7b2c9ed34 (patch) | |
| tree | c9c19c52e8146685d192272921d667a71c5feccc | |
| parent | b7754efb614a895667a2482722c423e7bf7d2f43 (diff) | |
Use nix to configure treefmt
| -rw-r--r-- | flake.lock | 23 | ||||
| -rw-r--r-- | flake.nix | 24 | ||||
| -rw-r--r-- | treefmt.nix | 5 | ||||
| -rw-r--r-- | treefmt.toml | 6 |
4 files changed, 44 insertions, 14 deletions
@@ -382,7 +382,8 @@ "rust-overlay": "rust-overlay", "snippets-ls": "snippets-ls", "sops-nix": "sops-nix", - "sorre-website": "sorre-website" + "sorre-website": "sorre-website", + "treefmt-nix": "treefmt-nix_2" } }, "rust-overlay": { @@ -521,6 +522,26 @@ "repo": "treefmt-nix", "type": "github" } + }, + "treefmt-nix_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722330636, + "narHash": "sha256-uru7JzOa33YlSRwf9sfXpJG+UAV+bnBEYMjrzKrQZFw=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "768acdb06968e53aa1ee8de207fd955335c754b7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", @@ -37,31 +37,41 @@ url = "github:nlewo/comin"; inputs.nixpkgs.follows = "nixpkgs"; }; + + # development stuff + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { + self, nixpkgs, futils, nix-on-droid, + treefmt-nix, ... }@inputs: futils.lib.eachSystem ( system: let - pkgs = inputs.nixpkgs.legacyPackages.${system}; + pkgs = import inputs.nixpkgs { inherit system; }; + treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix; in { devShells.default = futils.lib.minimalMkShell pkgs { - buildInputs = with pkgs; [ - git + packages = with pkgs; [ + gitMinimal sops - - # Formatting - treefmt - nixfmt-rfc-style ]; }; + + formatter = treefmtEval.config.build.wrapper; + checks = { + formatting = treefmtEval.config.build.check self; + }; } ) // { diff --git a/treefmt.nix b/treefmt.nix new file mode 100644 index 0000000..970592a --- /dev/null +++ b/treefmt.nix @@ -0,0 +1,5 @@ +{ ... }: +{ + projectRootFile = "flake.nix"; + programs.nixfmt.enable = true; +} diff --git a/treefmt.toml b/treefmt.toml deleted file mode 100644 index 13bf952..0000000 --- a/treefmt.toml +++ /dev/null @@ -1,6 +0,0 @@ -[global] -excludes = ["secrets/*", ".*ignore", ".git*", "*.lock"] - -[formatter.nix] -command = "nixfmt" -includes = [ "*.nix" ] |
