Skip to content

Commit

Permalink
stdenvAdapters: add withDefaultHardeningFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
risicle committed Dec 9, 2023
1 parent 1a5bd69 commit dc2247a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkgs/stdenv/adapters.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}

0 comments on commit dc2247a

Please sign in to comment.