|
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 |
| 6 | +# - Bump the nixpkgs version using `niv update nixpkgs` |
| 7 | +# - To edit the set of local packages: |
| 8 | +# 1. Declare them in nix/default.nix |
| 9 | +# 2. Edit the list of packages below |
9 | 10 | # |
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 |
| 11 | +# For more details: https://github.com/NixOS/nixpkgs/blob/20.03/pkgs/development/haskell-modules/make-package-set.nix#L256 |
| 12 | + |
17 | 13 |
|
18 | | -{ sources ? import nix/sources.nix, |
19 | | - nixpkgs ? import sources.nixpkgs { }, |
20 | | - compiler ? "default", |
21 | | - hoogle ? false |
| 14 | +{ compiler ? "default", |
| 15 | + withHoogle ? false, |
| 16 | + nixpkgs ? import ./nix {} |
22 | 17 | }: |
| 18 | + |
23 | 19 | with nixpkgs; |
24 | 20 |
|
25 | 21 | 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 (_: []); |
| 22 | + haskellPackagesForProject = |
| 23 | + if compiler == "default" |
| 24 | + then ourHaskell.packages.${defaultCompiler} |
| 25 | + else ourHaskell.packages.${compiler}; |
| 26 | + |
| 27 | + packages = p: [ p.haskell-language-server |
| 28 | + p.ghcide |
| 29 | + p.hie-compat |
| 30 | + p.hls-plugin-api |
| 31 | + p.hls-tactics-plugin |
| 32 | + p.hls-hlint-plugin |
| 33 | + ]; |
35 | 34 |
|
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 | | - ]); |
| 35 | + isSupported = compiler == "default" || compiler == defaultCompiler; |
109 | 36 | in |
110 | | -stdenv.mkDerivation { |
111 | | - name = "haskell-language-server"; |
| 37 | +haskellPackagesForProject.shellFor { |
| 38 | + inherit withHoogle; |
| 39 | + doBenchmark = true; |
| 40 | + packages = p: if isSupported then packages p else [p.ghc-paths]; |
112 | 41 | buildInputs = [ |
113 | | - git |
114 | 42 | gmp |
115 | | - ncurses |
116 | 43 | zlib |
| 44 | + ncurses |
117 | 45 |
|
118 | 46 | haskellPackages.cabal-install |
119 | 47 | haskellPackages.hlint |
120 | | - |
121 | | - compilerWithPackages |
122 | | - |
| 48 | + haskellPackages.ormolu |
| 49 | + haskellPackages.stylish-haskell |
123 | 50 | ]; |
124 | 51 | src = null; |
125 | 52 | shellHook = '' |
|
0 commit comments