Add hardeningDisable to devShell module

This commit is contained in:
Archit Gupta 2024-10-30 21:52:12 -07:00
parent 566fbde51a
commit aaf1441ff7
3 changed files with 13 additions and 1 deletions

View File

@ -508,6 +508,9 @@ list.
initialization. It can optionally be a function taking the package set and
returning such a string.
`devShell.hardeningDisable` is a list of hardening options to disable. Setting
it to `["all"]` disables all Nix hardening.
`devShell.env` is for setting environment variables in the shell. It is an
attribute set mapping variables to values. It can optionally be a function
taking the package set and returning such an attribute set.

View File

@ -25,6 +25,11 @@ let
default = "";
};
hardeningDisable = mkOption {
type = listOf str;
default = [ ];
};
env = mkOption {
type = optFunctionTo (lazyAttrsOf str);
default = { };
@ -59,7 +64,10 @@ let
else
let cfg' = mapAttrs (_: v: v pkgs) cfg; in
pkgs.mkShell.override { inherit (cfg') stdenv; }
(cfg'.env // { inherit (cfg') inputsFrom packages shellHook; });
(cfg'.env // {
inherit (cfg') inputsFrom packages shellHook;
inherit (cfg) hardeningDisable;
});
in
{
options = {

View File

@ -343,6 +343,7 @@ in
'';
env.TEST_VAR = "test value";
stdenv = pkgs: pkgs.clangStdenv;
hardeningDisable = [ "all" ];
};
})
(f: lib.isDerivation f.devShells.x86_64-linux.default);