I am building a custom kernel derivation using Linux kernel - NixOS Wiki example, but as I have a patch which does not apply without passing -N flag, then I need to find a way how to pass it.
Other derivations usually support patchFlags attribute, I think I had a luck with overriding it in the past at least once, but today seems like I’m not lucky and after digging in nixpkgs repository, seems like patchFlags doesn’t even get passed on/inherited by final package derivation.
Based on the example, I’ve tried following things:
{ pkgs, ... }:
{
boot.kernelPackages = let
linux_sgx_pkg = { fetchurl, buildLinux, ... } @ args:
buildLinux (args // rec {
version = "5.4.0-rc3";
modDirVersion = version;
src = fetchurl {
url = "https://github.com/jsakkine-intel/linux-sgx/archive/v23.tar.gz";
sha256 = "11rwlwv7s071ia889dk1dgrxprxiwgi7djhg47vi56dj81jgib20";
};
kernelPatches = [
{ name = "mypatch"
, patch = (fetchurl "https://domain.tld/patch.xz")}
];
patchFlags = ["-N"]; # Does not work
extraConfig = ''
INTEL_SGX y
'';
extraMeta.branch = "5.4";
} // (args.argsOverride or {}));
linux_sgx = (pkgs.callPackage linux_sgx_pkg {
patchFlags = ["-N"]; # Does not work here either
}).overrideAttrs (old: rec {
patchFlags = ["-N"]; # Nor here, also causes other attributes to vanish?
});
in
pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_sgx);
}
Am I missing something?