utils.nix 1.74 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
      , ghcid
15 16
      , typed-process
      , unix
Valentin Reis's avatar
Valentin Reis committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
      }:
      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
33
            panpipe
Valentin Reis's avatar
Valentin Reis committed
34
            ghcid
35 36
            typed-process
            unix
Valentin Reis's avatar
Valentin Reis committed
37 38 39 40 41 42
        ];
        description = "";
        license = stdenv.lib.licenses.mit;
      };

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

Valentin Reis's avatar
Valentin Reis committed
54 55 56 57
  devInputs = p: [
    p.git
    p.hwloc
    p.htop
Valentin Reis's avatar
Valentin Reis committed
58 59
  ];

Valentin Reis's avatar
Valentin Reis committed
60 61 62 63 64 65 66 67 68
  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
69
  getHackEnv = pkgs: super: package : super.shellFor {
Valentin Reis's avatar
Valentin Reis committed
70 71 72 73 74
    packages = p: [
      package
      (pkgs.haskellPackages.callPackage f {})
    ];
    withHoogle = true;
Valentin Reis's avatar
Valentin Reis committed
75
    buildInputs = devInputs pkgs ++ package.buildInputs;
Valentin Reis's avatar
Valentin Reis committed
76
  };
Valentin Reis's avatar
Valentin Reis committed
77 78 79 80

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