default.nix 5.95 KB
Newer Older
Valentin Reis's avatar
Valentin Reis committed
1
{
2 3 4 5 6 7 8 9
  argopkgs-src ?
   let
      hostPkgs = import <nixpkgs> {};
      pinnedVersion = hostPkgs.lib.importJSON ./pin.json;
    in
      hostPkgs.fetchgit {
        inherit (pinnedVersion) url rev sha256;
      },
10
  pkgs ? import argopkgs-src {},
11 12 13 14 15 16 17 18 19
  nrm-src              ? pkgs.nodelevel.nrm.src,
  containers-src       ? pkgs.nodelevel.containers.src,
  libnrm-src           ? pkgs.nodelevel.libnrm.src,
  amg-src              ? pkgs.applications.nrm.amg.src,
  lammps-src           ? pkgs.applications.nrm.lammps.src,
  qmcpack-src          ? pkgs.applications.nrm.qmcpack.src,
  stream-src           ? pkgs.applications.nrm.stream.src,
  dgemm_randomwalk-src ? pkgs.applications.nrm.dgemm_randomwalk.src,
  #graph500-src         ? pkgs.applications.nrm.graph500.src,
Valentin Reis's avatar
Valentin Reis committed
20 21
}:
let
Valentin Reis's avatar
Valentin Reis committed
22 23
  filterHdevTools = builtins.filterSource (path: type: baseNameOf path != ".hdevtools.sock");

24 25
  hpkgs = pkgs.haskellPackages.override {
        overrides = self: super: rec {
26
        argo = self.callCabal2nix "argo" (filterHdevTools ./argo) {};
Valentin Reis's avatar
Valentin Reis committed
27
        argotk = self.callCabal2nix "argotk" (filterHdevTools ./argotk) {};
28 29
    };
  };
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

  devInputs = with hpkgs; with pkgs; [
    sysstat
  ];

  devHPackages = with hpkgs; [
    cabal-install
    apply-refact
    hdevtools
    hindent
    hlint
    shake
    brittany
    ghcid
  ];

  shellHook = ''
Valentin Reis's avatar
Valentin Reis committed
47
    source ${./completion/argotk.sh}
48 49 50
    echo "Installed bash completion."
  '';

