{ inputs, ... }:
{
  imports = [
    inputs.git-hooks-nix.flakeModule
  ];

  perSystem =
    {
      config,
      pkgs,
      ...
    }:
    {
      pre-commit = {
        check.enable = true;
        settings.hooks = {
          nixfmt-rfc-style.enable = true;
          nil.enable = true;
          statix = {
            enable = true;
            args = [ "fix" ];
          };
          deadnix = {
            enable = true;
            args = [ "-e" ];
          };
          prettier = {
            enable = true;
            excludes = [ "flake.lock" ];
          };
          ruff.enable = true;
          ruff-format.enable = true;
          shfmt.enable = true;
          shellcheck.enable = true;
          taplo.enable = true;
        };
      };

      devShells = {
        default =
          let
            inherit (config) pre-commit;
          in
          pkgs.mkShell {
            name = "pre-commit-shell";
            shellHook = pre-commit.installationScript;
            packages = pre-commit.settings.enabledPackages ++ [
              pre-commit.settings.package
              pkgs.ruff-lsp
              pkgs.bash-language-server
              pkgs.vscode-langservers-extracted
            ];
          };
        haskell = pkgs.mkShell {
          name = "haskell";
          packages = builtins.attrValues {
            inherit (pkgs) ghc;
            inherit (pkgs.haskellPackages)
              stack
              haskell-language-server
              ormolu
              ;
          };
        };
      };
      formatter = pkgs.nixfmt-rfc-style;
    };
}
