diff --git a/garlic/stages/broom.nix b/garlic/stages/broom.nix deleted file mode 100644 index 6586170..0000000 --- a/garlic/stages/broom.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - stdenv -}: - -{ - program -}: - -# This stage provides a clean environment to run experiments -stdenv.mkDerivation { - name = "broom"; - preferLocalBuild = true; - phases = [ "installPhase" ]; - installPhase = '' - cat > $out < $out <&2 echo ----- ENV BEGIN ------- - >&2 /usr/bin/env - >&2 echo ----- ENV END ------- - - exec ${program} \''${argv[@]} - EOF - chmod +x $out - ''; -} diff --git a/garlic/stages/extrae.nix b/garlic/stages/extrae.nix index 4d2db35..dabb31e 100644 --- a/garlic/stages/extrae.nix +++ b/garlic/stages/extrae.nix @@ -1,36 +1,34 @@ { stdenv -, bash -#, writeShellScriptBin +, garlicTools }: { - program + nextStage , configFile , traceLib , extrae }: -#writeShellScriptBin "extraeWrapper" '' -# export EXTRAE_HOME=${extrae} -# export LD_PRELOAD=${extrae}/lib/lib${traceLib}trace.so:$LD_PRELOAD -# export EXTRAE_CONFIG_FILE=${configFile} -# exec ${program} -#'' +with garlicTools; -stdenv.mkDerivation { - name = "extrae"; - preferLocalBuild = true; - phases = [ "installPhase" ]; - installPhase = '' - cat > $out < $out <; - - gen = rec { - # genAttrSets "a" ["hello" "world"] - # [ { a = "hello"; } { a = "world"; } ] - genAttrSets = (name: arr: (map (x: {${name}=x; })) arr); - - # addAttrSets "a" [1 2] {e=4;} - # [ { a = 1; e = 4; } { a = 2; e = 4; } ] - addAttrSets = (name: arr: set: (map (x: set // {${name}=x; })) arr); - - # attrToList {a=1;} - # [ { name = "a"; value = 1; } ] - attrToList = (set: map (name: {name=name; value=set.${name};} ) (builtins.attrNames set)); - - # mergeConfig [{e=1;}] {name="a"; value=[1 2] - # [ { a = 1; e = 1; } { a = 2; e = 1; } ] - mergeConfig = (arr: new: lib.flatten ( map (x: addAttrSets new.name new.value x) arr)); - - # genConfigs {a=[1 2]; b=[3 4];} - # [ { a = 1; b = 3; } { a = 1; b = 4; } { a = 2; b = 3; } { a = 2; b = 4; } ] - genConfigs = (config: lib.foldl mergeConfig [{}] (attrToList config)); - - # Generate multiple app versions by override with each config - genApp = (app: configs: map (conf: app.override conf // {conf=conf;}) configs); - - # Generate app version from an array of apps - genApps = (apps: configs: - lib.flatten (map (app: genApp app configs) apps)); - - }; -in - gen diff --git a/garlic/stages/nix-setup.nix b/garlic/stages/nix-setup.nix deleted file mode 100644 index b340b19..0000000 --- a/garlic/stages/nix-setup.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - stdenv -}: - -{ - program -, nixsetup -}: - -stdenv.mkDerivation { - name = "nixsetup"; - preferLocalBuild = true; - phases = [ "installPhase" ]; - dontPatchShebangs = true; - installPhase = '' - cat > $out <&2 echo Running nixsetup stage - env - - # We need to enter the nix namespace first, in order to have /nix - # available, so we use this hack: - if [ ! -e /nix ]; then - exec ${nixsetup} \$0 - fi - - exec ${program} - EOF - chmod +x $out - ''; -} diff --git a/garlic/stages/perf.nix b/garlic/stages/perf.nix deleted file mode 100644 index 7518381..0000000 --- a/garlic/stages/perf.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - stdenv -, bash -, perf -}: - -{ - program -, perfArgs ? "record -a" -}: - -stdenv.mkDerivation { - name = "perfWrapper"; - preferLocalBuild = true; - phases = [ "installPhase" ]; - installPhase = '' - cat > $out < $out/config.raw << EOF - ${builtins.toJSON conf} - EOF - jq . $out/config.raw > $out/config.json - rm $out/config.raw - ''; -} diff --git a/garlic/stages/statspy.nix b/garlic/stages/statspy.nix deleted file mode 100644 index 93e6459..0000000 --- a/garlic/stages/statspy.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - stdenv -, bash -}: - -{ - program -, outputDir ? "." -}: - -stdenv.mkDerivation { - name = "statspy"; - preferLocalBuild = true; - phases = [ "installPhase" ]; - programPath = "/bin/${name}"; - installPhase = '' - mkdir -p $out/bin - cat > $out/bin/${name} < ${outputDir}/statspy.\$(date +%s.%3N).begin - ${program} - cat /proc/[0-9]*/stat | sort -n > ${outputDir}/statspy.\$(date +%s.%3N).end - - EOF - chmod +x $out/bin/${name} - ''; -} diff --git a/garlic/stages/strace.nix b/garlic/stages/strace.nix index 56eb932..22fb4a5 100644 --- a/garlic/stages/strace.nix +++ b/garlic/stages/strace.nix @@ -1,23 +1,29 @@ { stdenv -, bash , strace +, garlicTools }: { - program + nextStage }: -stdenv.mkDerivation { - name = "strace"; - preferLocalBuild = true; - phases = [ "installPhase" ]; - installPhase = '' - cat > $out < $out < $out < $out <