utils.nix 1.81 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 6 7 8 9 10 11
      , cabal-install
      , apply-refact
      , hdevtools
      , hindent
      , fswatch
      , hlint
      , protolude
      , shake
      , ghcid
12 13
      , typed-process
      , unix
Valentin Reis's avatar
Valentin Reis committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27
      }:
      mkDerivation {
        pname = "dummy";
        version = "";
        src = "";
        libraryHaskellDepends = [
            cabal-install
            apply-refact
            hdevtools
            hindent
            fswatch
            hlint
            protolude
            shake
28
            #panpipe
Valentin Reis's avatar
Valentin Reis committed
29
            ghcid
30 31
            typed-process
            unix
Valentin Reis's avatar
Valentin Reis committed
32 33 34 35 36
        ];
        description = "";
        license = stdenv.lib.licenses.mit;
      };

37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
  f2 = { mkDerivation, stdenv
      , brittany
      , haskell-tools-refactor
      }:
      mkDerivation {
        pname = "dummy";
        version = "";
        src = "";
        libraryHaskellDepends = [
            brittany
            haskell-tools-refactor
        ];
        description = "";
        license = stdenv.lib.licenses.mit;
      };
Valentin Reis's avatar
Valentin Reis committed
52
in
Valentin Reis's avatar
Valentin Reis committed
53 54 55 56 57 58 59
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
60 61
    (baseNameOf path != "README") &&
    (baseNameOf path != ".README") &&
Valentin Reis's avatar
Valentin Reis committed
62 63
    (baseNameOf path != "dist")) path;

Valentin Reis's avatar
Valentin Reis committed
64 65 66 67
  devInputs = p: [
    p.git
    p.hwloc
    p.htop
Valentin Reis's avatar
Valentin Reis committed
68 69
  ];

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

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