Advertisement
Guest User

Untitled

a guest
Sep 13th, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. // This my haskell dev env (please note I don't use stack)
  2. with import <nixpkgs> {};
  3. {
  4. sdlEnv = stdenv.mkDerivation {
  5. name = "haskell";
  6. shellHook = ''
  7. export NIX_LABEL="haskell"
  8. '';
  9. buildInputs = [
  10. ghc cabal-install cabal2nix stack
  11. ];
  12. };
  13. }
  14.  
  15.  
  16. // Here is the result of cabal2nix
  17. { nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:
  18.  
  19. let
  20.  
  21. inherit (nixpkgs) pkgs;
  22.  
  23. f = { mkDerivation, base, containers, hedgehog, hspec
  24. , postgresql-simple, stdenv, text
  25. }:
  26. mkDerivation {
  27. pname = "simity";
  28. version = "0.0.0.0";
  29. src = ./.;
  30. isLibrary = true;
  31. isExecutable = true;
  32. libraryHaskellDepends = [ base containers postgresql-simple text ];
  33. executableHaskellDepends = [ base containers postgresql-simple ];
  34. testHaskellDepends = [ base containers hedgehog hspec text ];
  35. doHaddock = false;
  36. license = "LicenseRef-PublicDomain";
  37. };
  38.  
  39. haskellPackages = if compiler == "default"
  40. then pkgs.haskellPackages
  41. else pkgs.haskell.packages.${compiler};
  42.  
  43. variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
  44.  
  45. drv = variant (haskellPackages.callPackage f {});
  46.  
  47. in
  48.  
  49. if pkgs.lib.inNixShell then drv.env else drv
  50.  
  51.  
  52. // Then i do `nix-shell . --command fish` with the file above as `default.nix`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement