Skip to content

Instantly share code, notes, and snippets.

@Kiwi

Kiwi/shell.nix Secret

Created July 29, 2020 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kiwi/aa483a99779c67b5eb8489ed4e9223d0 to your computer and use it in GitHub Desktop.
Save Kiwi/aa483a99779c67b5eb8489ed4e9223d0 to your computer and use it in GitHub Desktop.
Unique shell.nix
{ nixpkgs ? (import (fetchTarball "channel:nixos-unstable") { })
, compiler ? "ghc8101"
}:
let
config = {
packageOverrides = super:
let self = super.pkgs;
in
{
haskell = super.haskell // {
packages = super.haskell.packages // {
${compiler} = super.haskell.packages.${compiler}.override {
overrides = self: super:
with pkgs.haskell.lib;
{ };
};
};
};
};
};
pkgs = import <nixpkgs> { inherit config; };
ghc = pkgs.haskell.packages.${compiler}.ghcWithHoogle (ps:
with ps; [
containers
extra
hashable
unordered-containers
hspec
criterion
QuickCheck
quickcheck-instances
bytestring
hashable
]
);
in
pkgs.stdenv.mkDerivation {
name = "Unique";
buildInputs = with pkgs; [
cabal-install
ghc
which
zlib
];
shellHook = ''
eval $(egrep ^export ${ghc}/bin/ghc)
export HIE_HOOGLE_DATABASE="$(cat $(which hoogle) | sed -n -e 's|.*--database \(.*\.hoo\).*|\1|p')"
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment