ds: link the resultTree in the dataset

This commit is contained in:
2021-05-03 12:48:49 +02:00
parent 760787858a
commit 6937ffcfe9
14 changed files with 53 additions and 131 deletions

34
garlic/ds/py.nix Normal file
View File

@@ -0,0 +1,34 @@
{
stdenv
, python3
, gzip
}:
{
script,
compress ? true
}:
tree:
stdenv.mkDerivation {
name = "dataset";
preferLocalBuild = true;
phases = [ "installPhase" ];
buildInputs = [ python3 gzip ];
installPhase = ''
mkdir -p $out
ln -s ${tree} $out/tree
ln -s ${script} $out/script
COMPRESS_DATASET=${toString compress}
if [ $COMPRESS_DATASET ]; then
python $out/script $out/tree | gzip > $out/dataset.json.gz
ln -s dataset.json.gz $out/dataset
else
python $out/script $out/tree > $out/dataset.json
ln -s dataset.json $out/dataset
fi
'';
}