diff options
author | tv <tv@krebsco.de> | 2021-08-03 15:44:49 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2021-08-03 15:45:03 +0200 |
commit | 71a3f4e8efa833cc1a8209ab336ac8c454cc2f9b (patch) | |
tree | 799b6b6a7ddbba84673b42342b1428cba9369c39 /shell.nix | |
parent | 288051f52e65857a7946e65c5a454b8b35af981b (diff) |
env.nix -> shell.nix
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 + ''; + }) |