ghcide/shell.nix
Pepe Iborra 959db7b10b
Extract the benchmarking Shake rules to a standalone Cabal package (#941)
* [bench-hist] break down in rule functions

* Extract the benchmarking Shake rules to a shake-bench package

There's some room for reusing the rules used in the historic benchmarking suite
in other projects. This change makes that a bit easier and improves the
documentation and code structure.

The new structure is:
- lib:shake-bench - a Cabal library with functions to generate Shake rules
- ghcide:bench:benchHist - the ghcide instantiation of the above Shake rules

That's not to say that shake-bench is completely decoupled from ghcide -
there are still plenty of assumptions on how the benchmarks are organized, their
outputs, etc. But with a little bit of effort, it should be easy to make
these rules more reusable

* Fix nix build

* Fix license

* hlints and redundant imports

* more hlints

* Exclude shake-bench from the stack build
2020-12-07 15:03:15 +00:00

49 lines
1.3 KiB
Nix

# This shell.nix file is designed for use with cabal build
# It does **not** aim to replace Cabal
# Maintaining this file:
#
# - Bump the nixpkgs version using `niv update nixpkgs`
{ compiler ? "default",
withHoogle ? false,
nixpkgs ? import ./nix {}
}:
with nixpkgs;
let defaultCompiler = "ghc" + lib.replaceStrings ["."] [""] haskellPackages.ghc.version;
haskellPackagesForProject =
if compiler == "default"
then ourHaskell.packages.${defaultCompiler}
else ourHaskell.packages.${compiler};
isSupported = compiler == "default" || compiler == defaultCompiler;
in
haskellPackagesForProject.shellFor {
inherit withHoogle;
doBenchmark = true;
packages = p:
if isSupported
then [p.ghcide p.hie-compat p.shake-bench]
else [p.ghc-paths];
buildInputs = [
gmp
zlib
ncurses
capstone
tracy
haskellPackages.cabal-install
haskellPackages.hlint
haskellPackages.ormolu
haskellPackages.stylish-haskell
haskellPackages.opentelemetry-extra
];
src = null;
shellHook = ''
export LD_LIBRARY_PATH=${gmp}/lib:${zlib}/lib:${ncurses}/lib:${capstone}/lib
export DYLD_LIBRARY_PATH=${gmp}/lib:${zlib}/lib:${ncurses}/lib:${capstone}/lib
export PATH=$PATH:$HOME/.local/bin
'';
}