diff --git a/flake.lock b/flake.lock index db855af..603cf82 100644 --- a/flake.lock +++ b/flake.lock @@ -270,6 +270,22 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1695644571, + "narHash": "sha256-asS9dCCdlt1lPq0DLwkVBbVoEKuEuz+Zi3DG7pR/RxA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6500b4580c2a1f3d0f980d32d285739d8e156d92", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": [ @@ -304,7 +320,8 @@ "flake-parts": "flake-parts", "mk-shell-bin": "mk-shell-bin", "nix2container": "nix2container", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "treefmt-nix": "treefmt-nix" } }, "systems": { @@ -336,6 +353,24 @@ "repo": "default", "type": "github" } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1701958734, + "narHash": "sha256-3h3EH1FXQkIeAuzaWB+nK0XK54uSD46pp+dMD3gAcB4=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "e8cea581dd2b7c9998c1e6662db2c1dc30e7fdb0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 471436f..ae512a7 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,7 @@ nix2container.url = "github:nlewo/nix2container"; nix2container.inputs.nixpkgs.follows = "nixpkgs"; mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin"; + treefmt-nix.url = "github:numtide/treefmt-nix"; }; nixConfig = { @@ -18,6 +19,7 @@ flake-parts.lib.mkFlake {inherit inputs;} { imports = [ inputs.devenv.flakeModule + inputs.treefmt-nix.flakeModule ]; systems = ["x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; @@ -62,6 +64,19 @@ LD_LIBRARY_PATH = "${pkgs.lib.getLib pkgs.gtest}/lib"; }; }; + + treefmt.config = { + projectRootFile = "flake.nix"; + + programs.alejandra.enable = true; + programs.clang-format.enable = true; + programs.deadnix.enable = true; + programs.prettier.enable = true; + programs.prettier.settings = { + editorconfig = true; + embeddedLanguageFormatting = "auto"; + }; + }; }; flake = { # The usual flake attributes can be defined here, including system-