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

in
Valentin Reis's avatar
Valentin Reis committed
39
40
41
42
43
44
45
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
46
47
    (baseNameOf path != "README") &&
    (baseNameOf path != ".README") &&
Valentin Reis's avatar
Valentin Reis committed
48
49
    (baseNameOf path != "dist")) path;

Valentin Reis's avatar
Valentin Reis committed
50
51
52
53
  devInputs = p: [
    p.git
    p.hwloc
    p.htop
Valentin Reis's avatar
Valentin Reis committed
54
55
  ];

Valentin Reis's avatar
Valentin Reis committed
56
57
58
59
60
61
62
63
64
  getPostEnv = pkgs: super: package : super.shellFor {
    packages = p: [
      package
      (pkgs.haskellPackages.callPackage f {})
    ];
    withHoogle = true;
    buildInputs = devInputs pkgs ++ [package];
  };

Valentin Reis's avatar
Valentin Reis committed
65
  getHackEnv = pkgs: super: package : super.shellFor {
Valentin Reis's avatar
Valentin Reis committed
66
67
68
69
70
    packages = p: [
      package
      (pkgs.haskellPackages.callPackage f {})
    ];
    withHoogle = true;
Valentin Reis's avatar
Valentin Reis committed
71
    buildInputs = devInputs pkgs ++ package.buildInputs;
Valentin Reis's avatar
Valentin Reis committed
72
  };
Valentin Reis's avatar
Valentin Reis committed
73
74
75
76

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