diff --git a/flake.lock b/flake.lock index ec37116..a851703 100644 --- a/flake.lock +++ b/flake.lock @@ -1136,7 +1136,8 @@ "nixvim": "nixvim", "pre-commit-hooks": "pre-commit-hooks_2", "secrets": "secrets", - "thunderbird-gnome-theme": "thunderbird-gnome-theme" + "thunderbird-gnome-theme": "thunderbird-gnome-theme", + "treefmt-nix": "treefmt-nix_2" } }, "secrets": { @@ -1282,6 +1283,26 @@ "type": "github" } }, + "treefmt-nix_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1754847726, + "narHash": "sha256-2vX8QjO5lRsDbNYvN9hVHXLU6oMl+V/PsmIiJREG4rE=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "7d81f6fb2e19bf84f1c65135d1060d829fae2408", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "utils": { "inputs": { "systems": "systems_2" diff --git a/flake.nix b/flake.nix index c952aa3..b50d077 100644 --- a/flake.nix +++ b/flake.nix @@ -14,7 +14,10 @@ inputs.pre-commit-hooks.follows = "pre-commit-hooks"; }; - deploy-rs.url = "github:serokell/deploy-rs"; + deploy-rs = { + url = "github:serokell/deploy-rs"; + inputs.nixpkgs.follows = "nixpkgs"; + }; devshell = { url = "github:numtide/devshell"; @@ -95,6 +98,11 @@ url = "github:rafaelmardojai/thunderbird-gnome-theme"; flake = false; }; + + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = @@ -108,6 +116,7 @@ inputs.agenix-rekey.flakeModule inputs.pre-commit-hooks.flakeModule inputs.nix-topology.flakeModule + inputs.treefmt-nix.flakeModule ./nix/devshell.nix ./nix/hosts.nix ]; @@ -141,21 +150,28 @@ check-case-conflicts.enable = true; check-executables-have-shebangs.enable = true; check-merge-conflicts.enable = true; - deadnix = { - enable = true; - settings = { - noLambdaArg = true; - }; - }; detect-private-keys.enable = true; end-of-file-fixer.enable = true; fix-byte-order-marker.enable = true; mixed-line-endings.enable = true; - nixfmt-rfc-style.enable = true; + treefmt.enable = true; trim-trailing-whitespace.enable = true; }; }; }; + + treefmt = { + projectRootFile = "flake.nix"; + programs = { + deadnix = { + enable = true; + no-lambda-arg = true; + }; + mdformat.enable = true; + nixfmt-rfc-style.enable = true; + shellcheck.enable = true; + }; + }; }; }; } diff --git a/nix/devshell.nix b/nix/devshell.nix index c0b46c0..768fd07 100644 --- a/nix/devshell.nix +++ b/nix/devshell.nix @@ -5,10 +5,14 @@ ]; perSystem = - { pkgs, ... }: + { config, pkgs, ... }: { devshells.default = { commands = [ + { + package = config.treefmt.build.wrapper; + help = "Format all files"; + } { package = pkgs.deploy-rs; name = "deploy";