default.nix 15.8 KB
Newer Older
Valentin Reis's avatar
Valentin Reis committed
1
{ # host package set (unused except for fetching nixpkgs)
Valentin Reis's avatar
Valentin Reis committed
2
  hostPkgs         ? import <nixpkgs> {}
Valentin Reis's avatar
Valentin Reis committed
3 4

, # versioned nixpkgs
Valentin Reis's avatar
Valentin Reis committed
5
  pkgs             ? import (hostPkgs.nix-update-source.fetch ./pkgs.json).src {}
Valentin Reis's avatar
Valentin Reis committed
6

Valentin Reis's avatar
Valentin Reis committed
7
, # versioned nixpkgs-older version for zmcat
Valentin Reis's avatar
Valentin Reis committed
8
  bleeding         ? import (hostPkgs.nix-update-source.fetch ./bleeding.json).src {}
Valentin Reis's avatar
Valentin Reis committed
9

Valentin Reis's avatar
Valentin Reis committed
10
, # fetcher alias for the remaining arguments
Valentin Reis's avatar
Valentin Reis committed
11
  fetched          ? s: (pkgs.nix-update-source.fetch s).src
Valentin Reis's avatar
Valentin Reis committed
12 13

, #source overrides: core nrm components
Valentin Reis's avatar
Valentin Reis committed
14
  aml-src          ? fetched aml/pin.json
Valentin Reis's avatar
Valentin Reis committed
15
, numabench-src    ? fetched numabench/pin.json
Valentin Reis's avatar
Valentin Reis committed
16
, excit-src        ? fetched excit/pin.json
Valentin Reis's avatar
Valentin Reis committed
17 18
, libnrm-src       ? fetched libnrm/pin.json
, nrm-src          ? fetched nrm/pin.json
Valentin Reis's avatar
Valentin Reis committed
19
, nrm-schema-src   ? fetched nrm-schema/pin.json
Valentin Reis's avatar
Valentin Reis committed
20
, containers-src   ? fetched containers/pin.json
Valentin Reis's avatar
Valentin Reis committed
21 22

, #source overrides: applications
Valentin Reis's avatar
Valentin Reis committed
23 24 25 26 27
  amg-src          ? fetched amg/pin.json
, qmcpack-src      ? fetched qmcpack/pin.json
, openmc-src       ? fetched openmc/pin.json
, stream-src       ? fetched stream/pin.json
, lammps-src       ? fetched lammps/pin.json
Valentin Reis's avatar
Valentin Reis committed
28

Valentin Reis's avatar
Valentin Reis committed
29
  #source overrides: tooling
30
, repoquality-src  ? builtins.fetchGit {inherit (fetched repoquality/pin.json) url rev;}
Valentin Reis's avatar
Valentin Reis committed
31
, dhrun-src        ? builtins.fetchGit {inherit (pkgs.stdenv.lib.importJSON dhrun/pin.json) url rev;}
Valentin Reis's avatar
Valentin Reis committed
32
, powerplots-src   ? builtins.fetchGit {inherit (fetched powerplots/pin.json) url rev;}
33
, argonix-src      ? builtins.fetchGit {inherit (fetched argonix/pin.json) url rev;}
Valentin Reis's avatar
Valentin Reis committed
34
, experiments-src  ? fetched experiments/pin.json
35 36

, #used for hardware experiments.
Valentin Reis's avatar
Valentin Reis committed
37
  sudoPath         ? null
Valentin Reis's avatar
Valentin Reis committed
38

Valentin Reis's avatar
Valentin Reis committed
39 40
, #whether to graft apps on libnrm.
  graftLibnrm      ? false
41 42 43

, #name for the generic test builder
  genericTestName  ? "run"
Valentin Reis's avatar
.  
Valentin Reis committed
44 45
}:
let
Valentin Reis's avatar
Valentin Reis committed
46
  panhandle-src = fetched panhandle/pin.json;
