-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshell.nix
36 lines (28 loc) · 1.09 KB
/
shell.nix
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
{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc802", withProfiling ? false, withHoogle ? true }:
let
inherit (nixpkgs) pkgs;
lib = import "${nixpkgs.path}/pkgs/development/haskell-modules/lib.nix" { pkgs = nixpkgs; };
haskellPackagesWithCompiler =
if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
haskellPackagesWithProfiling =
if withProfiling
then haskellPackagesWithCompiler.override {
overrides = self: super: {
mkDerivation = args: super.mkDerivation (args // { enableLibraryProfiling = true; });
};
}
else haskellPackagesWithCompiler;
haskellPackagesWithHoogle =
if withHoogle
then haskellPackagesWithProfiling.override {
overrides = self: super: {
ghc = super.ghc // { withPackages = super.ghc.withHoogle; };
ghcWithPackages = self.ghc.withPackages;
};
}
else haskellPackagesWithProfiling;
drv = haskellPackagesWithHoogle.callPackage ./. {};
in
if pkgs.lib.inNixShell then drv.env else drv