Valentin Reis's avatar
Valentin Reis committed
51
in rec
Valentin Reis's avatar
Valentin Reis committed
52
{
53 54 55 56 57 58 59 60 61 62
  nrm              = pkgs.nodelevel.nrm.overrideAttrs            (old: {src  = nrm-src;}        );
  libnrm           = pkgs.nodelevel.libnrm.overrideAttrs         (old: {src  = libnrm-src;}     );
  containers       = pkgs.nodelevel.containers.overrideAttrs     (old: {src  = containers-src;} );
  amg              = (pkgs.applications.nrm.amg.overrideAttrs              (old: {src = amg-src;}              )).override {libnrm = libnrm;};
  qmcpack          = (pkgs.applications.nrm.qmcpack.overrideAttrs          (old: {src = qmcpack-src;}          )).override {libnrm = libnrm;};
  stream-test      = (pkgs.applications.nrm.stream.overrideAttrs           (old: {src = stream-src;}           )).override {libnrm = libnrm; iterationCount = "20";};
  stream           = (pkgs.applications.nrm.stream.overrideAttrs           (old: {src = stream-src;}           )).override {libnrm = libnrm; iterationCount = "20000";};
  lammps           = (pkgs.applications.nrm.lammps.overrideAttrs           (old: {src = lammps-src;}           )).override {libnrm = libnrm;};
  #dgemm_randomwalk = (pkgs.applications.nrm.dgemm_randomwalk.overrideAttrs (old: {src = dgemm_randomwalk-src;} )).override {libnrm = libnrm;};
  #graph500         = (pkgs.applications.nrm.graph500.overrideAttrs         (old: {src = graph500-src;}         )).override {libnrm = libnrm;};
63

Valentin Reis's avatar
Valentin Reis committed
64
  inherit(hpkgs) argo argotk;
65

Valentin Reis's avatar
Valentin Reis committed
66
  hack-argo = hpkgs.shellFor {
67
    packages = p: with p; [ argo ];
68
    withHoogle = true;
69
    buildInputs = devInputs ++ devHPackages;
70 71
  };

Valentin Reis's avatar
Valentin Reis committed
72 73 74 75 76 77
  hack-argotk = hpkgs.shellFor {
    packages = p: with p; [ argotk ];
    withHoogle = true;
    buildInputs = devInputs ++ devHPackages;
  };

78 79
  manifests = ./manifests;

Valentin Reis's avatar
Valentin Reis committed
80
  argotkp = pkgs.stdenv.mkDerivation rec {
81
    name = "env";
82
    env = pkgs.buildEnv { name = name; paths = buildInputs ++ propagatedBuildInputs; };
83
    src = filterHdevTools ./argotk;
84 85 86 87 88 89
    installPhase =''
      mkdir -p $out/bin
      mkdir -p $out/share
      cp argotk.hs $out/bin
      cp ${manifests}/* $out/share/
      '';
90
    buildInputs = [
91
      (hpkgs.ghcWithPackages (p: [p.argo ]))
92
    ];
93
    propagatedBuildInputs = [
94
      (hpkgs.ghcWithPackages (p: [p.argo ]))
95
      pkgs.coreutils
96
      pkgs.utillinux
97 98
    ];
    inherit shellHook;
99 100
  };

101
  test = pkgs.stdenv.mkDerivation rec {
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
    name = "env";
    env = pkgs.buildEnv { name = name; paths = buildInputs; };
    buildInputs =  [
      argotkp
      pkgs.coreutils
      pkgs.utillinux
      containers

      #amg
      stream stream-test
      #qmcpack
      #lammps
      #dgemm_randomwalk
      #graph500

      pkgs.mpich2
      nrm
    ];
    inherit shellHook;
    MANIFESTS = ./manifests;
  };

  expe = pkgs.stdenv.mkDerivation rec {
125 126
    name = "env";
    env = pkgs.buildEnv { name = name; paths = buildInputs; };
127
    buildInputs =  [
Valentin Reis's avatar
Valentin Reis committed
128
      argotkp
129
      pkgs.coreutils
130
      pkgs.utillinux
131
      containers
132 133 134 135

      #amg
      stream stream-test
      qmcpack
136
      #lammps
137 138 139
      #dgemm_randomwalk
      #graph500

140
      pkgs.mpich2
141 142
      nrm
    ];
143
    inherit shellHook;
144
    MANIFESTS = ./manifests;
Valentin Reis's avatar
Valentin Reis committed
145
  };
146

147 148 149 150 151 152
  hack = pkgs.stdenv.mkDerivation rec {
    name = "env";
    env = pkgs.buildEnv { name = name; paths = buildInputs; };
    buildInputs =  [
      containers
      nrm
153 154 155 156

      #amg
      stream stream-test
      qmcpack
157
      #lammps
158 159 160
      #dgemm_randomwalk
      #graph500

161
      (hpkgs.ghcWithPackages (p: devHPackages ++ [
162 163
      argotk
      argo
164 165 166 167 168 169
     (pkgs.haskell.lib.doJailbreak p.panpipe)
      p.turtle]))
    ];
    inherit shellHook;
    MANIFESTS = ./manifests;
  };
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188

  test-list =
    let
    showSource = s: pkgs.runCommand "source" {} "echo '${builtins.toJSON s}' | ${pkgs.jq}/bin/jq > $out";
    tests = import ./tests/default.nix {};
    showTest = name: content: ''
      ##### TEST NAME: ${name} #####
      argotest: source with type ${content.argotest.type} pointing to ${content.argotest.rev}". Detailed source info:
      ${builtins.readFile (showSource content.argotest.args)}
      nrm: source with type ${content.nrm.type} pointing to ${content.nrm.rev}". Detailed source info:
      ${builtins.readFile (showSource content.nrm.args)}
      libnrm: source with type ${content.libnrm.type} pointing to ${content.libnrm.rev}". Detailed source info:
      ${builtins.readFile (showSource content.libnrm.args)}
      containers: source with type ${content.containers.type} pointing to ${content.containers.rev}". Detailed source info:
      ${builtins.readFile (showSource content.containers.args)}
    '';
    in pkgs.writeText "test-list" (''
      Available test provenance configurations:
     ''+(builtins.concatStringsSep "\n" (pkgs.lib.mapAttrsToList showTest tests)));
Valentin Reis's avatar
Valentin Reis committed
189
}