tower-conneg 1.1.0

Tower middleware for HTTP content negotiation
{
  pkgs,
  ...
}:

{
  packages = with pkgs; [
    nixfmt-rfc-style
    treefmt
    cargo-nextest
    cargo-tarpaulin
    cargo-semver-checks
  ];

  languages = {
    rust = {
      enable = true;
      channel = "stable";
      components = [
        "rustc"
        "cargo"
        "clippy"
        "rustfmt"
        "rust-analyzer"
        "rust-src"
      ];
    };
    nix = {
      enable = true;
      lsp.package = pkgs.nil;
    };
  };

  treefmt = {
    enable = true;
    config = {
      programs.nixfmt = {
        enable = true;
        package = pkgs.nixfmt-rfc-style;
      };
      programs.rustfmt = {
        enable = true;
      };
      programs.taplo = {
        enable = true;
      };
    };
  };

  git-hooks.hooks = {
    treefmt.enable = true;
    clippy.enable = true;
    commitizen.enable = true;
    nextest = {
      enable = true;
      name = "cargo-nextest";
      description = "Run tests with cargo-nextest";
      entry = "${pkgs.cargo-nextest}/bin/cargo-nextest nextest run";
      pass_filenames = false;
      stages = [ "pre-commit" ];
    };
    semver-checks = {
      enable = true;
      name = "cargo-semver-checks";
      description = "Check public API compatibility before pushing";
      entry = "${pkgs.cargo-semver-checks}/bin/cargo-semver-checks semver-checks --all-features";
      pass_filenames = false;
      stages = [ "pre-push" ];
    };
  };
}