default.nix 5.25 KB
Newer Older
Valentin Reis's avatar
Valentin Reis committed
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
{ # host package set (unused except for fetching nixpkgs)
  hostPkgs        ? import <nixpkgs> {}

, # versioned nixpkgs
  pkgs            ? import (hostPkgs.nix-update-source.fetch ./pkgs.json).src {}

, # fetcher alias for the remaining arguments
  fetched         ? (s: (pkgs.nix-update-source.fetch s).src)

, #source overrides: core nrm components
  aml-src         ? fetched aml/master.json
, libnrm-src      ? fetched libnrm/master.json
, nrm-src         ? fetched nrm/master.json
, containers-src  ? fetched containers/master.json
, amg-src         ? fetched amg/master.json

, #source overrides: applications
  qmcpack-src     ? fetched qmcpack/master.json
, openmc-src      ? fetched openmc/master.json
, stream-src      ? fetched stream/master.json
, lammps-src      ? fetched lammps/master.json

, #source overrides :tooling
  repoquality-src ? fetched repoquality/master.json,
  argotk-src      ? fetched argotk/master.json,
  argonix-src     ? fetched argonix/master.json,
Valentin Reis's avatar
.  
Valentin Reis committed
27 28
}:
let
Valentin Reis's avatar
Valentin Reis committed
29 30 31 32 33 34 35 36 37 38 39 40
  callPackage = pkgs.lib.callPackageWith (pkgs // argopkgs);
  argopkgs = rec {
    argoLib     = import ../lib/utils.nix;
    # Argo components (source overridabel via argument):
    aml        = callPackage ./aml        {src = aml-src;};
    nrm        = callPackage ./nrm        {src = nrm-src;};
    containers = callPackage ./containers {src = containers-src;};
    libnrm     = callPackage ./libnrm     {src = libnrm-src;};
    libnrm-pmpi = libnrm.overrideAttrs (oldAttrs: rec {
      configureFlags = "--enable-pmpi";
      buildInputs = oldAttrs.buildInputs ++ [ pkgs.mpich2 ];
    });
41

Valentin Reis's avatar
Valentin Reis committed
42
    # Applications (source overridable via argument):
43

Valentin Reis's avatar
Valentin Reis committed
44 45 46 47 48
    amg     = callPackage ./amg     { nrmSupport=true; src = amg-src; };
    qmcpack = callPackage ./qmcpack { nrmSupport=true; src = qmcpack-src; };
    openmc  = callPackage ./openmc  { nrmSupport=true; src = openmc-src; };
    stream  = callPackage ./stream  { nrmSupport=true; src = stream-src; };
    lammps  = callPackage ./lammps  { nrmSupport=true; src = lammps-src; };
Valentin Reis's avatar
Valentin Reis committed
49

Valentin Reis's avatar
Valentin Reis committed
50 51
    # Data (static, non source overridable via arguments):
    openmc-data = fetched openmc/data.json;
Valentin Reis's avatar
Valentin Reis committed
52

Valentin Reis's avatar
Valentin Reis committed
53 54 55 56 57 58 59 60
    #Tools:
    haskellPackages = pkgs.haskellPackages.override {
      overrides = self: super: with pkgs.haskell.lib;
      let
        loader = argoLib.cabalDevLoader pkgs self;
      in rec {
        panpipe        = (pkgs.haskell.lib.doJailbreak super.panpipe);
        generic-pretty = doJailbreak super.generic-pretty;
Valentin Reis's avatar
Valentin Reis committed
61

Valentin Reis's avatar
Valentin Reis committed
62 63 64 65 66 67 68 69 70 71 72
        #minor cabal and version fix
        panhandle    = (self.callCabal2nix "panhandle" (builtins.fetchGit {
                      inherit (panhandle-src) url rev; })) {};

        #argo tools
        argotk    = (self.callCabal2nix "argotk" (builtins.fetchGit {
                      inherit (argotk-src) url rev; })) {};
        argonix   = (self.callCabal2nix "argonix" (builtins.fetchGit {
                      inherit (argonix-src) url rev; })) {};
        repoquality   = (self.callCabal2nix "repoquality" (builtins.fetchGit {
                      inherit (repoquality-src) url rev; })) {};
73
      };
Valentin Reis's avatar
Valentin Reis committed
74
    };
Valentin Reis's avatar
Valentin Reis committed
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
    # re-export from hpkgs and add non-haskell build outputs.
    inherit (haskellPackages) argonix repoquality;
    argotk = argoLib.addHackEnv pkgs haskellPackages (haskellPackages.argotk.overrideAttrs (old:{
        buildInputs=old.buildInputs ++ [pkgs.hwloc];
        installPhase = old.installPhase + ''
          mkdir $out/share/
          ARGOTK_SHARE=share $out/bin/argotk --bash-completion-script argotk > $out/share/argotk.sh
          cp -r share/* $out/share/
          substituteInPlace $out/share/simple-H2O.xml --replace \
                H2O.HF.wfs.xml $out/share/H2O.HF.wfs.xml
          substituteInPlace $out/share/simple-H2O.xml --replace \
                O.BFD.xml $out/share/O.BFD.xml
          substituteInPlace $out/share/simple-H2O.xml --replace \
                H.BFD.xml $out/share/H.BFD.xml
        '';
      }));
91

Valentin Reis's avatar
Valentin Reis committed
92 93
    # Fixing the pyzmq package in this attribute set.
    pyzmq = pkgs.pythonPackages.pyzmq.override { zeromq3 = pkgs.zeromq; };
Valentin Reis's avatar
Valentin Reis committed
94

Valentin Reis's avatar
Valentin Reis committed
95 96
    # archived for sake of the simplicity of this file:
    #zmcat = pkgs-stable.haskellPackages.callPackage ./tools/zmcat {};
97

Valentin Reis's avatar
Valentin Reis committed
98 99 100
    # nix-shell environments, can not be built.
    test = pkgs.stdenv.mkDerivation rec {
      name = "testEnv";
101

Valentin Reis's avatar
Valentin Reis committed
102 103 104
      #required to be able to build the drv.
      installPhase = "mkdir $$out";
      unpackPhase = "true";
Valentin Reis's avatar
Valentin Reis committed
105

Valentin Reis's avatar
Valentin Reis committed
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
      buildInputs =  [
        # argotk runs mpiexec:
        pkgs.mpich2
        # argotk uses hwloc to choose CPU counts:
        pkgs.hwloc
        # these are needed for some reason:
        pkgs.coreutils
        pkgs.utillinux
        pkgs.git
        # argo tools
        argotk
        # argo components
        containers
        nrm
        # sample application for testing progress reports:
        (stream.override {libnrm = libnrm; iterationCount = "20";})
      ];
      shellHook ="source ${argotk}/share/argotk.sh"; # bash completion
      ARGOTK_SHARE = "${argotk}/share"; # for argotk to find its versioned data
    };
Valentin Reis's avatar
Valentin Reis committed
126

Valentin Reis's avatar
Valentin Reis committed
127 128 129 130 131 132
    expe = test.overrideAttrs (old:{
      buildInputs = old.buildInputs ++
      [amg lammps qmcpack stream openmc openmc-data];
      OPENMC_CROSS_SECTIONS = "${openmc-data}/cross_sections.xml";
      OPENMC_PWD = "${argotk}/share/openmc";
    });
Valentin Reis's avatar
Valentin Reis committed
133

134
  };
Valentin Reis's avatar
Valentin Reis committed
135
# This file re-exports a full nixpkgs-like package set.
136
in pkgs // argopkgs