with (import <nixpkgs> {});

let
  # MUST match resolver in stack.yaml
  resolver = haskell.packages.lts-9_0.ghc;

  native_libs = [
    libffi
    zlib
    ncurses
    gmp
    pkgconfig
  ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
    Cocoa
    CoreServices
  ]);

in stdenv.mkDerivation {

  name = "idrisBuildEnv";

  buildInputs = [ resolver ] ++ native_libs;

  STACK_IN_NIX_EXTRA_ARGS = builtins.foldl'
    (acc: lib:
      " --extra-lib-dirs=${lib}/lib --extra-include-dirs=${lib}/include" + acc)
    "" native_libs;

  # Needed if one wants to use ghci, due to https://ghc.haskell.org/trac/ghc/ticket/11042
  LD_LIBRARY_PATH = builtins.concatStringsSep ":" (map (lib: lib.out + "/lib") native_libs);
}

with (import <nixpkgs> {});

let
  # MUST match GHC of resolver in stack.yaml
  ghc = haskell.packages.ghc802.ghc;

  native_libs = [
    libffi
    zlib
    ncurses
    gmp
    pkgconfig
  ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
    Cocoa
    CoreServices
  ]);

in stdenv.mkDerivation {

  name = "idrisBuildEnv";

  buildInputs = [ ghc ] ++ native_libs;

  STACK_IN_NIX_EXTRA_ARGS = builtins.foldl'
    (acc: lib:
      " --extra-lib-dirs=${lib}/lib --extra-include-dirs=${lib}/include" + acc)
    "" native_libs;

  # Needed if one wants to use ghci, due to https://ghc.haskell.org/trac/ghc/ticket/11042
  LD_LIBRARY_PATH = builtins.concatStringsSep ":" (map (lib: lib.out + "/lib") native_libs);
}

Update resolver to match current version of GHC
Update resolver to match current version of GHC

LTS package sets are no longer part of Nixpkgs.
