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

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

  devInputs = p: with p; [
    git
    htop
  ];

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

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