diff --git a/modules/pre-commit.nix b/modules/pre-commit.nix index 2b2c1216..846aabd1 100644 --- a/modules/pre-commit.nix +++ b/modules/pre-commit.nix @@ -206,6 +206,11 @@ in { nix-pre-commit comes with its own set of packages for this purpose. ''; + # This default is for when the module is the entry point rather than + # /default.nix. /default.nix will override this for efficiency. + default = (import ../nix {}).callPackage ../nix/tools.nix {}; + defaultText = + literalExample ''nix-pre-commit-hooks-pkgs.callPackage tools-dot-nix {}''; }; hooks = diff --git a/nix/packages.nix b/nix/packages.nix index a939a55b..b7a7af2f 100644 --- a/nix/packages.nix +++ b/nix/packages.nix @@ -1,15 +1,7 @@ -{ hlint, shellcheck, ormolu, hindent, cabal-fmt, canonix, elmPackages, niv -, gitAndTools, runCommand, writeText, writeScript, git, nixpkgs-fmt, nixfmt -, callPackage -}: +{ niv, gitAndTools, callPackage }: let - tools = - { - inherit hlint shellcheck ormolu hindent cabal-fmt canonix nixpkgs-fmt nixfmt; - inherit (elmPackages) elm-format; - terraform-fmt = callPackage ./terraform-fmt {}; - }; + tools = callPackage ./tools.nix {}; in tools // rec { inherit niv; diff --git a/nix/tools.nix b/nix/tools.nix new file mode 100644 index 00000000..fd16db96 --- /dev/null +++ b/nix/tools.nix @@ -0,0 +1,10 @@ +{ hlint, shellcheck, ormolu, hindent, cabal-fmt, canonix, elmPackages, niv +, gitAndTools, runCommand, writeText, writeScript, git, nixpkgs-fmt, nixfmt +, callPackage +}: + +{ + inherit hlint shellcheck ormolu hindent cabal-fmt canonix nixpkgs-fmt nixfmt; + inherit (elmPackages) elm-format; + terraform-fmt = callPackage ./terraform-fmt {}; +}