2023-10-09 19:29:22 +00:00
|
|
|
{ stdenv, unsecvars, linuxHeaders, sourceProg, debug ? false }:
|
2021-02-05 17:12:51 +00:00
|
|
|
# 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 = [
|
2023-10-09 19:29:22 +00:00
|
|
|
''-DSOURCE_PROG="${sourceProg}"''
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ (if debug then [
|
|
|
|
"-Werror" "-Og" "-g"
|
|
|
|
] else [
|
|
|
|
"-Wall" "-O2"
|
|
|
|
]);
|
|
|
|
dontStrip = debug;
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
2023-10-09 19:29:22 +00:00
|
|
|
$CC $CFLAGS ${./wrapper.c} -I${unsecvars} -o $out/bin/security-wrapper
|
2021-02-05 17:12:51 +00:00
|
|
|
'';
|
|
|
|
}
|