5e7c2d6cef
GitOrigin-RevId: f99e5f03cc0aa231ab5950a15ed02afec45ed51a
21 lines
627 B
Nix
21 lines
627 B
Nix
{ stdenv, unsecvars, linuxHeaders, sourceProg, debug ? false }:
|
|
# For testing:
|
|
# $ nix-build -E 'with import <nixpkgs> {}; pkgs.callPackage ./wrapper.nix { parentWrapperDir = "/run/wrappers"; debug = true; }'
|
|
stdenv.mkDerivation {
|
|
name = "security-wrapper";
|
|
buildInputs = [ linuxHeaders ];
|
|
dontUnpack = true;
|
|
hardeningEnable = [ "pie" ];
|
|
CFLAGS = [
|
|
''-DSOURCE_PROG="${sourceProg}"''
|
|
] ++ (if debug then [
|
|
"-Werror" "-Og" "-g"
|
|
] else [
|
|
"-Wall" "-O2"
|
|
]);
|
|
dontStrip = debug;
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
$CC $CFLAGS ${./wrapper.c} -I${unsecvars} -o $out/bin/security-wrapper
|
|
'';
|
|
}
|