{
  self,
  lib,
  stdenv,
  nixfmt-rfc-style,
  deadnix,
  statix,
}:
let
  inherit (lib) sourceFilesBySuffices;
in
stdenv.mkDerivation {
  dontPatch = true;
  dontConfigure = true;
  dontBuild = true;
  dontInstall = true;
  doCheck = true;

  name = "lint-nix";
  src = sourceFilesBySuffices self [ ".nix" ];
  checkInputs = [
    nixfmt-rfc-style
    deadnix
    statix
  ];
  checkPhase = ''
    mkdir -p $out
    nixfmt --strict --check . | tee $out/nixfmt.log
    deadnix --fail | tee $out/deadnix.log
    statix check | tee $out/statix.log
  '';
}
