nixpkgs/pkgs/by-name/mo/modsecurity-crs/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

43 lines
1.5 KiB
Nix

{ lib, stdenv, fetchFromGitHub }:
stdenv.mkDerivation rec {
version = "3.3.4";
pname = "modsecurity-crs";
src = fetchFromGitHub {
owner = "coreruleset";
repo = "coreruleset";
rev = "v${version}";
sha256 = "sha256-WDJW4K85YdHrw9cys3LrnZUoTxc0WhiuCW6CiC1cAbk=";
};
installPhase = ''
install -D -m444 -t $out/rules ${src}/rules/*.conf
install -D -m444 -t $out/rules ${src}/rules/*.data
install -D -m444 -t $out/share/doc/modsecurity-crs ${src}/*.md
install -D -m444 -t $out/share/doc/modsecurity-crs ${src}/{CHANGES,INSTALL,LICENSE}
install -D -m444 -t $out/share/modsecurity-crs ${src}/rules/*.example
install -D -m444 -t $out/share/modsecurity-crs ${src}/crs-setup.conf.example
cat > $out/share/modsecurity-crs/modsecurity-crs.load.example <<EOF
##
## This is a sample file for loading OWASP CRS's rules.
##
Include /etc/modsecurity/crs/crs-setup.conf
IncludeOptional /etc/modsecurity/crs/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf
Include $out/rules/*.conf
IncludeOptional /etc/modsecurity/crs/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf
EOF
'';
meta = with lib; {
homepage = "https://coreruleset.org";
description = ''
The OWASP ModSecurity Core Rule Set is a set of generic attack detection
rules for use with ModSecurity or compatible web application firewalls.
'';
license = licenses.asl20;
platforms = platforms.all;
maintainers = with maintainers; [ izorkin ];
};
}