|
1 | 1 | # This shell.nix file is designed for use with cabal build
|
2 |
| -# It aims to leverage the nix cache in as much as possible |
3 |
| -# while reducing Nix maintenance costs. |
4 |
| -# It does **not** aim to replace Cabal/Stack with Nix |
| 2 | +# It does **not** aim to replace Cabal |
5 | 3 |
|
6 | 4 | # Maintaining this file:
|
7 | 5 | #
|
8 |
| -# - Dealing with broken nix-shell |
9 |
| -# |
10 |
| -# 1. Bump the nixpkgs version using `niv update nixpkgs` |
11 |
| -# 2. Comment out any remaining failing packages |
12 |
| -# |
13 |
| -# - Dealing with broken cabal build inside nix-shell: |
14 |
| -# |
15 |
| -# If my understanding of cabal new-build is correct this should never happen, |
16 |
| -# assuming that cabal new-build does succeed outside nix-shell |
| 6 | +# - Bump the nixpkgs version using `niv update nixpkgs` |
17 | 7 |
|
18 |
| -{ sources ? import nix/sources.nix, |
19 |
| - nixpkgs ? import sources.nixpkgs { }, |
20 |
| - compiler ? "default", |
21 |
| - hoogle ? false |
| 8 | +{ compiler ? "default", |
| 9 | + withHoogle ? false, |
| 10 | + nixpkgs ? import ./nix {} |
22 | 11 | }:
|
| 12 | + |
23 | 13 | with nixpkgs;
|
24 | 14 |
|
25 | 15 | let defaultCompiler = "ghc" + lib.replaceStrings ["."] [""] haskellPackages.ghc.version;
|
26 |
| - haskellPackagesForProject = p: |
27 |
| - if compiler == "default" || compiler == defaultCompiler |
28 |
| - then if hoogle |
29 |
| - then haskellPackages.ghcWithHoogle p |
30 |
| - else haskellPackages.ghcWithPackages p |
31 |
| - # for all other compilers there is no Nix cache so dont bother building deps |
32 |
| - else if hoogle |
33 |
| - then haskell.packages.${compiler}.ghcWithHoogle (_: []) |
34 |
| - else haskell.packages.${compiler}.ghcWithPackages (_: []); |
| 16 | + haskellPackagesForProject = |
| 17 | + if compiler == "default" |
| 18 | + then ourHaskell.packages.${defaultCompiler} |
| 19 | + else ourHaskell.packages.${compiler}; |
| 20 | + |
| 21 | + packages = p: [ p.haskell-language-server |
| 22 | + p.ghcide |
| 23 | + p.hie-compat |
| 24 | + p.hls-plugin-api |
| 25 | + p.hls-tactics-plugin |
| 26 | + p.hls-hlint-plugin |
| 27 | + ]; |
35 | 28 |
|
36 |
| - retrie = with haskell.lib; dontCheck(disableLibraryProfiling(haskellPackages.retrie)); |
37 |
| - compilerWithPackages = haskellPackagesForProject(p: |
38 |
| - with p; |
39 |
| - [ |
40 |
| - Diff |
41 |
| - Glob |
42 |
| - HsYAML-aeson |
43 |
| - QuickCheck |
44 |
| - aeson |
45 |
| - alex |
46 |
| - async |
47 |
| - base16-bytestring |
48 |
| - blaze-builder |
49 |
| - blaze-markup |
50 |
| - brittany |
51 |
| - conduit-extra |
52 |
| - conduit-parse |
53 |
| - cryptohash-sha1 |
54 |
| - data-default |
55 |
| - data-default-class |
56 |
| - data-default-instances-containers |
57 |
| - data-default-instances-dlist |
58 |
| - data-default-instances-old-locale |
59 |
| - extra |
60 |
| - floskell |
61 |
| - # fourmolu |
62 |
| - fuzzy |
63 |
| - generic-deriving |
64 |
| - ghc-check |
65 |
| - gitrev |
66 |
| - haddock-library |
67 |
| - happy |
68 |
| - haskell-lsp |
69 |
| - haskell-src-exts |
70 |
| - hie-bios |
71 |
| - hslogger |
72 |
| - hspec |
73 |
| - lens |
74 |
| - lsp-test |
75 |
| - megaparsec |
76 |
| - network |
77 |
| - opentelemetry |
78 |
| - optparse-simple |
79 |
| - ormolu |
80 |
| - parser-combinators |
81 |
| - parsers |
82 |
| - prettyprinter |
83 |
| - prettyprinter-ansi-terminal |
84 |
| - primes |
85 |
| - psqueues |
86 |
| - regex-tdfa |
87 |
| - retrie |
88 |
| - rope-utf16-splay |
89 |
| - safe-exceptions |
90 |
| - shake |
91 |
| - sorted-list |
92 |
| - strict |
93 |
| - stylish-haskell |
94 |
| - tasty |
95 |
| - tasty-ant-xml |
96 |
| - tasty-expected-failure |
97 |
| - tasty-golden |
98 |
| - tasty-hunit |
99 |
| - tasty-rerun |
100 |
| - temporary |
101 |
| - text |
102 |
| - typed-process |
103 |
| - unix-compat |
104 |
| - unordered-containers |
105 |
| - xml |
106 |
| - yaml |
107 |
| - zlib |
108 |
| - ]); |
| 29 | + isSupported = compiler == "default" || compiler == defaultCompiler; |
109 | 30 | in
|
110 |
| -stdenv.mkDerivation { |
111 |
| - name = "haskell-language-server"; |
| 31 | +haskellPackagesForProject.shellFor { |
| 32 | + inherit withHoogle; |
| 33 | + doBenchmark = true; |
| 34 | + packages = p: if isSupported then packages p else [p.ghc-paths]; |
112 | 35 | buildInputs = [
|
113 |
| - git |
114 | 36 | gmp
|
115 |
| - ncurses |
116 | 37 | zlib
|
| 38 | + ncurses |
117 | 39 |
|
118 | 40 | haskellPackages.cabal-install
|
119 | 41 | haskellPackages.hlint
|
120 |
| - |
121 |
| - compilerWithPackages |
122 |
| - |
| 42 | + haskellPackages.ormolu |
| 43 | + haskellPackages.stylish-haskell |
123 | 44 | ];
|
124 | 45 | src = null;
|
125 | 46 | shellHook = ''
|
|
0 commit comments