default.nix 2.61 KB
Newer Older
Valentin Reis's avatar
Valentin Reis committed
1
{
2 3 4 5 6 7 8 9 10
  argopkgs-src ? (builtins.fetchGit {
    url = https://xgitlab.cels.anl.gov/argo/argopkgs.git;
    ref = "master";
    rev = "86c53fa5ba67edb3994f6ed971cdfa14bf850b4b";
  }) ,
  pkgs ? (import argopkgs-src {}),
  nrm-src ? pkgs.nodelevel.nrm.src,
  containers-src ? pkgs.nodelevel.containers.src,
  libnrm-src ? pkgs.nodelevel.libnrm.src
Valentin Reis's avatar
Valentin Reis committed
11 12
}:
let
13
  nrm = pkgs.nodelevel.nrm.overrideAttrs (old: { src =  nrm-src; });
14 15
  libnrm = pkgs.nodelevel.libnrm.overrideAttrs (old: { src =  libnrm-src; });
  containers = pkgs.nodelevel.containers.overrideAttrs (old: { src =  containers-src; });
16
  amg = pkgs.applications.nrm.amg;
Valentin Reis's avatar
Valentin Reis committed
17

Valentin Reis's avatar
Valentin Reis committed
18 19
  filterHdevTools = builtins.filterSource (path: type: baseNameOf path != ".hdevtools.sock");

20 21
  hpkgs = pkgs.haskellPackages.override {
        overrides = self: super: rec {
22
        argo = self.callCabal2nix "argo" (filterHdevTools ./argo) {};
23 24
    };
  };
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

  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
42
    source ${./completion/argotk.sh}
43 44 45
    echo "Installed bash completion."
  '';

Valentin Reis's avatar
Valentin Reis committed
46
in rec
Valentin Reis's avatar
Valentin Reis committed
47
{
48 49 50
  inherit nrm;
  inherit libnrm;
  inherit containers;
51
  inherit(hpkgs) argo;
52

53
  dev-lib = hpkgs.shellFor {
54
    packages = p: with p; [ argo ];
55
    withHoogle = true;
56
    buildInputs = devInputs ++ devHPackages;
57 58
  };

59 60 61
  manifests = ./manifests;

  argotk = pkgs.stdenv.mkDerivation rec {
62
    name = "env";
63
    env = pkgs.buildEnv { name = name; paths = buildInputs ++ propagatedBuildInputs; };
64
    src = filterHdevTools ./argotk;
65 66 67 68 69 70
    installPhase =''
      mkdir -p $out/bin
      mkdir -p $out/share
      cp argotk.hs $out/bin
      cp ${manifests}/* $out/share/
      '';
71
    buildInputs = [
72
      (hpkgs.ghcWithPackages (p: [p.argo ]))
73
    ];
74
    propagatedBuildInputs = [
75
      (hpkgs.ghcWithPackages (p: [p.argo ]))
76
      pkgs.coreutils
77
      pkgs.utillinux
78 79
    ];
    inherit shellHook;
80 81
  };

82 83 84
  test = pkgs.stdenv.mkDerivation rec {
    name = "env";
    env = pkgs.buildEnv { name = name; paths = buildInputs; };
85 86 87
    buildInputs =  [
      argotk
      pkgs.coreutils
88
      pkgs.utillinux
89 90 91 92
      containers
      amg
      nrm
    ];
93
    inherit shellHook;
94
    MANIFESTS = ./manifests;
Valentin Reis's avatar
Valentin Reis committed
95
  };
96

97 98 99 100 101 102 103 104
  hack = pkgs.stdenv.mkDerivation rec {
    name = "env";
    env = pkgs.buildEnv { name = name; paths = buildInputs; };
    buildInputs =  [
      containers
      amg
      nrm
      (hpkgs.ghcWithPackages (p: devHPackages ++ [
105 106
      argotk
      argo
107 108 109 110 111 112 113
     (pkgs.haskell.lib.doJailbreak p.panpipe)
      p.turtle]))
    ];
    inherit shellHook;
    MANIFESTS = ./manifests;
  };

Valentin Reis's avatar
Valentin Reis committed
114 115
}