nixpkgs/pkgs/build-support/grsecurity/default.nix
Joachim Fasting 6d1bf921fa
grsecurity: work around #19698
This is a temporary work-around to fix using grsecurity on NixOS with
the new kernelPackages/kernelPatches machinery.

For whatever reason, when `security.grsecurity.enable = true`, the grsec
patch ends up being applied twice, causing the kernel build to fail.

Until the root cause of this is identified, we hack around it by simply
pruning duplicate patches in the grsec kernel builder.

Closes #19698
2016-10-23 18:25:29 +02:00

38 lines
774 B
Nix

{ stdenv
, lib
, overrideDerivation
# required for gcc plugins
, gmp, libmpc, mpfr
# the base kernel
, kernel
, grsecPatch
, kernelPatches ? []
, localver ? "-grsec"
, modDirVersion ? "${kernel.version}${localver}"
, extraConfig ? ""
, ...
} @ args:
assert (kernel.version == grsecPatch.kver);
overrideDerivation (kernel.override {
inherit modDirVersion;
kernelPatches = lib.unique ([ grsecPatch ] ++ kernelPatches ++ (kernel.kernelPatches or []));
extraConfig = ''
GRKERNSEC y
PAX y
${extraConfig}
'';
ignoreConfigErrors = true;
}) (attrs: {
nativeBuildInputs = (lib.chooseDevOutputs [ gmp libmpc mpfr ]) ++ (attrs.nativeBuildInputs or []);
preConfigure = ''
echo ${localver} >localversion-grsec
${attrs.preConfigure or ""}
'';
})