Valentin Reis's avatar
Valentin Reis committed
47
  callPackage = pkgs.lib.callPackageWith (pkgs // argopkgs);
48

Valentin Reis's avatar
Valentin Reis committed
49 50 51
  addBI = drv: bi: drv.overrideAttrs
    (old:{buildInputs=old.buildInputs ++ [ bi ];});

Valentin Reis's avatar
Valentin Reis committed
52
  argopkgs = rec {
Valentin Reis's avatar
Valentin Reis committed
53

54
    # library of nix expressions
Valentin Reis's avatar
style.  
Valentin Reis committed
55
    argolib       = import ../lib/utils.nix;
Valentin Reis's avatar
Valentin Reis committed
56

57
    # Argo components (source overridabel via argument)
Valentin Reis's avatar
Valentin Reis committed
58 59 60 61 62 63
    aml           = callPackage ./aml        {
      src=aml-src;
      hwloc=hwloc2;
      inherit excit;
      inherit numabench;
    };
Valentin Reis's avatar
Valentin Reis committed
64
    numabench     = callPackage ./numabench  {src=numabench-src; hwloc = hwloc2;};
Valentin Reis's avatar
Valentin Reis committed
65
    excit         = callPackage ./excit      {src=excit-src;};
Valentin Reis's avatar
Valentin Reis committed
66 67
    nrm           = (callPackage ./nrm        {src=nrm-src;}).overrideAttrs (o:{
      installPhase=o.installPhase+''
Valentin Reis's avatar
Valentin Reis committed
68
        cp -r nrm/schemas $out/lib/python2.7/site-packages/nrm/
Valentin Reis's avatar
Valentin Reis committed
69 70
      '';
    });
Valentin Reis's avatar
Valentin Reis committed
71 72 73 74
    containers    = callPackage ./containers {src=containers-src;};
    libnrm        = callPackage ./libnrm     {src=libnrm-src;};
    libnrm-pinned = callPackage ./libnrm     {src=fetched libnrm/pin.json;};
    libnrm-pmpi   = libnrm.overrideAttrs (oldAttrs: rec {
Valentin Reis's avatar
Valentin Reis committed
75 76 77
      configureFlags = "--enable-pmpi";
      buildInputs = oldAttrs.buildInputs ++ [ pkgs.mpich2 ];
    });
78

Valentin Reis's avatar
Valentin Reis committed
79 80 81 82 83 84 85
    #jsonschema3 = pkgs.pythonPackages.jsonschema.overrideAttrs(o:{
      #src=pkgs.fetchurl{
        #url="https://files.pythonhosted.org/packages/1f/7f/a020327823b9c405ee6f85ab3053ff171e10801b19cfe55c78bb0b3810e7/jsonschema-3.0.1.tar.gz";
        #sha256 = "03g20i1xfg4qdlk4475pl4pp7y0h37g1fbgs5qhy678q9xb822hc";
      #};
    #});

Valentin Reis's avatar
Valentin Reis committed
86
    #nrm-pytest    = nrm.overrideAttrs (old:{buildInputs = old.buildInputs++[nrm]; doCheck=true;checkPhase="py.test --deselect=test/test_messaging.py";});
Valentin Reis's avatar
Valentin Reis committed
87

Valentin Reis's avatar
Valentin Reis committed
88 89
    aml-check = aml.overrideAttrs (old:{
      doCheck = true;
Valentin Reis's avatar
Valentin Reis committed
90
      checkPhase = "make check";
Valentin Reis's avatar
Valentin Reis committed
91 92
    });

Valentin Reis's avatar
Valentin Reis committed
93 94 95
    mkl =  callPackage ./mkl {compiler_path = "/opt/intel/compilers_and_libraries/linux";};
    icc = callPackage ./icc {compiler_path = "/opt/intel/compilers_and_libraries/linux";};

Valentin Reis's avatar
Valentin Reis committed
96
    aml-check-knl = aml-check.overrideAttrs (old:{
Valentin Reis's avatar
Valentin Reis committed
97 98 99 100 101 102 103 104 105
      makeFlags = [ "-j64" "V=1"];
      configureFlags = [ "--enable-benchmarks" ];
      buildInputs = old.buildInputs ++ [pkgs.man-db icc mkl];
      CC="${icc}/bin/icc";
      preConfigure =  ''
        export CFLAGS="-mkl -xhost"
        export CC="${icc}/bin/icc"
        find . -name '*.o'
        find . -name '*.o' -delete
Valentin Reis's avatar
Valentin Reis committed
106 107 108
      '';
    });

Valentin Reis's avatar
Valentin Reis committed
109
    aml-dist      = aml.overrideAttrs (old:{
Valentin Reis's avatar
Valentin Reis committed
110 111
      nativeBuildInputs = old.nativeBuildInputs ++
      [
Valentin Reis's avatar
Valentin Reis committed
112
        pkgs.doxygen
Valentin Reis's avatar
Valentin Reis committed
113 114 115
        pkgs.curl
        pkgs.bash
        pkgs.coreutils
Valentin Reis's avatar
Valentin Reis committed
116 117 118 119 120 121
        (pkgs.python.withPackages (ps: [
          ps.sphinx_rtd_theme
          ps.sphinx
          ps.breathe
          ps.recommonmark
        ]))
Valentin Reis's avatar
Valentin Reis committed
122
      ];
Valentin Reis's avatar
Valentin Reis committed
123
      buildPhase = "make dist";
Valentin Reis's avatar
Valentin Reis committed
124 125 126 127
      installPhase = ''
        mkdir -p $out
        cp *.tar.gz $out/
      '';
Valentin Reis's avatar
Valentin Reis committed
128
    });
129

Valentin Reis's avatar
Valentin Reis committed
130 131
    numabench-check = numabench.overrideAttrs(old: {
      buildPhase = "make check";
132
      installPhase =''
133 134 135
        mkdir -p $out/tests
        cp ./tests/*.log $out/tests
        cp ./tests/*.trs $out/tests
Valentin Reis's avatar
Valentin Reis committed
136
        cp -r ./tests/tmp $out/tests
137
        '';
Valentin Reis's avatar
Valentin Reis committed
138 139 140 141 142
    });
    excit-check = excit.overrideAttrs(old: {
      buildPhase = "make check";
    });

Valentin Reis's avatar
Valentin Reis committed
143 144 145
    # applications with replaceDependency for libnrm.
    repLibnrm = path: src: extra:
    let
Valentin Reis's avatar
Valentin Reis committed
146
      drv = callPackage path ({
Valentin Reis's avatar
style.  
Valentin Reis committed
147 148 149
        nrmSupport = true;
        src = src;
        libnrm = libnrm-pinned;
Valentin Reis's avatar
Valentin Reis committed
150
      }//extra);
Valentin Reis's avatar
style.  
Valentin Reis committed
151
      rebuilt = drv.override {libnrm = libnrm;};
Valentin Reis's avatar
Valentin Reis committed
152 153 154 155 156 157
      grafted = pkgs.replaceDependency {
        drv = drv;
        oldDependency = libnrm-pinned;
        newDependency = libnrm;
      };
    in if graftLibnrm then grafted else rebuilt;
Valentin Reis's avatar
Valentin Reis committed
158 159 160 161
    amg          = repLibnrm ./amg     amg-src     {};
    qmcpack      = repLibnrm ./qmcpack qmcpack-src {};
    openmc       = repLibnrm ./openmc  openmc-src  {};
    lammps       = repLibnrm ./lammps  lammps-src  {};
Valentin Reis's avatar
Valentin Reis committed
162
    stream       = repLibnrm ./stream  stream-src  {iterationCount="2000";};
Valentin Reis's avatar
Valentin Reis committed
163

164
    # data (static, non source overridable via arguments)
Valentin Reis's avatar
Valentin Reis committed
165
    openmc-data = fetched openmc/data.json;
Valentin Reis's avatar
Valentin Reis committed
166

167
    # tools
168
    checkpatch = callPackage ./checkpatch {src=pkgs.linux_testing.src;};
169 170 171
    zymake = callPackage ./zymake {
      inherit (pkgs.ocamlPackages) findlib ocamlbuild topkg batteries;
    };
Valentin Reis's avatar
Valentin Reis committed
172 173
    haskellPackages = pkgs.haskellPackages.override {
      overrides = self: super: with pkgs.haskell.lib;
Valentin Reis's avatar
Valentin Reis committed
174
      rec {
Valentin Reis's avatar
Valentin Reis committed
175 176 177 178
        panpipe        = doJailbreak super.panpipe;
        #panhandle      = doJailbreak super.panhandle;
        spdx           = doJailbreak super.spdx;
        monad-mock     = doJailbreak super.monad-mock;
Valentin Reis's avatar
Valentin Reis committed
179
        generic-pretty = doJailbreak super.generic-pretty;
Valentin Reis's avatar
Valentin Reis committed
180
        jsonschema-gen = doJailbreak super.jsonschema-gen;
Valentin Reis's avatar
Valentin Reis committed
181
        aeson-t = doJailbreak super.aeson-t;
Valentin Reis's avatar
Valentin Reis committed
182

Valentin Reis's avatar
Valentin Reis committed
183 184 185
        #minor cabal and version fix
        panhandle    = (self.callCabal2nix "panhandle" (builtins.fetchGit {
                      inherit (panhandle-src) url rev; })) {};
Valentin Reis's avatar
Valentin Reis committed
186 187 188 189 190
        inline-r = dontCheck super.inline-r;
        argonix     = (self.callCabal2nix "argonix"     argonix-src     ) {};
        repoquality = (self.callCabal2nix "repoquality" repoquality-src ) {};
        powerplots  = (self.callCabal2nix "powerplots"  powerplots-src  ) {};

Valentin Reis's avatar
Valentin Reis committed
191 192 193
        generic-aeson   = doJailbreak super.generic-aeson;
        nrm-schema  = (self.callCabal2nix "nrm-schema"  nrm-schema-src ) {};

194
      };
Valentin Reis's avatar
Valentin Reis committed
195
    };
Valentin Reis's avatar
Valentin Reis committed
196

Valentin Reis's avatar
Valentin Reis committed
197 198 199
    bleedingHaskellPackages = bleeding.haskellPackages.override {
      overrides = self: super: with bleeding.haskell.lib;
      rec {
Valentin Reis's avatar
Valentin Reis committed
200
        panpipe        = doJailbreak super.panpipe;
Valentin Reis's avatar
Valentin Reis committed
201 202 203
        panhandle      = (self.callCabal2nix "panhandle" (builtins.fetchGit {
                        inherit (panhandle-src) url rev; })) {};
        multistate      = doJailbreak super.multistate;
204
        #hspec       = doJailbreak super.hspec;
Valentin Reis's avatar
Valentin Reis committed
205 206 207 208
        dhrun       = (self.callCabal2nix "dhrun"       dhrun-src ) {};
      };
    };

209
    # re-export from hpkgs and add non-haskell build rule specialization
Valentin Reis's avatar
Valentin Reis committed
210
    inherit (haskellPackages) repoquality;
Valentin Reis's avatar
Valentin Reis committed
211 212 213 214 215 216 217 218 219 220
    inherit (bleedingHaskellPackages) dhall dhall-json;

    nrm-schema = haskellPackages.nrm-schema.overrideAttrs (old:{
      buildInputs = old.buildInputs ++ [
        (pkgs.python.withPackages (ps: [
          ps.warlock
          ps.jsonschema
        ]))
      ];
    });
Valentin Reis's avatar
Valentin Reis committed
221

Valentin Reis's avatar
Valentin Reis committed
222
    dhrun = bleedingHaskellPackages.dhrun.overrideAttrs (old:{
Valentin Reis's avatar
Valentin Reis committed
223
        installPhase = old.installPhase + ''
Valentin Reis's avatar
Valentin Reis committed
224 225
          mkdir -p $out/share/
          cp -r resources $out/share/
Valentin Reis's avatar
Valentin Reis committed
226
        '';
Valentin Reis's avatar
Valentin Reis committed
227 228 229 230
      });

    argonix = haskellPackages.argonix.overrideAttrs (old:{
        installPhase = old.installPhase + ''
Valentin Reis's avatar
Valentin Reis committed
231
          mkdir -p $out/share/
Valentin Reis's avatar
Valentin Reis committed
232 233 234
          $out/bin/argonix --bash-completion-script argonix > $out/share/argonix.sh
        '';
      });
235

Valentin Reis's avatar
Valentin Reis committed
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
    powerplots =
    let
      pkl = with pkgs.rPackages; [ docopt pracma tidyr readr magrittr formatR
          purrr wrapr knitr cowplot plotly lubridate dplyr ggplot2 fpp2
          prospectr gridExtra zoo xtable ggthemes data_table
        ];
      myR = (pkgs.rWrapper.override{ packages = [pkl];});
    in
    haskellPackages.powerplots.overrideDerivation (drv: rec {
      buildInputs = (drv.buildInputs or []) ++ [
        pkgs.makeWrapper
        myR
      ];

      installPhase = drv.installPhase + ''
        wrapProgram "$out/bin/powerplots" \
          --set R_LIBS_SITE `Rscript -e "Sys.getenv(\"R_LIBS_SITE\")"`
      '';

    });

257
    # fix for nrm
Valentin Reis's avatar
Valentin Reis committed
258
    pyzmq = pkgs.pythonPackages.pyzmq.override { zeromq3 = pkgs.zeromq; };
Valentin Reis's avatar
Valentin Reis committed
259

Valentin Reis's avatar
Valentin Reis committed
260
    hwloc2 = pkgs.hwloc.overrideAttrs (old:{
Valentin Reis's avatar
Valentin Reis committed
261
      name="hwloc-2";
Valentin Reis's avatar
Valentin Reis committed
262 263 264 265 266 267
      src = pkgs.fetchurl {
        url = "https://download.open-mpi.org/release/hwloc/v2.0/hwloc-2.0.3.tar.gz";
        sha256 = "0707ml34ylrr8zwwhddp64q6q57248m9646f27jadcx5m93g5pk4";
      };
    });

268
    # ci/experimental environments
Valentin Reis's avatar
Valentin Reis committed
269 270
    test = pkgs.stdenv.mkDerivation rec {
      name = "testEnv";
271

Valentin Reis's avatar
Valentin Reis committed
272
      buildInputs = [
Valentin Reis's avatar
Valentin Reis committed
273
        # tooling may run mpiexec or hwloc:
Valentin Reis's avatar
Valentin Reis committed
274
        pkgs.mpich2
Valentin Reis's avatar
Valentin Reis committed
275
        hwloc2
Valentin Reis's avatar
Valentin Reis committed
276 277 278 279 280
        # these are needed for some reason:
        pkgs.coreutils
        pkgs.utillinux
        pkgs.git
        # argo tools
Valentin Reis's avatar
Valentin Reis committed
281
        dhrun
Valentin Reis's avatar
Valentin Reis committed
282 283 284
        # argo components
        containers
        nrm
Valentin Reis's avatar
Valentin Reis committed
285
        libnrm
Valentin Reis's avatar
Valentin Reis committed
286
      ];
287

Valentin Reis's avatar
Valentin Reis committed
288
      #required to be able to build the drv.
289
      installPhase = "mkdir $out";
Valentin Reis's avatar
Valentin Reis committed
290
      unpackPhase = "true";
Valentin Reis's avatar
Valentin Reis committed
291

292 293 294 295 296 297 298 299
      __noChroot = true;
      shellHook =''
        echo ""
        echo "ENTERING ENVIRONMENT: Sources of impurity for this build are: /tmp/ /etc/argo/ /var/run/ /var/lock/".
        echo "ENTERING ENVIRONMENT: Moreover, sandboxing is disabled, in particular because of:"
        echo "ENTERING ENVIRONMENT: /tmp/nrm-* sockets, /etc/argo, /var/run/, /var/lock/ which all need read access. "
        echo "ENTERING ENVIRONMENT: until these components are patched to allow for alternative paths, no sandbox use is possible."
        echo ""
300
      '';
301
      #argotk uses this environment variable.
Valentin Reis's avatar
Valentin Reis committed
302
      #OPENMC_PWD = "${argotk}/share/openmc";
Valentin Reis's avatar
Valentin Reis committed
303
    };
Valentin Reis's avatar
Valentin Reis committed
304 305 306 307 308 309

    analysis = pkgs.stdenv.mkDerivation rec {
      name = "analysis";
      src = experiments-src;

      #required to be able to build the drv.
Valentin Reis's avatar
Valentin Reis committed
310 311 312
      installPhase = ''
        mkdir -p $out
      '';
Valentin Reis's avatar
Valentin Reis committed
313 314 315
      unpackPhase = "true";

      buildInputs = [
316
        pkgs.pandoc
Valentin Reis's avatar
Valentin Reis committed
317 318 319 320
        (pkgs.rWrapper.override{ packages = with pkgs.rPackages; [
          pkgs.rlwrap
          pkgs.pandoc
          docopt
321 322 323 324
          pracma
          tidyr
          readr
          magrittr
Valentin Reis's avatar
Valentin Reis committed
325 326
          formatR
          purrr
327
          wrapr
Valentin Reis's avatar
Valentin Reis committed
328 329 330 331 332 333
          knitr
          cowplot
          plotly
          lubridate
          dplyr
          ggplot2
334 335 336 337
          fpp2
          prospectr
          gridExtra
          zoo
Valentin Reis's avatar
Valentin Reis committed
338 339 340 341 342 343 344
          xtable
          ggthemes
          data_table
        ];})
      ];
    };

345 346
    hanalysis = analysis.overrideAttrs (old:{
      buildInputs = old.buildInputs ++ [
Valentin Reis's avatar
Valentin Reis committed
347 348 349 350 351
        (haskellPackages.ghcWithPackages(p:[
          p.protolude
          p.optparse-applicative
          (p.inline-r.overrideAttrs(old:{doCheck=false;}))
        ]))
352 353 354
      ];
    });

Valentin Reis's avatar
Valentin Reis committed
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
    f = { mkDerivation, base, protolude, data-default
    , optparse-applicative, typed-process, inline-r
    , R, stdenv }:
    mkDerivation {
      pname = "hsr";
      version = "1.0.0";
      src = "";
      isLibrary = true;
      isExecutable = false;
      libraryHaskellDepends = [
        base
        protolude
        inline-r
        typed-process
        optparse-applicative
        data-default
      ];
      librarySystemDepends = [
        pkgs.pandoc
        R
        pkgs.rPackages.docopt
        pkgs.rPackages.pracma
        pkgs.rPackages.tidyr
        pkgs.rPackages.readr
        pkgs.rPackages.magrittr
        pkgs.rPackages.formatR
        pkgs.rPackages.purrr
        pkgs.rPackages.wrapr
        pkgs.rPackages.knitr
        pkgs.rPackages.cowplot
        pkgs.rPackages.plotly
        pkgs.rPackages.lubridate
        pkgs.rPackages.dplyr
        pkgs.rPackages.ggplot2
        pkgs.rPackages.fpp2
        pkgs.rPackages.prospectr
        pkgs.rPackages.gridExtra
        pkgs.rPackages.zoo
        pkgs.rPackages.xtable
        pkgs.rPackages.ggthemes
        pkgs.rPackages.data_table
      ];
      license = stdenv.lib.licenses.bsd3;
    };
    hanal = argolib.getHackEnv (pkgs//argopkgs)
      haskellPackages (haskellPackages.callPackage f {});

Valentin Reis's avatar
Valentin Reis committed
402 403
    report = analysis.overrideAttrs (old:{
      buildPhase = ''
404 405
        echo "analysis/zymakefolder.R ${powerexpe}"
        analysis/zymakefolder.R ${powerexpe}
Valentin Reis's avatar
Valentin Reis committed
406 407 408 409 410 411
      '';
      installPhase = ''
        mkdir -p $out
        cp -r index* $out
      '';
    });
412

Valentin Reis's avatar
Valentin Reis committed
413
    dhrunTestConfigLayer = pkgs.stdenv.mkDerivation rec {
Valentin Reis's avatar
Valentin Reis committed
414 415 416 417 418 419 420 421 422 423 424 425 426 427
      name = "dhrunSpecs";
      src = ../dhrun ;
      installPhase = ''
        mkdir -p $out
        cp -r $src/* $out
        substituteInPlace $out/assets/simple-H2O.xml --replace \
          H2O.HF.wfs.xml $out/assets/H2O.HF.wfs.xml
        substituteInPlace $out/assets/simple-H2O.xml --replace \
          O.BFD.xml $out/assets/O.BFD.xml
        substituteInPlace $out/assets/simple-H2O.xml --replace \
          H.BFD.xml $out/assets/H.BFD.xml
        substituteInPlace $out/lib.dh --replace \
          "dataDir = \"./\"" "dataDir = \"$out/\""
        substituteInPlace $out/lib.dh --replace \
Valentin Reis's avatar
Valentin Reis committed
428 429
          "https://xgitlab.cels.anl.gov/argo/dhrun/raw/master/" "./"
        ln -s ${dhrun}/share/resources $out/resources
Valentin Reis's avatar
Valentin Reis committed
430 431 432 433
        '';
      unpackPhase = "true";
    };

Valentin Reis's avatar
Valentin Reis committed
434
    doDhrun = dhallcall: test.overrideAttrs (old:{
Valentin Reis's avatar
Valentin Reis committed
435
      buildPhase = ''
Valentin Reis's avatar
Valentin Reis committed
436 437
        dhrun run <<< 'let all = ${dhrunTestConfigLayer}/all-tests.dh
                      "${dhrunTestConfigLayer}/" in all.${dhallcall}'
Valentin Reis's avatar
Valentin Reis committed
438
      '';
Valentin Reis's avatar
Valentin Reis committed
439
      installPhase = ''
Valentin Reis's avatar
Valentin Reis committed
440
        mkdir -p $out
Valentin Reis's avatar
Valentin Reis committed
441 442 443 444
        cp _output/* $out/
      '';
    });

Valentin Reis's avatar
Valentin Reis committed
445 446
    testGeneric     =  doDhrun genericTestName;
    testSingularity = (doDhrun "run-singularity").overrideAttrs (o:{
447
      buildPhase = "PATH=$PATH:/tmp/argonix/ " + o.buildPhase;
Valentin Reis's avatar
Valentin Reis committed
448
      __noChroot = true; # the test needs OS singularity installation so we disable sanboxing here.
Valentin Reis's avatar
Valentin Reis committed
449
    });
Valentin Reis's avatar
Valentin Reis committed
450

Valentin Reis's avatar
Valentin Reis committed
451
    doDhrunApp = app : doDhrun "${app} True < NoCap = {=} | Cap : Text >";
Valentin Reis's avatar
Valentin Reis committed
452 453 454 455 456 457
    testSTREAM      = addBI (doDhrunApp "stream") stream;
    testAMG         = addBI (doDhrunApp "amg") amg;
    testOpenMC      = (addBI (doDhrunApp "openmc") openmc).overrideAttrs
      (old:{ OPENMC_CROSS_SECTIONS = "${openmc-data}/cross_sections.xml"; });
    testLAMMPS      = addBI (doDhrunApp "lammps") lammps;
    testQMCPack     = addBI (doDhrunApp "qmcpack") qmcpack ;
Valentin Reis's avatar
Valentin Reis committed
458

Valentin Reis's avatar
Valentin Reis committed
459
    testAll         = (doDhrun "hello").overrideAttrs
Valentin Reis's avatar
Valentin Reis committed
460 461 462 463 464 465 466 467 468
    (old:{
      buildInputs = old.buildInputs ++ [
        lammps
        qmcpack
        openmc
        stream
        amg
        openmc-data
      ];
Valentin Reis's avatar
Valentin Reis committed
469 470
      OPENMC_CROSS_SECTIONS = "${openmc-data}/cross_sections.xml";
      });
Valentin Reis's avatar
Valentin Reis committed
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485

    powerexpe = testAll.overrideAttrs (old:{
      name = "power-experiments";
      buildInputs = old.buildInputs ++ [
        #debug tools
        pkgs.which
        #experiment tools
        zymake
      ];
      buildPhase = "zymake ${experiments-src}/experiments/zymakefile";
      installPhase = ''
        mkdir -p $out
        cp -r o/* $out
      '';
    });
486 487

    bld = bleeding;
Valentin Reis's avatar
Valentin Reis committed
488 489


490 491
    #testSingularity = pkgs.stdenv.mkDerivation rec {
      #name = "singdebg";
Valentin Reis's avatar
Valentin Reis committed
492

493 494 495 496 497 498 499 500 501
      #src = ../dhrun ;
      #installPhase = ''
        #mkdir -p $out
        #echo "tata"
        #PATH=$PATH:/tmp/argonix singularity --version
        #echo "toto"
        #'';
      #unpackPhase = "true";
    #};
Valentin Reis's avatar
Valentin Reis committed
502

503
  };
Valentin Reis's avatar
Valentin Reis committed
504

505
# re-exporting a full nixpkgs-like package set
506
in pkgs // argopkgs