b5f92a349c
GitOrigin-RevId: 7c9cc5a6e5d38010801741ac830a3f8fd667a7a0
20 lines
596 B
Nix
20 lines
596 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;
|
|
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
|
|
'';
|
|
}
|