diff options
Diffstat (limited to 'shell.nix')
-rw-r--r-- | shell.nix | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..4290cbb --- /dev/null +++ b/shell.nix @@ -0,0 +1,44 @@ +{ nixpkgs ? import <nixpkgs> {} +, compiler ? "default" +, doBenchmark ? false +}: + +let + # cabal2nix . > regfish.nix + packageFile = ./regfish.nix; + + inherit (nixpkgs) lib pkgs; + + haskellPackages = if compiler == "default" + then pkgs.haskellPackages + else pkgs.haskell.packages.${compiler}; + + hoogle = + haskellPackages.callPackage <nixpkgs/pkgs/development/haskell-modules/hoogle.nix> { + packages = + (haskellPackages.callPackage packageFile { + mkDerivation = pkgs.lib.id; + }).executableHaskellDepends; + }; + + variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id; + + drv = variant (haskellPackages.callPackage packageFile { + }); + +in + + pkgs.lib.overrideDerivation drv.env (oldAttrs: { + buildInputs = [ + pkgs.cabal-install + ]; + shellHook = '' + cd ${lib.escapeShellArg (toString ./.)} + alias ghci='ghci -flocal-ghci-history -odir ~/tmp/regfish -hidir ~/tmp/regfish' + export HISTFILE=.bash_history HISTSIZE=100000 + + if test -e .profile; then + . ./.profile + fi + ''; + }) |