utils.nix 1.89 KB
Newer Older
Valentin Reis's avatar
Valentin Reis committed
1
let
2
  f1 = { mkDerivation, stdenv
Valentin Reis's avatar
Valentin Reis committed
3 4 5
      , cabal-install
      , apply-refact
      , hdevtools
Valentin Reis's avatar
Valentin Reis committed
6
      , Glob
Valentin Reis's avatar
Valentin Reis committed
7 8 9 10 11 12
      , hindent
      , fswatch
      , hlint
      , protolude
      , shake
      , ghcid
13 14
      , typed-process
      , unix
Valentin Reis's avatar
Valentin Reis committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28
      }:
      mkDerivation {
        pname = "dummy";
        version = "";
        src = "";
        libraryHaskellDepends = [
            cabal-install
            apply-refact
            hdevtools
            hindent
            fswatch
            hlint
            protolude
            shake
Valentin Reis's avatar
Valentin Reis committed
29
            Glob
Valentin Reis's avatar
Valentin Reis committed
30
            ghcid
31 32
            typed-process
            unix
Valentin Reis's avatar
Valentin Reis committed
33 34 35 36 37
        ];
        description = "";
        license = stdenv.lib.licenses.mit;
      };

38 39
  f2 = { mkDerivation, stdenv
      , brittany
Valentin Reis's avatar
Valentin Reis committed
40 41
      , panpipe
      , panhandle
42 43 44 45 46 47 48 49
      , haskell-tools-refactor
      }:
      mkDerivation {
        pname = "dummy";
        version = "";
        src = "";
        libraryHaskellDepends = [
            brittany
Valentin Reis's avatar
Valentin Reis committed
50 51
            panpipe
            panhandle
52 53 54 55 56
            haskell-tools-refactor
        ];
        description = "";
        license = stdenv.lib.licenses.mit;
      };
Valentin Reis's avatar
Valentin Reis committed
57
in
Valentin Reis's avatar
Valentin Reis committed
58 59 60 61 62 63 64
rec {
  filter = path:
    builtins.filterSource (path: _:
    (baseNameOf path != ".hdevtools.sock") &&
    (baseNameOf path != ".ghc.environment.x86_64-linux-8.4.4") &&
    (baseNameOf path != "_output") &&
    (baseNameOf path != "result") &&
Valentin Reis's avatar
Valentin Reis committed
65 66
    (baseNameOf path != "README") &&
    (baseNameOf path != ".README") &&
Valentin Reis's avatar
Valentin Reis committed
67 68
    (baseNameOf path != "dist")) path;

Valentin Reis's avatar
Valentin Reis committed
69 70 71 72
  devInputs = p: [
    p.git
    p.hwloc
    p.htop
Valentin Reis's avatar
Valentin Reis committed
73 74
  ];

75
  getHackEnv = pkgs1: pkgs2: super: package : super.shellFor {
Valentin Reis's avatar
Valentin Reis committed
76 77
    packages = p: [
      package
78 79
      (pkgs1.haskellPackages.callPackage f1 {})
      (pkgs2.haskellPackages.callPackage f2 {})
Valentin Reis's avatar
Valentin Reis committed
80 81
    ];
    withHoogle = true;
82
    buildInputs = devInputs pkgs1 ++ package.buildInputs;
Valentin Reis's avatar
Valentin Reis committed
83
  };
Valentin Reis's avatar
Valentin Reis committed
84 85 86 87

  cabalDevLoader = self: path: set:
    (self.callCabal2nix (baseNameOf path) (filter path) set);
}