Advertisement
Guest User

Untitled

a guest
Jan 7th, 2019
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. ### default.nix ###
  2. { nixpkgs ? import <nixpkgs> { config.allowUnfree = true; }
  3. , compiler ? "default"
  4. , doBenchmark ? false
  5. }:
  6.  
  7. let
  8. inherit (nixpkgs) pkgs;
  9.  
  10. thepackage = import ./thepackage.nix;
  11.  
  12. haskellPackages = if compiler == "default"
  13. then pkgs.haskellPackages
  14. else pkgs.haskell.packages.${compiler};
  15.  
  16. variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
  17. in
  18. variant (haskellPackages.callPackage thepackage {})
  19.  
  20.  
  21.  
  22. ### shell.nix ###
  23. { nixpkgs ? import <nixpkgs> { config.allowUnfree = true; }
  24. , compiler ? "default"
  25. , doBenchmark ? false
  26. }:
  27.  
  28. let
  29. inherit (nixpkgs) pkgs;
  30. drv = import ./default.nix { inherit nixpkgs compiler; };
  31. drvWithTools = pkgs.haskell.lib.addBuildDepends drv (with pkgs; [
  32. cabal-install haskellPackages.ghcid
  33. ]);
  34. in
  35. if pkgs.lib.inNixShell then drvWithTools.env else drvWithTools
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement