stdenvAdapters: add withDefaultHardeningFlags

This commit is contained in:
Robert Scott 2023-10-04 22:34:13 +01:00
parent 1a5bd697ad
commit dc2247a3b5

View file

@ -417,4 +417,18 @@ rec {
"propagatedBuildInputs"
]);
});
withDefaultHardeningFlags = defaultHardeningFlags: stdenv: let
bintools = let
bintools' = stdenv.cc.bintools;
in if bintools' ? override then (bintools'.override {
inherit defaultHardeningFlags;
}) else bintools';
in
stdenv.override (old: {
cc = if stdenv.cc == null then null else stdenv.cc.override {
inherit bintools;
};
allowedRequisites = lib.mapNullable (rs: rs ++ [ bintools ]) (stdenv.allowedRequisites or null);
});
}