ghcide/shell.nix
Pepe Iborra 90b859b202
Add a GitHub action for the Nix build (#918)
* Add an action to build and cache the nix-shell

* [nix] ghc-paths must always be in the package set

Otherwise ghc-check will not get the Nix libdir and fail at compile time

* [nix] extract the nixpkgs instantiation to nix/default.nix

* [nix] niv init

* [nix] switch to haskell-updates

* Mention the Cachix binary cache in the README

* [nix] pin the version used to set up Cachix

* [nix] disable tests and jailbreak 8.10.x packages

* [nix] rely on cabal2nix to enumerate the dependencies

* [nix] install haskell tools from the Nix cache
2020-11-23 09:38:15 +00:00

44 lines
1.2 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};
ghcide = p: haskell.lib.doCheck
(p.callCabal2nixWithOptions "ghcide" ./. "--benchmark" {});
isSupported = compiler == "default" || compiler == defaultCompiler;
in
haskellPackagesForProject.shellFor {
inherit withHoogle;
doBenchmark = true;
packages = p: [ (if isSupported then ghcide p else p.ghc-paths) ];
buildInputs = [
gmp
zlib
ncurses
haskellPackages.cabal-install
haskellPackages.hlint
haskellPackages.ormolu
haskellPackages.stylish-haskell
];
src = null;
shellHook = ''
export LD_LIBRARY_PATH=${gmp}/lib:${zlib}/lib:${ncurses}/lib
export PATH=$PATH:$HOME/.local/bin
'';
}