Skip to content

Instantly share code, notes, and snippets.

@fendor
Created July 29, 2020 09:06
Show Gist options
  • Save fendor/f724b5b7b916cf014da278a71805da86 to your computer and use it in GitHub Desktop.
Save fendor/f724b5b7b916cf014da278a71805da86 to your computer and use it in GitHub Desktop.
> nix-shell --arg compiler \"ghc8101\"
error: --- TypeError -------------------------------------------------------------------- nix-shell
in file: /nix/store/3kx03cm9kr9dxgk4w7i9pi6f67wff4iq-source/pkgs/development/haskell-modules/make-package-set.nix (246:49)
attempt to call something which is not a function but a list
(use '--show-trace' to show detailed location information)
> nix-shell --arg compiler ghc8101
error: --- UndefinedVarError ------------------------------------------------------------ nix-shell
in file: (string) (1:1)
undefined variable 'ghc8101'
> sources = import nix/sources.nix
> pkgs = import sources.nixpkgs {}
> pkgs.haskell.packages.
pkgs.haskell.packages.ghc8101 pkgs.haskell.packages.ghc865 pkgs.haskell.packages.ghc883 pkgs.haskell.packages.ghcjs86
pkgs.haskell.packages.ghc822Binary pkgs.haskell.packages.ghc865Binary pkgs.haskell.packages.ghcHEAD pkgs.haskell.packages.integer-simple
pkgs.haskell.packages.ghc844 pkgs.haskell.packages.ghc882 pkgs.haskell.packages.ghcjs
{ sources ? import nix/sources.nix,
nixpkgs ? import sources.nixpkgs {},
compiler ? "default"
}:
with nixpkgs;
let defaultCompiler = "ghc" + lib.replaceStrings ["."] [""] haskellPackages.ghc.version;
haskellPackagesForProject = p:
if compiler == "default" || compiler == defaultCompiler
then haskellPackages.ghcWithPackages p
# for all other compilers there is no Nix cache so dont bother building deps with NIx
else haskell.packages.${compiler}.ghcWithPackages [];
compilerWithPackages = haskellPackagesForProject(p:
with p;
[
]);
in
stdenv.mkDerivation {
name = "haskell-language-server";
buildInputs = [
gmp
zlib
ncurses
haskellPackages.cabal-install
haskellPackages.hlint
compilerWithPackages
];
src = null;
shellHook = ''
export LD_LIBRARY_PATH=${gmp}/lib:${zlib}/lib:${ncurses}/lib
export PATH=$PATH:$HOME/.local/bin
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment