bscpkgs/bsc/garlic/extrae.nix

38 lines
705 B
Nix
Raw Normal View History

2020-09-02 10:44:13 +02:00
{
stdenv
, bash
, extrae
2020-09-02 17:07:09 +02:00
#, writeShellScriptBin
2020-09-02 10:44:13 +02:00
}:
{
2020-09-02 17:07:09 +02:00
program
2020-09-02 10:44:13 +02:00
, configFile
2020-09-02 17:07:09 +02:00
, traceLib
2020-09-02 10:44:13 +02:00
}:
2020-09-02 17:07:09 +02:00
#writeShellScriptBin "extraeWrapper" ''
# export EXTRAE_HOME=${extrae}
# export LD_PRELOAD=${extrae}/lib/lib${traceLib}trace.so:$LD_PRELOAD
# export EXTRAE_CONFIG_FILE=${configFile}
# exec ${program}
#''
2020-09-02 10:44:13 +02:00
stdenv.mkDerivation {
2020-09-02 17:07:09 +02:00
name = "extrae";
2020-09-02 10:44:13 +02:00
preferLocalBuild = true;
phases = [ "installPhase" ];
installPhase = ''
2020-09-02 17:07:09 +02:00
cat > $out <<EOF
2020-09-02 10:44:13 +02:00
#!${bash}/bin/bash
2020-09-02 17:07:09 +02:00
# Requires /nix to use bash
2020-09-02 10:44:13 +02:00
export EXTRAE_HOME=${extrae}
export LD_PRELOAD=${extrae}/lib/lib${traceLib}trace.so:$LD_PRELOAD
export EXTRAE_CONFIG_FILE=${configFile}
2020-09-02 17:07:09 +02:00
exec ${program}
2020-09-02 10:44:13 +02:00
EOF
2020-09-02 17:07:09 +02:00
chmod +x $out
2020-09-02 10:44:13 +02:00
'';
}