default.nix 16.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
  # versioned nixpkgs
Valentin Reis's avatar
Valentin Reis committed
5 6
, 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

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

Valentin Reis's avatar
Valentin Reis committed
17 18 19 20
, # source overrides: applications
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, candle-src ? fetched candle/pin.json
21

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

, # used for hardware experiments.
sudoPath ? null

, # whether to graft apps on libnrm.
graftLibnrm ? false

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

Valentin Reis's avatar
Valentin Reis committed
45 46
  addBI = drv: bi:
    drv.overrideAttrs (old: { buildInputs = old.buildInputs ++ [ bi ]; });
Valentin Reis's avatar
Valentin Reis committed
47

Valentin Reis's avatar
Valentin Reis committed
48
  argopkgs = rec {
Valentin Reis's avatar
Valentin Reis committed
49
    singularity = bleeding.singularity;
Valentin Reis's avatar
Valentin Reis committed
50

51
    # library of nix expressions
Valentin Reis's avatar
Valentin Reis committed
52
    argolib = import ../lib/utils.nix;
Valentin Reis's avatar
Valentin Reis committed
53

Valentin Reis's avatar
Valentin Reis committed
54 55 56
    variorum = callPackage ./variorum {};

    # Argo components (source overridable via argument)
Valentin Reis's avatar
Valentin Reis committed
57 58 59
    aml = callPackage ./aml {
      src = aml-src;
      hwloc = hwloc2;
Valentin Reis's avatar
Valentin Reis committed
60 61 62
      inherit excit;
      inherit numabench;
    };
Valentin Reis's avatar
Valentin Reis committed
63 64 65 66 67 68 69
    numabench = callPackage ./numabench {
      src = numabench-src;
      hwloc = hwloc2;
    };
    excit = callPackage ./excit { src = excit-src; };
    nrm = (callPackage ./nrm { src = nrm-src; }).overrideAttrs (o: {
      installPhase = o.installPhase + ''
Valentin Reis's avatar
Valentin Reis committed
70
        mkdir -p $out/share
Valentin Reis's avatar
Valentin Reis committed
71
        cp -r nrm/schemas $out/lib/python2.7/site-packages/nrm/
Valentin Reis's avatar
Valentin Reis committed
72
        cp -r examples $out/share
Valentin Reis's avatar
Valentin Reis committed
73 74
      '';
    });
Valentin Reis's avatar
Valentin Reis committed
75

Valentin Reis's avatar
Valentin Reis committed
76
    nrm-dist = pkgs.stdenv.mkDerivation {
Valentin Reis's avatar
Valentin Reis committed
77 78
      name = "nrm-dist";
      src = nrm-src;
Valentin Reis's avatar
Valentin Reis committed
79
      buildInputs = [
Valentin Reis's avatar
Valentin Reis committed
80 81 82
        pkgs.curl
        pkgs.bash
        pkgs.coreutils
Valentin Reis's avatar
Valentin Reis committed
83 84
        (pkgs.python.withPackages
          (ps: [ ps.sphinx_rtd_theme ps.sphinx ps.breathe ps.recommonmark ]))
Valentin Reis's avatar
Valentin Reis committed
85 86 87 88 89 90 91 92
      ];
      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
93
        md5sum $out/* | cut -d' ' -f1> $out/CHECKSUM
Valentin Reis's avatar
Valentin Reis committed
94 95 96
      '';
    };

Valentin Reis's avatar
Valentin Reis committed
97 98 99 100
    containers = callPackage ./containers { src = containers-src; };
    libnrm = callPackage ./libnrm { src = libnrm-src; };
    libnrm-pmpi = callPackage ./libnrm/mpi.nix { src = libnrm-src; };
    libnrm-pinned = callPackage ./libnrm { src = fetched libnrm/pin.json; };
101

Valentin Reis's avatar
Valentin Reis committed
102 103 104
    mkl = callPackage ./mkl {
      compiler_path = "/opt/intel/compilers_and_libraries/linux";
    };
105

Valentin Reis's avatar
Valentin Reis committed
106 107 108
    icc = callPackage ./icc {
      compiler_path = "/opt/intel/compilers_and_libraries/linux";
    };
Valentin Reis's avatar
Valentin Reis committed
109

Valentin Reis's avatar
Valentin Reis committed
110
    numabench-check = numabench.overrideAttrs (old: {
Valentin Reis's avatar
Valentin Reis committed
111
      buildPhase = "make check";
Valentin Reis's avatar
Valentin Reis committed
112
      installPhase = ''
113 114 115
        mkdir -p $out/tests
        cp ./tests/*.log $out/tests
        cp ./tests/*.trs $out/tests
Valentin Reis's avatar
Valentin Reis committed
116
        cp -r ./tests/tmp $out/tests
Valentin Reis's avatar
Valentin Reis committed
117
      '';
Valentin Reis's avatar
Valentin Reis committed
118
    });
Valentin Reis's avatar
Valentin Reis committed
119
    excit-check = excit.overrideAttrs (old: { buildPhase = "make check"; });
Valentin Reis's avatar
Valentin Reis committed
120

Valentin Reis's avatar
Valentin Reis committed
121 122
    # applications with replaceDependency for libnrm.
    repLibnrm = path: src: extra:
Valentin Reis's avatar
Valentin Reis committed
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
      let
        drv = callPackage path ({
          nrmSupport = true;
          src = src;
          libnrm = libnrm-pinned;
        } // extra);
        rebuilt = drv.override { libnrm = libnrm; };
        grafted = pkgs.replaceDependency {
          drv = drv;
          oldDependency = libnrm-pinned;
          newDependency = libnrm;
        };
      in if graftLibnrm then grafted else rebuilt;
    amg = repLibnrm ./amg amg-src { };
    qmcpack = repLibnrm ./qmcpack qmcpack-src { };
    openmc = repLibnrm ./openmc openmc-src { };
    lammps = repLibnrm ./lammps lammps-src { };
    stream = repLibnrm ./stream stream-src { iterationCount = "2000"; };
Valentin Reis's avatar
Valentin Reis committed
141

Valentin Reis's avatar
Valentin Reis committed
142
    callCandlePackage = candlePkgs.lib.callPackageWith (candlePkgs);
Valentin Reis's avatar
Valentin Reis committed
143 144 145 146
    candleOverlay = self: super: rec {
      clblas = callCandlePackage ./clblas {
        inherit (pkgs.darwin.apple_sdk.frameworks)
          Accelerate CoreGraphics CoreVideo OpenCL;
Valentin Reis's avatar
Valentin Reis committed
147 148
      };
    };
Valentin Reis's avatar
Valentin Reis committed
149 150 151 152
    candlePkgs = import pkgs.path { overlays = [ candleOverlay ]; };
    candle = callCandlePackage ./candle {
      src = candle-src;
      nrm = nrm;
Valentin Reis's avatar
Valentin Reis committed
153 154
    };

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

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

          #minor cabal and version fix
          panhandle = (self.callCabal2nix "panhandle"
            (builtins.fetchGit { inherit (panhandle-src) url rev; })) { };
          inline-r = dontCheck super.inline-r;
          argonix = (self.callCabal2nix "argonix" argonix-src) { };
          repoquality = (self.callCabal2nix "repoquality" repoquality-src) { };
          powerplots = (self.callCabal2nix "powerplots" powerplots-src) { };

          generic-aeson = doJailbreak super.generic-aeson;
          zmcat = self.callPackage ./zmcat { };
Valentin Reis's avatar
Valentin Reis committed
185

Valentin Reis's avatar
Valentin Reis committed
186
        };
Valentin Reis's avatar
Valentin Reis committed
187
    };
Valentin Reis's avatar
Valentin Reis committed
188

Valentin Reis's avatar
Valentin Reis committed
189
    bleedingHaskellPackages = bleeding.haskellPackages.override {
Valentin Reis's avatar
Valentin Reis committed
190 191 192 193 194 195 196 197 198
      overrides = self: super:
        with bleeding.haskell.lib; rec {
          panpipe = doJailbreak super.panpipe;
          panhandle = (self.callCabal2nix "panhandle"
            (builtins.fetchGit { inherit (panhandle-src) url rev; })) { };
          multistate = doJailbreak super.multistate;
          #hspec       = doJailbreak super.hspec;
          dhrun = (self.callCabal2nix "dhrun" dhrun-src) { };
        };
Valentin Reis's avatar
Valentin Reis committed
199 200
    };

201
    # re-export from hpkgs and add non-haskell build rule specialization
Valentin Reis's avatar
Valentin Reis committed
202
    inherit (haskellPackages) repoquality;
Valentin Reis's avatar
Valentin Reis committed
203
    #inherit (bleedingHaskellPackages) dhall dhall-lsp-server dhall-json;
Valentin Reis's avatar
Valentin Reis committed
204

Valentin Reis's avatar
Valentin Reis committed
205 206 207 208 209 210
    dhrun = bleedingHaskellPackages.dhrun.overrideAttrs (old: {
      installPhase = old.installPhase + ''
        mkdir -p $out/share/
        cp -r resources $out/share/
      '';
    });
Valentin Reis's avatar
Valentin Reis committed
211

Valentin Reis's avatar
Valentin Reis committed
212 213 214 215 216 217
    argonix = haskellPackages.argonix.overrideAttrs (old: {
      installPhase = old.installPhase + ''
        mkdir -p $out/share/
        $out/bin/argonix --bash-completion-script argonix > $out/share/argonix.sh
      '';
    });
218

Valentin Reis's avatar
Valentin Reis committed
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
    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
Valentin Reis's avatar
Valentin Reis committed
242
      ];
Valentin Reis's avatar
Valentin Reis committed
243 244 245
      myR = (pkgs.rWrapper.override { packages = [ pkl ]; });
    in haskellPackages.powerplots.overrideDerivation (drv: rec {
      buildInputs = (drv.buildInputs or [ ]) ++ [ pkgs.makeWrapper myR ];
Valentin Reis's avatar
Valentin Reis committed
246 247 248 249 250 251 252 253

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

    });

254
    # fix for nrm
Valentin Reis's avatar
pypack  
Valentin Reis committed
255
    pyzmq = pkgs.pythonPackages.pyzmq.override { zeromq3 = pkgs.zeromq; };
Valentin Reis's avatar
Valentin Reis committed
256

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

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

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

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

290
      __noChroot = true;
Valentin Reis's avatar
Valentin Reis committed
291
      shellHook = ''
292 293 294 295 296 297
        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 ""
298
      '';
299
      #argotk uses this environment variable.
Valentin Reis's avatar
Valentin Reis committed
300
      #OPENMC_PWD = "${argotk}/share/openmc";
Valentin Reis's avatar
Valentin Reis committed
301
    };
Valentin Reis's avatar
Valentin Reis committed
302 303 304 305 306 307

    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
308 309 310
      installPhase = ''
        mkdir -p $out
      '';
Valentin Reis's avatar
Valentin Reis committed
311 312 313
      unpackPhase = "true";

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

Valentin Reis's avatar
Valentin Reis committed
345
    hanalysis = analysis.overrideAttrs (old: {
346
      buildInputs = old.buildInputs ++ [
Valentin Reis's avatar
Valentin Reis committed
347
        (haskellPackages.ghcWithPackages (p: [
Valentin Reis's avatar
Valentin Reis committed
348 349
          p.protolude
          p.optparse-applicative
Valentin Reis's avatar
Valentin Reis committed
350
          (p.inline-r.overrideAttrs (old: { doCheck = false; }))
Valentin Reis's avatar
Valentin Reis committed
351
        ]))
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
    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
400

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

Valentin Reis's avatar
Valentin Reis committed
412
    dhrunTestConfigLayer = pkgs.stdenv.mkDerivation rec {
Valentin Reis's avatar
Valentin Reis committed
413
      name = "dhrunSpecs";
Valentin Reis's avatar
Valentin Reis committed
414
      src = ../dhrun;
Valentin Reis's avatar
Valentin Reis committed
415 416 417
      installPhase = ''
        mkdir -p $out
        cp -r $src/* $out
418 419 420 421 422 423
        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
424
      '';
Valentin Reis's avatar
Valentin Reis committed
425 426 427
      unpackPhase = "true";
    };

Valentin Reis's avatar
Valentin Reis committed
428 429 430 431 432 433 434 435 436 437 438
    doDhrun = dhallcall:
      test.overrideAttrs (old: {
        buildPhase = ''
          dhrun run <<< 'let all = ${dhrunTestConfigLayer}/all-tests.dh
                        "${dhrunTestConfigLayer}/" "${nrm}/share/examples/" True in all.${dhallcall}'
        '';
        installPhase = ''
          mkdir -p $out
          cp _output/* $out/
        '';
      });
Valentin Reis's avatar
Valentin Reis committed
439

Valentin Reis's avatar
Valentin Reis committed
440 441 442 443
    testGeneric = doDhrun genericTestName;
    testBrokenMessage = (doDhrun "run-singularity").overrideAttrs
      (o: { buildInputs = o.buildInputs ++ [ haskellPackages.zmcat ]; });
    testSingularity = (doDhrun "run-singularity").overrideAttrs (o: {
444
      buildPhase = "PATH=$PATH:/tmp/argonix/ " + o.buildPhase;
Valentin Reis's avatar
Valentin Reis committed
445 446
      __noChroot =
        true; # the test needs OS singularity installation so we disable sanboxing here.
Valentin Reis's avatar
Valentin Reis committed
447
    });
Valentin Reis's avatar
Valentin Reis committed
448

Valentin Reis's avatar
Valentin Reis committed
449 450 451 452 453 454
    testSTREAM = addBI (doDhrun "stream") stream;
    testAMG = addBI (doDhrun "amg") amg;
    testOpenMC = (addBI (doDhrun "openmc") openmc).overrideAttrs
      (old: { OPENMC_CROSS_SECTIONS = "${openmc-data}/cross_sections.xml"; });
    testLAMMPS = addBI (doDhrun "lammps") lammps;
    testQMCPack = addBI (doDhrun "qmcpack") qmcpack;
Valentin Reis's avatar
Valentin Reis committed
455

Valentin Reis's avatar
Valentin Reis committed
456 457 458
    testAll = (doDhrun "hello").overrideAttrs (old: {
      buildInputs = old.buildInputs
        ++ [ lammps qmcpack openmc stream amg openmc-data ];
Valentin Reis's avatar
Valentin Reis committed
459
      OPENMC_CROSS_SECTIONS = "${openmc-data}/cross_sections.xml";
Valentin Reis's avatar
Valentin Reis committed
460
    });
Valentin Reis's avatar
Valentin Reis committed
461

Valentin Reis's avatar
Valentin Reis committed
462
    powerexpe = testAll.overrideAttrs (old: {
Valentin Reis's avatar
Valentin Reis committed
463 464 465 466 467 468 469 470 471 472 473 474 475
      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
      '';
    });
476 477

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

Valentin Reis's avatar
Valentin Reis committed
479
    deployment = pkgs.mkShell rec { buildInputs = [ pkgs.nixops pkgs.nix ]; };
Valentin Reis's avatar
Valentin Reis committed
480

Valentin Reis's avatar
Valentin Reis committed
481
    dhallVersion = "1.23.0";
Valentin Reis's avatar
Valentin Reis committed
482 483 484 485 486 487 488 489
    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";
      };
Valentin Reis's avatar
Valentin Reis committed
490

Valentin Reis's avatar
Valentin Reis committed
491 492 493 494 495 496 497 498 499 500 501 502
      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";
Valentin Reis's avatar
Valentin Reis committed
503 504
      };

Valentin Reis's avatar
Valentin Reis committed
505 506 507 508 509
      installPhase = ''
        mkdir -p $out/bin
        cp dhall-lsp-server  $out/bin/
      '';
    };
Valentin Reis's avatar
Valentin Reis committed
510

511
    #legacy shell target (used by some aml branches):
512
    aml-dist = ci.aml-doc;
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543

    ci = let
      ciShell = x:
        (pkgs.mkShell x).overrideAttrs (o: {
          installPhase = "touch $out";
          phases = [ "installPhase" ];
        });
    in {
      aml-format = ciShell {
        name = "aml-format";
        buildInputs = [
          (pkgs.clang-tools.override
            (o: { llvmPackages = pkgs.llvmPackages_7; }))
        ];
      };
      aml-doc = ciShell {
        name = "aml-doc";
        inputsFrom = [ aml ];
        buildInputs = [
          pkgs.doxygen
          pkgs.curl
          pkgs.bash
          pkgs.graphviz
          pkgs.coreutils
          (pkgs.python.withPackages
            (ps: [ ps.sphinx_rtd_theme ps.sphinx ps.breathe ps.recommonmark ]))
        ];
      };

    };

544
  };
Valentin Reis's avatar
Valentin Reis committed
545

Valentin Reis's avatar
Valentin Reis committed
546
  # re-exporting a full nixpkgs-like package set
547
in pkgs // argopkgs