let basicC = subdir: name: { stdenv }: stdenv.mkDerivation { inherit name; src = ./.; buildPhase = '' runHook preBuild gcc ${subdir}/${name}.c -o ${name}.bin -pthread -lrt runHook postBuild ''; installPhase = '' runHook preInstall mkdir -p $out/bin install ${name}.bin $out/bin/${name} runHook postInstall ''; }; in { a3-producer = basicC "src" "producer"; a3-consumer = basicC "src" "consumer"; }