default.nix 17.6 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

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

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

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

, #source overrides: applications
Valentin Reis's avatar
Valentin Reis committed
21 22 23 24 25
  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
26
, candle-src       ? fetched candle/pin.json
Valentin Reis's avatar
Valentin Reis committed
27

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

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

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

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

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

Valentin Reis's avatar
Valentin Reis committed
51
  argopkgs = rec {
Valentin Reis's avatar
Valentin Reis committed
52
    singularity = bleeding.singularity;
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
pypack  
Valentin Reis committed
66
    nrm           = (callPackage ./nrm       { src=nrm-src;}).overrideAttrs (o:{
Valentin Reis's avatar
Valentin Reis committed
67
      installPhase=o.installPhase+''
Valentin Reis's avatar
Valentin Reis committed
68
        mkdir -p $out/share
Valentin Reis's avatar
Valentin Reis committed
69
        cp -r nrm/schemas $out/lib/python2.7/site-packages/nrm/
Valentin Reis's avatar
Valentin Reis committed
70
        cp -r examples $out/share
Valentin Reis's avatar
Valentin Reis committed
71 72
      '';
    });
Valentin Reis's avatar
Valentin Reis committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95

    nrm-dist      = pkgs.stdenv.mkDerivation {
      name = "nrm-dist";
      src = nrm-src;
      buildInputs =
      [
        pkgs.curl
        pkgs.bash
        pkgs.coreutils
        (pkgs.python.withPackages (ps: [
          ps.sphinx_rtd_theme
          ps.sphinx
          ps.breathe
          ps.recommonmark
        ]))
      ];
      buildPhase = ''
        python ./setup.py build_sphinx --build-dir doc
        python ./setup.py sdist
      '';
      installPhase = ''
        mkdir -p $out
        cp dist/* $out/
Valentin Reis's avatar
pinning  
Valentin Reis committed
96
        md5sum $out/* | cut -d' ' -f1> $out/CHECKSUM
Valentin Reis's avatar
Valentin Reis committed
97 98 99
      '';
    };

Valentin Reis's avatar
Valentin Reis committed
100 101 102 103
    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
104 105 106
      configureFlags = "--enable-pmpi";
      buildInputs = oldAttrs.buildInputs ++ [ pkgs.mpich2 ];
    });
107

Valentin Reis's avatar
Valentin Reis committed
108 109 110 111 112 113 114
    #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
115
    #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
116

Valentin Reis's avatar
Valentin Reis committed
117 118
    aml-check = aml.overrideAttrs (old:{
      doCheck = true;
Valentin Reis's avatar
Valentin Reis committed
119
      checkPhase = "make check";
Valentin Reis's avatar
Valentin Reis committed
120 121
    });

Valentin Reis's avatar
Valentin Reis committed
122 123 124
    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
125
    aml-check-knl = aml-check.overrideAttrs (old:{
Valentin Reis's avatar
Valentin Reis committed
126 127 128 129 130 131 132 133 134
      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
135 136 137
      '';
    });

Valentin Reis's avatar
Valentin Reis committed
138
    aml-dist      = aml.overrideAttrs (old:{
Valentin Reis's avatar
Valentin Reis committed
139 140
      nativeBuildInputs = old.nativeBuildInputs ++
      [
Valentin Reis's avatar
Valentin Reis committed
141
        pkgs.doxygen
Valentin Reis's avatar
Valentin Reis committed
142 143 144
        pkgs.curl
        pkgs.bash
        pkgs.coreutils
Valentin Reis's avatar
Valentin Reis committed
145 146 147 148 149 150
        (pkgs.python.withPackages (ps: [
          ps.sphinx_rtd_theme
          ps.sphinx
          ps.breathe
          ps.recommonmark
        ]))
Valentin Reis's avatar
Valentin Reis committed
151
      ];
Valentin Reis's avatar
Valentin Reis committed
152
      buildPhase = "make dist";
Valentin Reis's avatar
Valentin Reis committed
153 154 155 156
      installPhase = ''
        mkdir -p $out
        cp *.tar.gz $out/
      '';
Valentin Reis's avatar
Valentin Reis committed
157
    });
158

Valentin Reis's avatar
Valentin Reis committed
159 160
    numabench-check = numabench.overrideAttrs(old: {
      buildPhase = "make check";
161
      installPhase =''
162 163 164
        mkdir -p $out/tests
        cp ./tests/*.log $out/tests
        cp ./tests/*.trs $out/tests
Valentin Reis's avatar
Valentin Reis committed
165
        cp -r ./tests/tmp $out/tests
166
        '';
Valentin Reis's avatar
Valentin Reis committed
167 168 169 170 171
    });
    excit-check = excit.overrideAttrs(old: {
      buildPhase = "make check";
    });

Valentin Reis's avatar
Valentin Reis committed
172 173 174
    # applications with replaceDependency for libnrm.
    repLibnrm = path: src: extra:
    let
Valentin Reis's avatar
Valentin Reis committed
175
      drv = callPackage path ({
Valentin Reis's avatar
style.  
Valentin Reis committed
176 177 178
        nrmSupport = true;
        src = src;
        libnrm = libnrm-pinned;
Valentin Reis's avatar
Valentin Reis committed
179
      }//extra);
Valentin Reis's avatar
style.  
Valentin Reis committed
180
      rebuilt = drv.override {libnrm = libnrm;};
Valentin Reis's avatar
Valentin Reis committed
181 182 183 184 185 186
      grafted = pkgs.replaceDependency {
        drv = drv;
        oldDependency = libnrm-pinned;
        newDependency = libnrm;
      };
    in if graftLibnrm then grafted else rebuilt;
Valentin Reis's avatar
Valentin Reis committed
187 188 189 190
    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
191
    stream       = repLibnrm ./stream  stream-src  {iterationCount="2000";};
Valentin Reis's avatar
Valentin Reis committed
192

Valentin Reis's avatar
Valentin Reis committed
193 194 195 196 197 198 199 200
    callCandlePackage = candlePkgs.lib.callPackageWith (candlePkgs);
    candleOverlay = self: super: rec { clblas = callCandlePackage ./clblas {
      inherit (pkgs.darwin.apple_sdk.frameworks) Accelerate CoreGraphics CoreVideo OpenCL;
      };
    };
    candlePkgs = import pkgs.path {
      overlays = [ candleOverlay ] ;
    };
Valentin Reis's avatar
Valentin Reis committed
201
    candle       = callCandlePackage ./candle {src = candle-src; nrm = nrm;};
Valentin Reis's avatar
Valentin Reis committed
202

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

206
    # tools
207
    checkpatch = callPackage ./checkpatch {src=pkgs.linux_testing.src;};
208 209 210
    zymake = callPackage ./zymake {
      inherit (pkgs.ocamlPackages) findlib ocamlbuild topkg batteries;
    };
Valentin Reis's avatar
Valentin Reis committed
211 212
    haskellPackages = pkgs.haskellPackages.override {
      overrides = self: super: with pkgs.haskell.lib;
Valentin Reis's avatar
Valentin Reis committed
213
      rec {
Valentin Reis's avatar
Valentin Reis committed
214 215 216 217
        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
218
        generic-pretty = doJailbreak super.generic-pretty;
Valentin Reis's avatar
Valentin Reis committed
219
        jsonschema-gen = doJailbreak super.jsonschema-gen;
Valentin Reis's avatar
Valentin Reis committed
220
        aeson-t = doJailbreak super.aeson-t;
Valentin Reis's avatar
Valentin Reis committed
221

Valentin Reis's avatar
Valentin Reis committed
222 223 224
        #minor cabal and version fix
        panhandle    = (self.callCabal2nix "panhandle" (builtins.fetchGit {
                      inherit (panhandle-src) url rev; })) {};
Valentin Reis's avatar
Valentin Reis committed
225 226 227 228 229
        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
230 231
        generic-aeson   = doJailbreak super.generic-aeson;
        nrm-schema  = (self.callCabal2nix "nrm-schema"  nrm-schema-src ) {};
Valentin Reis's avatar
Valentin Reis committed
232
        zmcat = self.callPackage ./zmcat {};
Valentin Reis's avatar
Valentin Reis committed
233

234
      };
Valentin Reis's avatar
Valentin Reis committed
235
    };
Valentin Reis's avatar
Valentin Reis committed
236

Valentin Reis's avatar
Valentin Reis committed
237 238 239
    bleedingHaskellPackages = bleeding.haskellPackages.override {
      overrides = self: super: with bleeding.haskell.lib;
      rec {
Valentin Reis's avatar
Valentin Reis committed
240
        panpipe        = doJailbreak super.panpipe;
Valentin Reis's avatar
Valentin Reis committed
241 242 243
        panhandle      = (self.callCabal2nix "panhandle" (builtins.fetchGit {
                        inherit (panhandle-src) url rev; })) {};
        multistate      = doJailbreak super.multistate;
244
        #hspec       = doJailbreak super.hspec;
Valentin Reis's avatar
Valentin Reis committed
245 246 247 248
        dhrun       = (self.callCabal2nix "dhrun"       dhrun-src ) {};
      };
    };

249
    # re-export from hpkgs and add non-haskell build rule specialization
Valentin Reis's avatar
Valentin Reis committed
250
    inherit (haskellPackages) repoquality;
Valentin Reis's avatar
Valentin Reis committed
251
    #inherit (bleedingHaskellPackages) dhall dhall-lsp-server dhall-json;
Valentin Reis's avatar
Valentin Reis committed
252 253 254 255 256 257 258 259 260

    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
261

Valentin Reis's avatar
Valentin Reis committed
262
    dhrun = bleedingHaskellPackages.dhrun.overrideAttrs (old:{
Valentin Reis's avatar
Valentin Reis committed
263
        installPhase = old.installPhase + ''
Valentin Reis's avatar
Valentin Reis committed
264 265
          mkdir -p $out/share/
          cp -r resources $out/share/
Valentin Reis's avatar
Valentin Reis committed
266
        '';
Valentin Reis's avatar
Valentin Reis committed
267 268 269 270
      });

    argonix = haskellPackages.argonix.overrideAttrs (old:{
        installPhase = old.installPhase + ''
Valentin Reis's avatar
Valentin Reis committed
271
          mkdir -p $out/share/
Valentin Reis's avatar
Valentin Reis committed
272 273 274
          $out/bin/argonix --bash-completion-script argonix > $out/share/argonix.sh
        '';
      });
275

Valentin Reis's avatar
Valentin Reis committed
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
    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\")"`
      '';

    });

297
    # fix for nrm
Valentin Reis's avatar
pypack  
Valentin Reis committed
298
    pyzmq = pkgs.pythonPackages.pyzmq.override { zeromq3 = pkgs.zeromq; };
Valentin Reis's avatar
Valentin Reis committed
299

Valentin Reis's avatar
Valentin Reis committed
300
    hwloc2 = pkgs.hwloc.overrideAttrs (old:{
Valentin Reis's avatar
Valentin Reis committed
301
      name="hwloc-2";
Valentin Reis's avatar
Valentin Reis committed
302 303 304 305 306 307
      src = pkgs.fetchurl {
        url = "https://download.open-mpi.org/release/hwloc/v2.0/hwloc-2.0.3.tar.gz";
        sha256 = "0707ml34ylrr8zwwhddp64q6q57248m9646f27jadcx5m93g5pk4";
      };
    });

308
    # ci/experimental environments
Valentin Reis's avatar
Valentin Reis committed
309 310
    test = pkgs.stdenv.mkDerivation rec {
      name = "testEnv";
311

Valentin Reis's avatar
Valentin Reis committed
312
      buildInputs = [
Valentin Reis's avatar
Valentin Reis committed
313
        # tooling may run mpiexec or hwloc:
Valentin Reis's avatar
Valentin Reis committed
314
        pkgs.mpich2
Valentin Reis's avatar
Valentin Reis committed
315
        hwloc2
Valentin Reis's avatar
Valentin Reis committed
316 317 318 319 320
        # these are needed for some reason:
        pkgs.coreutils
        pkgs.utillinux
        pkgs.git
        # argo tools
Valentin Reis's avatar
Valentin Reis committed
321
        dhrun
Valentin Reis's avatar
Valentin Reis committed
322 323 324
        # argo components
        containers
        nrm
Valentin Reis's avatar
Valentin Reis committed
325
        libnrm
Valentin Reis's avatar
Valentin Reis committed
326
      ];
327

Valentin Reis's avatar
Valentin Reis committed
328
      #required to be able to build the drv.
329
      installPhase = "mkdir $out";
Valentin Reis's avatar
Valentin Reis committed
330
      unpackPhase = "true";
Valentin Reis's avatar
Valentin Reis committed
331

332 333 334 335 336 337 338 339
      __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 ""
340
      '';
341
      #argotk uses this environment variable.
Valentin Reis's avatar
Valentin Reis committed
342
      #OPENMC_PWD = "${argotk}/share/openmc";
Valentin Reis's avatar
Valentin Reis committed
343
    };
Valentin Reis's avatar
Valentin Reis committed
344 345 346 347 348 349

    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
350 351 352
      installPhase = ''
        mkdir -p $out
      '';
Valentin Reis's avatar
Valentin Reis committed
353 354 355
      unpackPhase = "true";

      buildInputs = [
356
        pkgs.pandoc
Valentin Reis's avatar
Valentin Reis committed
357 358 359 360
        (pkgs.rWrapper.override{ packages = with pkgs.rPackages; [
          pkgs.rlwrap
          pkgs.pandoc
          docopt
361 362 363 364
          pracma
          tidyr
          readr
          magrittr
Valentin Reis's avatar
Valentin Reis committed
365 366
          formatR
          purrr
367
          wrapr
Valentin Reis's avatar
Valentin Reis committed
368 369 370 371 372 373
          knitr
          cowplot
          plotly
          lubridate
          dplyr
          ggplot2
374 375 376 377
          fpp2
          prospectr
          gridExtra
          zoo
Valentin Reis's avatar
Valentin Reis committed
378 379 380 381 382 383 384
          xtable
          ggthemes
          data_table
        ];})
      ];
    };

385 386
    hanalysis = analysis.overrideAttrs (old:{
      buildInputs = old.buildInputs ++ [
Valentin Reis's avatar
Valentin Reis committed
387 388 389 390 391
        (haskellPackages.ghcWithPackages(p:[
          p.protolude
          p.optparse-applicative
          (p.inline-r.overrideAttrs(old:{doCheck=false;}))
        ]))
392 393 394
      ];
    });

Valentin Reis's avatar
Valentin Reis committed
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441
    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
442 443
    report = analysis.overrideAttrs (old:{
      buildPhase = ''
444 445
        echo "analysis/zymakefolder.R ${powerexpe}"
        analysis/zymakefolder.R ${powerexpe}
Valentin Reis's avatar
Valentin Reis committed
446 447 448 449 450 451
      '';
      installPhase = ''
        mkdir -p $out
        cp -r index* $out
      '';
    });
452

Valentin Reis's avatar
Valentin Reis committed
453
    dhrunTestConfigLayer = pkgs.stdenv.mkDerivation rec {
Valentin Reis's avatar
Valentin Reis committed
454 455 456 457 458
      name = "dhrunSpecs";
      src = ../dhrun ;
      installPhase = ''
        mkdir -p $out
        cp -r $src/* $out
459 460 461 462 463 464
        substituteInPlace $out/test_assets/simple-H2O.xml --replace \
          H2O.HF.wfs.xml $out/test_assets/H2O.HF.wfs.xml
        substituteInPlace $out/test_assets/simple-H2O.xml --replace \
          O.BFD.xml $out/test_assets/O.BFD.xml
        substituteInPlace $out/test_assets/simple-H2O.xml --replace \
          H.BFD.xml $out/test_assets/H.BFD.xml
Valentin Reis's avatar
Valentin Reis committed
465 466 467 468
        '';
      unpackPhase = "true";
    };

Valentin Reis's avatar
Valentin Reis committed
469
    doDhrun = dhallcall: test.overrideAttrs (old:{
Valentin Reis's avatar
Valentin Reis committed
470
      buildPhase = ''
Valentin Reis's avatar
Valentin Reis committed
471
        dhrun run <<< 'let all = ${dhrunTestConfigLayer}/all-tests.dh
472
                      "${dhrunTestConfigLayer}/" "${nrm}/share/examples/" True in all.${dhallcall}'
Valentin Reis's avatar
Valentin Reis committed
473
      '';
Valentin Reis's avatar
Valentin Reis committed
474
      installPhase = ''
Valentin Reis's avatar
Valentin Reis committed
475
        mkdir -p $out
Valentin Reis's avatar
Valentin Reis committed
476 477 478 479
        cp _output/* $out/
      '';
    });

Valentin Reis's avatar
Valentin Reis committed
480
    testGeneric     =  doDhrun genericTestName;
Valentin Reis's avatar
Valentin Reis committed
481 482 483
    testBrokenMessage = (doDhrun "run-singularity").overrideAttrs (o:{
      buildInputs = o.buildInputs ++ [haskellPackages.zmcat];
    });
Valentin Reis's avatar
Valentin Reis committed
484
    testSingularity = (doDhrun "run-singularity").overrideAttrs (o:{
485
      buildPhase = "PATH=$PATH:/tmp/argonix/ " + o.buildPhase;
Valentin Reis's avatar
Valentin Reis committed
486
      __noChroot = true; # the test needs OS singularity installation so we disable sanboxing here.
Valentin Reis's avatar
Valentin Reis committed
487
    });
Valentin Reis's avatar
Valentin Reis committed
488

Valentin Reis's avatar
Valentin Reis committed
489 490 491
    testSTREAM      = addBI (doDhrun "stream") stream;
    testAMG         = addBI (doDhrun "amg") amg;
    testOpenMC      = (addBI (doDhrun "openmc") openmc).overrideAttrs
Valentin Reis's avatar
Valentin Reis committed
492
      (old:{ OPENMC_CROSS_SECTIONS = "${openmc-data}/cross_sections.xml"; });
Valentin Reis's avatar
Valentin Reis committed
493 494
    testLAMMPS      = addBI (doDhrun "lammps") lammps;
    testQMCPack     = addBI (doDhrun "qmcpack") qmcpack ;
Valentin Reis's avatar
Valentin Reis committed
495

Valentin Reis's avatar
Valentin Reis committed
496
    testAll         = (doDhrun "hello").overrideAttrs
Valentin Reis's avatar
Valentin Reis committed
497 498 499 500 501 502 503 504 505
    (old:{
      buildInputs = old.buildInputs ++ [
        lammps
        qmcpack
        openmc
        stream
        amg
        openmc-data
      ];
Valentin Reis's avatar
Valentin Reis committed
506 507
      OPENMC_CROSS_SECTIONS = "${openmc-data}/cross_sections.xml";
      });
Valentin Reis's avatar
Valentin Reis committed
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522

    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
      '';
    });
523 524

    bld = bleeding;
Valentin Reis's avatar
Valentin Reis committed
525

526 527 528
    deployment = pkgs.mkShell rec {
      buildInputs = [pkgs.nixops pkgs.nix];
    };
Valentin Reis's avatar
Valentin Reis committed
529

Valentin Reis's avatar
Valentin Reis committed
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559
    dhallVersion = "1.23.0";
    dhall =
      pkgs.stdenv.mkDerivation rec {
        name = "dhall-${version}";
        version = dhallVersion;
        src = pkgs.fetchurl {
            url = "https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-${version}-x86_64-linux.tar.bz2";
            sha256 = "1fy41fy0n2yc7f2dr3bx44977380rh8dx25zjgvrp4yygrf3nlgp";
        };

        installPhase = ''
          mkdir -p $out/bin
          cp dhall $out/bin/
        '';
      };
    dhall-lsp-server  =
      pkgs.stdenv.mkDerivation rec {
        name = "dhall-lsp-server-${version}";
        version = "0.1.0.1";
        src = pkgs.fetchurl {
            url = "https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-lsp-server-${version}-x86_64-linux.tar.bz2";
            sha256 = "1mckdw03kqssspbfkpa413wmfnv68mx99im4n2s10w4gw2if3983";
        };

    installPhase = ''
      mkdir -p $out/bin
      cp dhall-lsp-server  $out/bin/
    '';
  };

560
  };
Valentin Reis's avatar
Valentin Reis committed
561

562
# re-exporting a full nixpkgs-like package set
563
in pkgs // argopkgs