Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, buildGoModule, fetchFromGitHub, installShellFiles }: 2 3buildGoModule rec { 4 pname = "crowdsec"; 5 version = "1.5.2"; 6 7 src = fetchFromGitHub { 8 owner = "crowdsecurity"; 9 repo = pname; 10 rev = "v${version}"; 11 hash = "sha256-260+XsRn3Mm/zCSvfEcBQ6j715KV4t1Z0CvXdriDzCs="; 12 }; 13 14 vendorHash = "sha256-Mto0X/LMwWU10cmC2bjzX4lzp9t+nEgsWRP3JGkl++A="; 15 16 nativeBuildInputs = [ installShellFiles ]; 17 18 subPackages = [ 19 "cmd/crowdsec" 20 "cmd/crowdsec-cli" 21 ]; 22 23 ldflags = [ 24 "-s" 25 "-w" 26 "-X github.com/crowdsecurity/crowdsec/pkg/cwversion.Version=v${version}" 27 "-X github.com/crowdsecurity/crowdsec/pkg/cwversion.BuildDate=1970-01-01_00:00:00" 28 ]; 29 30 postBuild = "mv $GOPATH/bin/{crowdsec-cli,cscli}"; 31 32 postInstall = '' 33 mkdir -p $out/share/crowdsec 34 cp -r ./config $out/share/crowdsec/ 35 36 installShellCompletion --cmd cscli \ 37 --bash <($out/bin/cscli completion bash) \ 38 --fish <($out/bin/cscli completion fish) \ 39 --zsh <($out/bin/cscli completion zsh) 40 ''; 41 42 meta = with lib; { 43 homepage = "https://crowdsec.net/"; 44 changelog = "https://github.com/crowdsecurity/crowdsec/releases/tag/v${version}"; 45 description = "CrowdSec is a free, open-source and collaborative IPS"; 46 longDescription = '' 47 CrowdSec is a free, modern & collaborative behavior detection engine, 48 coupled with a global IP reputation network. It stacks on fail2ban's 49 philosophy but is IPV6 compatible and 60x faster (Go vs Python), uses Grok 50 patterns to parse logs and YAML scenario to identify behaviors. CrowdSec 51 is engineered for modern Cloud/Containers/VM based infrastructures (by 52 decoupling detection and remediation). Once detected you can remedy 53 threats with various bouncers (firewall block, nginx http 403, Captchas, 54 etc.) while the aggressive IP can be sent to CrowdSec for curation before 55 being shared among all users to further improve everyone's security. 56 ''; 57 license = licenses.mit; 58 maintainers = with maintainers; [ jk urandom ]; 59 }; 60}