{
  lib,
  fetchFromGitHub,
  stdenvNoCC,

  writers,
  nix-update,
}:
# Using `mkDerivation` so nix-update can pick up the version
stdenvNoCC.mkDerivation (drv: {
  pname = "crowdsec-hub";
  version = drv.src.rev;

  src = fetchFromGitHub {
    owner = "crowdsecurity";
    repo = "hub";
    rev = "a7b7e3791525943a746068dee1e77da928db2707";
    hash = "sha256-dNUwTdCPqc7kB3uFTMCWwrQ9a+mPNmBget6NPff+jsY=";
  };

  installPhase = ''
    cp -r $src $out
  '';

  passthru.updateScript =
    writers.writeNuBin "update-crowdsec-hub"
      {
        makeWrapperArgs = [
          "--prefix"
          "PATH"
          ":"
          (lib.makeBinPath [ nix-update ])
        ];
      }
      ''
        nix-update --flake --format --version=branch crowdsec-hub
      '';
})
