aboutsummaryrefslogtreecommitdiff
path: root/examples/ex-wdl/wdl-scatter-gather.nix
blob: 5245662fc153118de42d198a91b838f32a0fa21d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# The scatter-gather example from https://github.com/openwdl/wdl
# translated to bionix
{ bionix ? import ./../.. { } }:

with bionix;
with lib;

let

  prepare = splitString "\n" (removeSuffix "\n" (readFile (stage {
    name = "prepare";
    buildInputs = [ pkgs.python3 ];
    buildCommand = ''
      python -c "print('one\ntwo\nthree\nfour', end=''')" > $out
    '';
  })));

  analysis = str: removeSuffix "\n" (readFile (stage {
    name = "analysis";
    buildInputs = [ pkgs.python ];
    buildCommand = ''
      python -c "print('_${str}_')" > $out
    '';
  }));

  gather = strs: stage {
    name = "gather";
    buildCommand = ''
      echo ${concatStringsSep " " strs} > $out
    '';
  };

in
gather (map analysis prepare)