Merge pull request #23627 from alexeymuranov/haskell-doc-markdown

doc: enable code syntax highlighting

authored by Frederik Rietdijk and committed by GitHub 84b1643a d4dbef90

+424 -381
+424 -381
doc/languages-frameworks/haskell.md
··· 11 11 Nixpkgs distributes build instructions for all Haskell packages registered on 12 12 [Hackage](http://hackage.haskell.org/), but strangely enough normal Nix package 13 13 lookups don't seem to discover any of them, except for the default version of ghc, cabal-install, and stack: 14 - 15 - $ nix-env -i alex 16 - error: selector ‘alex’ matches no derivations 17 - $ nix-env -qa ghc 18 - ghc-7.10.2 14 + ``` 15 + $ nix-env -i alex 16 + error: selector ‘alex’ matches no derivations 17 + $ nix-env -qa ghc 18 + ghc-7.10.2 19 + ``` 19 20 20 21 The Haskell package set is not registered in the top-level namespace because it 21 22 is *huge*. If all Haskell packages were visible to these commands, then 22 23 name-based search/install operations would be much slower than they are now. We 23 24 avoided that by keeping all Haskell-related packages in a separate attribute 24 25 set called `haskellPackages`, which the following command will list: 25 - 26 - $ nix-env -f "<nixpkgs>" -qaP -A haskellPackages 27 - haskellPackages.a50 a50-0.5 28 - haskellPackages.abacate haskell-abacate-0.0.0.0 29 - haskellPackages.abcBridge haskell-abcBridge-0.12 30 - haskellPackages.afv afv-0.1.1 31 - haskellPackages.alex alex-3.1.4 32 - haskellPackages.Allure Allure-0.4.101.1 33 - haskellPackages.alms alms-0.6.7 34 - [... some 8000 entries omitted ...] 26 + ``` 27 + $ nix-env -f "<nixpkgs>" -qaP -A haskellPackages 28 + haskellPackages.a50 a50-0.5 29 + haskellPackages.abacate haskell-abacate-0.0.0.0 30 + haskellPackages.abcBridge haskell-abcBridge-0.12 31 + haskellPackages.afv afv-0.1.1 32 + haskellPackages.alex alex-3.1.4 33 + haskellPackages.Allure Allure-0.4.101.1 34 + haskellPackages.alms alms-0.6.7 35 + [... some 8000 entries omitted ...] 36 + ``` 35 37 36 38 To install any of those packages into your profile, refer to them by their 37 39 attribute path (first column): 38 - 39 - $ nix-env -f "<nixpkgs>" -iA haskellPackages.Allure ... 40 + ```shell 41 + nix-env -f "<nixpkgs>" -iA haskellPackages.Allure ... 42 + ``` 40 43 41 44 The attribute path of any Haskell packages corresponds to the name of that 42 45 particular package on Hackage: the package `cabal-install` has the attribute ··· 58 61 reach Nixpkgs varies from system to system. We dodged that problem by giving 59 62 `nix-env` an explicit `-f "<nixpkgs>"` parameter, but if you call `nix-env` 60 63 without that flag, then chances are the invocation fails: 61 - 62 - $ nix-env -iA haskellPackages.cabal-install 63 - error: attribute ‘haskellPackages’ in selection path 64 - ‘haskellPackages.cabal-install’ not found 64 + ``` 65 + $ nix-env -iA haskellPackages.cabal-install 66 + error: attribute ‘haskellPackages’ in selection path 67 + ‘haskellPackages.cabal-install’ not found 68 + ``` 65 69 66 70 On NixOS, for example, Nixpkgs does *not* exist in the top-level namespace by 67 71 default. To figure out the proper attribute path, it's easiest to query for the 68 72 path of a well-known Nixpkgs package, i.e.: 69 - 70 - $ nix-env -qaP coreutils 71 - nixos.coreutils coreutils-8.23 73 + ``` 74 + $ nix-env -qaP coreutils 75 + nixos.coreutils coreutils-8.23 76 + ``` 72 77 73 78 If your system responds like that (most NixOS installations will), then the 74 79 attribute path to `haskellPackages` is `nixos.haskellPackages`. Thus, if you 75 80 want to use `nix-env` without giving an explicit `-f` flag, then that's the way 76 81 to do it: 77 - 78 - $ nix-env -qaP -A nixos.haskellPackages 79 - $ nix-env -iA nixos.haskellPackages.cabal-install 82 + ```shell 83 + nix-env -qaP -A nixos.haskellPackages 84 + nix-env -iA nixos.haskellPackages.cabal-install 85 + ``` 80 86 81 87 Our current default compiler is GHC 7.10.x and the `haskellPackages` set 82 88 contains packages built with that particular version. Nixpkgs contains the 83 89 latest major release of every GHC since 6.10.4, however, and there is a whole 84 90 family of package sets available that defines Hackage packages built with each 85 91 of those compilers, too: 86 - 87 - $ nix-env -f "<nixpkgs>" -qaP -A haskell.packages.ghc6123 88 - $ nix-env -f "<nixpkgs>" -qaP -A haskell.packages.ghc763 92 + ```shell 93 + nix-env -f "<nixpkgs>" -qaP -A haskell.packages.ghc6123 94 + nix-env -f "<nixpkgs>" -qaP -A haskell.packages.ghc763 95 + ``` 89 96 90 97 The name `haskellPackages` is really just a synonym for 91 98 `haskell.packages.ghc7102`, because we prefer that package set internally and 92 99 recommend it to our users as their default choice, but ultimately you are free 93 100 to compile your Haskell packages with any GHC version you please. The following 94 101 command displays the complete list of available compilers: 95 - 96 - $ nix-env -f "<nixpkgs>" -qaP -A haskell.compiler 97 - haskell.compiler.ghc6104 ghc-6.10.4 98 - haskell.compiler.ghc6123 ghc-6.12.3 99 - haskell.compiler.ghc704 ghc-7.0.4 100 - haskell.compiler.ghc722 ghc-7.2.2 101 - haskell.compiler.ghc742 ghc-7.4.2 102 - haskell.compiler.ghc763 ghc-7.6.3 103 - haskell.compiler.ghc784 ghc-7.8.4 104 - haskell.compiler.ghc7102 ghc-7.10.2 105 - haskell.compiler.ghcHEAD ghc-7.11.20150402 106 - haskell.compiler.ghcNokinds ghc-nokinds-7.11.20150704 107 - haskell.compiler.ghcjs ghcjs-0.1.0 108 - haskell.compiler.jhc jhc-0.8.2 109 - haskell.compiler.uhc uhc-1.1.9.0 102 + ``` 103 + $ nix-env -f "<nixpkgs>" -qaP -A haskell.compiler 104 + haskell.compiler.ghc6104 ghc-6.10.4 105 + haskell.compiler.ghc6123 ghc-6.12.3 106 + haskell.compiler.ghc704 ghc-7.0.4 107 + haskell.compiler.ghc722 ghc-7.2.2 108 + haskell.compiler.ghc742 ghc-7.4.2 109 + haskell.compiler.ghc763 ghc-7.6.3 110 + haskell.compiler.ghc784 ghc-7.8.4 111 + haskell.compiler.ghc7102 ghc-7.10.2 112 + haskell.compiler.ghcHEAD ghc-7.11.20150402 113 + haskell.compiler.ghcNokinds ghc-nokinds-7.11.20150704 114 + haskell.compiler.ghcjs ghcjs-0.1.0 115 + haskell.compiler.jhc jhc-0.8.2 116 + haskell.compiler.uhc uhc-1.1.9.0 117 + ``` 110 118 111 119 We have no package sets for `jhc` or `uhc` yet, unfortunately, but for every 112 120 version of GHC listed above, there exists a package set based on that compiler. ··· 121 129 of the tools `cabal-install` and `stack`. We saw in section 122 130 [How to install Haskell packages] how you can install those programs into your 123 131 user profile: 124 - 125 - $ nix-env -f "<nixpkgs>" -iA haskellPackages.ghc haskellPackages.cabal-install 132 + ```shell 133 + nix-env -f "<nixpkgs>" -iA haskellPackages.ghc haskellPackages.cabal-install 134 + ``` 126 135 127 136 Instead of the default package set `haskellPackages`, you can also use the more 128 137 precise name `haskell.compiler.ghc7102`, which has the advantage that it refers ··· 131 140 132 141 Once you've made those tools available in `$PATH`, it's possible to build 133 142 Hackage packages the same way people without access to Nix do it all the time: 134 - 135 - $ cabal get lens-4.11 && cd lens-4.11 136 - $ cabal install -j --dependencies-only 137 - $ cabal configure 138 - $ cabal build 143 + ```shell 144 + cabal get lens-4.11 && cd lens-4.11 145 + cabal install -j --dependencies-only 146 + cabal configure 147 + cabal build 148 + ``` 139 149 140 150 If you enjoy working with Cabal sandboxes, then that's entirely possible too: 141 151 just execute the command 142 - 143 - $ cabal sandbox init 144 - 152 + ```shell 153 + cabal sandbox init 154 + ``` 145 155 before installing the required dependencies. 146 156 147 157 The `nix-shell` utility makes it easy to switch to a different compiler 148 158 version; just enter the Nix shell environment with the command 149 - 150 - $ nix-shell -p haskell.compiler.ghc784 151 - 159 + ```shell 160 + nix-shell -p haskell.compiler.ghc784 161 + ``` 152 162 to bring GHC 7.8.4 into `$PATH`. Alternatively, you can use Stack instead of 153 163 `nix-shell` directly to select compiler versions and other build tools 154 164 per-project. It uses `nix-shell` under the hood when Nix support is turned on. ··· 159 169 a project that doesn't depend on any additional system libraries outside of GHC, 160 170 then it's even sufficient to just run the `cabal configure` command inside of 161 171 the shell: 162 - 163 - $ nix-shell -p haskell.compiler.ghc784 --command "cabal configure" 172 + ```shell 173 + nix-shell -p haskell.compiler.ghc784 --command "cabal configure" 174 + ``` 164 175 165 176 Afterwards, all other commands like `cabal build` work just fine in any shell 166 177 environment, because the configure phase recorded the absolute paths to all ··· 187 198 GHC. For example, the Nix expression `ghcWithPackages (pkgs: [pkgs.mtl])` 188 199 generates a copy of GHC that has the `mtl` library registered in addition to 189 200 its normal core packages: 201 + ``` 202 + $ nix-shell -p "haskellPackages.ghcWithPackages (pkgs: [pkgs.mtl])" 190 203 191 - $ nix-shell -p "haskellPackages.ghcWithPackages (pkgs: [pkgs.mtl])" 192 - 193 - [nix-shell:~]$ ghc-pkg list mtl 194 - /nix/store/zy79...-ghc-7.10.2/lib/ghc-7.10.2/package.conf.d: 195 - mtl-2.2.1 204 + [nix-shell:~]$ ghc-pkg list mtl 205 + /nix/store/zy79...-ghc-7.10.2/lib/ghc-7.10.2/package.conf.d: 206 + mtl-2.2.1 207 + ``` 196 208 197 209 This function allows users to define their own development environment by means 198 210 of an override. After adding the following snippet to `~/.config/nixpkgs/config.nix`, 199 - 200 - { 201 - packageOverrides = super: let self = super.pkgs; in 202 - { 203 - myHaskellEnv = self.haskell.packages.ghc7102.ghcWithPackages 204 - (haskellPackages: with haskellPackages; [ 205 - # libraries 206 - arrows async cgi criterion 207 - # tools 208 - cabal-install haskintex 209 - ]); 210 - }; 211 - } 212 - 211 + ```nix 212 + { 213 + packageOverrides = super: let self = super.pkgs; in 214 + { 215 + myHaskellEnv = self.haskell.packages.ghc7102.ghcWithPackages 216 + (haskellPackages: with haskellPackages; [ 217 + # libraries 218 + arrows async cgi criterion 219 + # tools 220 + cabal-install haskintex 221 + ]); 222 + }; 223 + } 224 + ``` 213 225 it's possible to install that compiler with `nix-env -f "<nixpkgs>" -iA 214 226 myHaskellEnv`. If you'd like to switch that development environment to a 215 227 different version of GHC, just replace the `ghc7102` bit in the previous ··· 221 233 The generated `ghc` program is a wrapper script that re-directs the real 222 234 GHC executable to use a new `lib` directory --- one that we specifically 223 235 constructed to contain all those packages the user requested: 224 - 225 - $ cat $(type -p ghc) 226 - #! /nix/store/xlxj...-bash-4.3-p33/bin/bash -e 227 - export NIX_GHC=/nix/store/19sm...-ghc-7.10.2/bin/ghc 228 - export NIX_GHCPKG=/nix/store/19sm...-ghc-7.10.2/bin/ghc-pkg 229 - export NIX_GHC_DOCDIR=/nix/store/19sm...-ghc-7.10.2/share/doc/ghc/html 230 - export NIX_GHC_LIBDIR=/nix/store/19sm...-ghc-7.10.2/lib/ghc-7.10.2 231 - exec /nix/store/j50p...-ghc-7.10.2/bin/ghc "-B$NIX_GHC_LIBDIR" "$@" 236 + ``` 237 + $ cat $(type -p ghc) 238 + #! /nix/store/xlxj...-bash-4.3-p33/bin/bash -e 239 + export NIX_GHC=/nix/store/19sm...-ghc-7.10.2/bin/ghc 240 + export NIX_GHCPKG=/nix/store/19sm...-ghc-7.10.2/bin/ghc-pkg 241 + export NIX_GHC_DOCDIR=/nix/store/19sm...-ghc-7.10.2/share/doc/ghc/html 242 + export NIX_GHC_LIBDIR=/nix/store/19sm...-ghc-7.10.2/lib/ghc-7.10.2 243 + exec /nix/store/j50p...-ghc-7.10.2/bin/ghc "-B$NIX_GHC_LIBDIR" "$@" 244 + ``` 232 245 233 246 The variables `$NIX_GHC`, `$NIX_GHCPKG`, etc. point to the *new* store path 234 247 `ghcWithPackages` constructed specifically for this environment. The last line ··· 248 261 To make sure that mechanism works properly all the time, we recommend that you 249 262 set those variables to meaningful values in your shell environment, too, i.e. 250 263 by adding the following code to your `~/.bashrc`: 251 - 252 - if type >/dev/null 2>&1 -p ghc; then 253 - eval "$(egrep ^export "$(type -p ghc)")" 254 - fi 264 + ```bash 265 + if type >/dev/null 2>&1 -p ghc; then 266 + eval "$(egrep ^export "$(type -p ghc)")" 267 + fi 268 + ``` 255 269 256 270 If you are certain that you'll use only one GHC environment which is located in 257 271 your user profile, then you can use the following code, too, which has the 258 272 advantage that it doesn't contain any paths from the Nix store, i.e. those 259 273 settings always remain valid even if a `nix-env -u` operation updates the GHC 260 274 environment in your profile: 261 - 262 - if [ -e ~/.nix-profile/bin/ghc ]; then 263 - export NIX_GHC="$HOME/.nix-profile/bin/ghc" 264 - export NIX_GHCPKG="$HOME/.nix-profile/bin/ghc-pkg" 265 - export NIX_GHC_DOCDIR="$HOME/.nix-profile/share/doc/ghc/html" 266 - export NIX_GHC_LIBDIR="$HOME/.nix-profile/lib/ghc-$($NIX_GHC --numeric-version)" 267 - fi 275 + ```bash 276 + if [ -e ~/.nix-profile/bin/ghc ]; then 277 + export NIX_GHC="$HOME/.nix-profile/bin/ghc" 278 + export NIX_GHCPKG="$HOME/.nix-profile/bin/ghc-pkg" 279 + export NIX_GHC_DOCDIR="$HOME/.nix-profile/share/doc/ghc/html" 280 + export NIX_GHC_LIBDIR="$HOME/.nix-profile/lib/ghc-$($NIX_GHC --numeric-version)" 281 + fi 282 + ``` 268 283 269 284 ### How to install a compiler with libraries, hoogle and documentation indexes 270 285 ··· 280 295 long and scary. 281 296 282 297 For example, installing the following environment 283 - 284 - { 285 - packageOverrides = super: let self = super.pkgs; in 286 - { 287 - myHaskellEnv = self.haskellPackages.ghcWithHoogle 288 - (haskellPackages: with haskellPackages; [ 289 - # libraries 290 - arrows async cgi criterion 291 - # tools 292 - cabal-install haskintex 293 - ]); 294 - }; 295 - } 296 - 298 + ```nix 299 + { 300 + packageOverrides = super: let self = super.pkgs; in 301 + { 302 + myHaskellEnv = self.haskellPackages.ghcWithHoogle 303 + (haskellPackages: with haskellPackages; [ 304 + # libraries 305 + arrows async cgi criterion 306 + # tools 307 + cabal-install haskintex 308 + ]); 309 + }; 310 + } 311 + ``` 297 312 allows one to browse module documentation index [not too dissimilar to 298 313 this](https://downloads.haskell.org/~ghc/latest/docs/html/libraries/index.html) 299 314 for all the specified packages and their dependencies by directing a browser of ··· 303 318 304 319 After you've marveled enough at that try adding the following to your 305 320 `~/.ghc/ghci.conf` 306 - 307 - :def hoogle \s -> return $ ":! hoogle search -cl --count=15 \"" ++ s ++ "\"" 308 - :def doc \s -> return $ ":! hoogle search -cl --info \"" ++ s ++ "\"" 309 - 321 + ``` 322 + :def hoogle \s -> return $ ":! hoogle search -cl --count=15 \"" ++ s ++ "\"" 323 + :def doc \s -> return $ ":! hoogle search -cl --info \"" ++ s ++ "\"" 324 + ``` 310 325 and test it by typing into `ghci`: 311 - 312 - :hoogle a -> a 313 - :doc a -> a 326 + ``` 327 + :hoogle a -> a 328 + :doc a -> a 329 + ``` 314 330 315 331 Be sure to note the links to `haddock` files in the output. With any modern and 316 332 properly configured terminal emulator you can just click those links to 317 333 navigate there. 318 334 319 335 Finally, you can run 320 - 321 - hoogle server -p 8080 322 - 336 + ```shell 337 + hoogle server -p 8080 338 + ``` 323 339 and navigate to http://localhost:8080/ for your own local 324 340 [Hoogle](https://www.haskell.org/hoogle/). Note, however, that Firefox and 325 341 possibly other browsers disallow navigation from `http:` to `file:` URIs for ··· 334 350 automatically select the right version of GHC and other build tools to build, 335 351 test and execute apps in an existing project downloaded from somewhere on the 336 352 Internet. Pass the `--nix` flag to any `stack` command to do so, e.g. 337 - 338 - $ git clone --recursive http://github.com/yesodweb/wai 339 - $ cd wai 340 - $ stack --nix build 353 + ```shell 354 + git clone --recursive http://github.com/yesodweb/wai 355 + cd wai 356 + stack --nix build 357 + ``` 341 358 342 359 If you want `stack` to use Nix by default, you can add a `nix` section to the 343 360 `stack.yaml` file, as explained in the [Stack documentation][stack-nix-doc]. For 344 361 example: 345 - 346 - nix: 347 - enable: true 348 - packages: [pkgconfig zeromq zlib] 362 + ```yaml 363 + nix: 364 + enable: true 365 + packages: [pkgconfig zeromq zlib] 366 + ``` 349 367 350 368 The example configuration snippet above tells Stack to create an ad hoc 351 369 environment for `nix-shell` as in the below section, in which the `pkgconfig`, ··· 356 374 environments might need to expose Nixpkgs packages compiled in a certain way, or 357 375 with extra environment variables. In these cases, you'll need a `shell` field 358 376 instead of `packages`: 359 - 360 - nix: 361 - enable: true 362 - shell-file: shell.nix 377 + ```yaml 378 + nix: 379 + enable: true 380 + shell-file: shell.nix 381 + ``` 363 382 364 383 For more on how to write a `shell.nix` file see the below section. You'll need 365 384 to express a derivation. Note that Nixpkgs ships with a convenience wrapper ··· 368 387 as `mkDerivation` can be provided. For example, to build a Stack project that 369 388 including packages that link against a version of the R library compiled with 370 389 special options turned on: 390 + ```nix 391 + with (import <nixpkgs> { }); 371 392 372 - with (import <nixpkgs> { }); 373 - 374 - let R = pkgs.R.override { enableStrictBarrier = true; }; 375 - in 376 - haskell.lib.buildStackProject { 377 - name = "HaskellR"; 378 - buildInputs = [ R zeromq zlib ]; 379 - } 393 + let R = pkgs.R.override { enableStrictBarrier = true; }; 394 + in 395 + haskell.lib.buildStackProject { 396 + name = "HaskellR"; 397 + buildInputs = [ R zeromq zlib ]; 398 + } 399 + ``` 380 400 381 401 You can select a particular GHC version to compile with by setting the 382 402 `ghc` attribute as an argument to `buildStackProject`. Better yet, let 383 403 Stack choose what GHC version it wants based on the snapshot specified 384 404 in `stack.yaml` (only works with Stack >= 1.1.3): 405 + ```nix 406 + {nixpkgs ? import <nixpkgs> { }, ghc ? nixpkgs.ghc}: 385 407 386 - {nixpkgs ? import <nixpkgs> { }, ghc ? nixpkgs.ghc}: 408 + with nixpkgs; 387 409 388 - with nixpkgs; 389 - 390 - let R = pkgs.R.override { enableStrictBarrier = true; }; 391 - in 392 - haskell.lib.buildStackProject { 393 - name = "HaskellR"; 394 - buildInputs = [ R zeromq zlib ]; 395 - inherit ghc; 396 - } 410 + let R = pkgs.R.override { enableStrictBarrier = true; }; 411 + in 412 + haskell.lib.buildStackProject { 413 + name = "HaskellR"; 414 + buildInputs = [ R zeromq zlib ]; 415 + inherit ghc; 416 + } 417 + ``` 397 418 398 419 [stack-nix-doc]: http://docs.haskellstack.org/en/stable/nix_integration.html 399 420 ··· 401 422 402 423 The easiest way to create an ad hoc development environment is to run 403 424 `nix-shell` with the appropriate GHC environment given on the command-line: 404 - 405 - nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [mtl pandoc])" 425 + ```shell 426 + nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [mtl pandoc])" 427 + ``` 406 428 407 429 For more sophisticated use-cases, however, it's more convenient to save the 408 430 desired configuration in a file called `shell.nix` that looks like this: 409 - 410 - { nixpkgs ? import <nixpkgs> {}, compiler ? "ghc7102" }: 411 - let 412 - inherit (nixpkgs) pkgs; 413 - ghc = pkgs.haskell.packages.${compiler}.ghcWithPackages (ps: with ps; [ 414 - monad-par mtl 415 - ]); 416 - in 417 - pkgs.stdenv.mkDerivation { 418 - name = "my-haskell-env-0"; 419 - buildInputs = [ ghc ]; 420 - shellHook = "eval $(egrep ^export ${ghc}/bin/ghc)"; 421 - } 431 + ```nix 432 + { nixpkgs ? import <nixpkgs> {}, compiler ? "ghc7102" }: 433 + let 434 + inherit (nixpkgs) pkgs; 435 + ghc = pkgs.haskell.packages.${compiler}.ghcWithPackages (ps: with ps; [ 436 + monad-par mtl 437 + ]); 438 + in 439 + pkgs.stdenv.mkDerivation { 440 + name = "my-haskell-env-0"; 441 + buildInputs = [ ghc ]; 442 + shellHook = "eval $(egrep ^export ${ghc}/bin/ghc)"; 443 + } 444 + ``` 422 445 423 446 Now run `nix-shell` --- or even `nix-shell --pure` --- to enter a shell 424 447 environment that has the appropriate compiler in `$PATH`. If you use `--pure`, ··· 434 457 environment suitable for compiling that particular package. If you'd like to 435 458 hack the `lens` library, for example, then you just have to check out the 436 459 source code and enter the appropriate environment: 460 + ``` 461 + $ cabal get lens-4.11 && cd lens-4.11 462 + Downloading lens-4.11... 463 + Unpacking to lens-4.11/ 437 464 438 - $ cabal get lens-4.11 && cd lens-4.11 439 - Downloading lens-4.11... 440 - Unpacking to lens-4.11/ 441 - 442 - $ nix-shell "<nixpkgs>" -A haskellPackages.lens.env 443 - [nix-shell:/tmp/lens-4.11]$ 465 + $ nix-shell "<nixpkgs>" -A haskellPackages.lens.env 466 + [nix-shell:/tmp/lens-4.11]$ 467 + ``` 444 468 445 469 At point, you can run `cabal configure`, `cabal build`, and all the other 446 470 development commands. Note that you need `cabal-install` installed in your ··· 459 483 For example, let's assume that you're working on a private project called 460 484 `foo`. To generate a Nix build expression for it, change into the project's 461 485 top-level directory and run the command: 462 - 463 - $ cabal2nix . >foo.nix 464 - 486 + ```shell 487 + cabal2nix . > foo.nix 488 + ``` 465 489 Then write the following snippet into a file called `default.nix`: 466 - 467 - { nixpkgs ? import <nixpkgs> {}, compiler ? "ghc7102" }: 468 - nixpkgs.pkgs.haskell.packages.${compiler}.callPackage ./foo.nix { } 490 + ```nix 491 + { nixpkgs ? import <nixpkgs> {}, compiler ? "ghc7102" }: 492 + nixpkgs.pkgs.haskell.packages.${compiler}.callPackage ./foo.nix { } 493 + ``` 469 494 470 495 Finally, store the following code in a file called `shell.nix`: 471 - 472 - { nixpkgs ? import <nixpkgs> {}, compiler ? "ghc7102" }: 473 - (import ./default.nix { inherit nixpkgs compiler; }).env 496 + ```nix 497 + { nixpkgs ? import <nixpkgs> {}, compiler ? "ghc7102" }: 498 + (import ./default.nix { inherit nixpkgs compiler; }).env 499 + ``` 474 500 475 501 At this point, you can run `nix-build` to have Nix compile your project and 476 502 install it into a Nix store path. The local directory will contain a symlink ··· 486 512 487 513 If your package does not depend on any system-level libraries, then it's 488 514 sufficient to run 489 - 490 - $ nix-shell --command "cabal configure" 491 - 515 + ```shell 516 + nix-shell --command "cabal configure" 517 + ``` 492 518 once to set up your build. `cabal-install` determines the absolute paths to all 493 519 resources required for the build and writes them into a config file in the 494 520 `dist/` directory. Once that's done, you can run `cabal build` and any other ··· 502 528 up a `default.nix` and `shell.nix` file manually, then you can use the 503 529 `--shell` flag offered by `cabal2nix` to have it generate a stand-alone 504 530 `nix-shell` environment for you. With that feature, running 505 - 506 - $ cabal2nix --shell . >shell.nix 507 - $ nix-shell --command "cabal configure" 508 - 531 + ```shell 532 + cabal2nix --shell . > shell.nix 533 + nix-shell --command "cabal configure" 534 + ``` 509 535 is usually enough to set up a build environment for any given Haskell package. 510 536 You can even use that generated file to run `nix-build`, too: 511 - 512 - $ nix-build shell.nix 537 + ```shell 538 + nix-build shell.nix 539 + ``` 513 540 514 541 ### How to build projects that depend on each other 515 542 ··· 518 545 for the dependency resolution performed by `callPackage`. First of all, change 519 546 into each of your projects top-level directories and generate a `default.nix` 520 547 file with `cabal2nix`: 521 - 522 - $ cd ~/src/foo && cabal2nix . >default.nix 523 - $ cd ~/src/bar && cabal2nix . >default.nix 524 - 548 + ```shell 549 + cd ~/src/foo && cabal2nix . > default.nix 550 + cd ~/src/bar && cabal2nix . > default.nix 551 + ``` 525 552 Then edit your `~/.config/nixpkgs/config.nix` file to register those builds in the 526 553 default Haskell package set: 527 - 528 - { 529 - packageOverrides = super: let self = super.pkgs; in 530 - { 531 - haskellPackages = super.haskellPackages.override { 532 - overrides = self: super: { 533 - foo = self.callPackage ../src/foo {}; 534 - bar = self.callPackage ../src/bar {}; 535 - }; 536 - }; 537 - }; 538 - } 539 - 554 + ```nix 555 + { 556 + packageOverrides = super: let self = super.pkgs; in 557 + { 558 + haskellPackages = super.haskellPackages.override { 559 + overrides = self: super: { 560 + foo = self.callPackage ../src/foo {}; 561 + bar = self.callPackage ../src/bar {}; 562 + }; 563 + }; 564 + }; 565 + } 566 + ``` 540 567 Once that's accomplished, `nix-env -f "<nixpkgs>" -qA haskellPackages` will 541 568 show your packages like any other package from Hackage, and you can build them 542 - 543 - $ nix-build "<nixpkgs>" -A haskellPackages.foo 544 - 569 + ```shell 570 + nix-build "<nixpkgs>" -A haskellPackages.foo 571 + ``` 545 572 or enter an interactive shell environment suitable for building them: 546 - 547 - $ nix-shell "<nixpkgs>" -A haskellPackages.bar.env 573 + ```shell 574 + nix-shell "<nixpkgs>" -A haskellPackages.bar.env 575 + ``` 548 576 549 577 ## Miscellaneous Topics 550 578 ··· 555 583 feature is to replace the default `mkDerivation` function with one that enables 556 584 library profiling for all packages. To accomplish that, add configure the 557 585 following snippet in your `~/.config/nixpkgs/config.nix` file: 558 - 559 - { 560 - packageOverrides = super: let self = super.pkgs; in 561 - { 562 - profiledHaskellPackages = self.haskellPackages.override { 563 - overrides = self: super: { 564 - mkDerivation = args: super.mkDerivation (args // { 565 - enableLibraryProfiling = true; 566 - }); 567 - }; 568 - }; 586 + ```nix 587 + { 588 + packageOverrides = super: let self = super.pkgs; in 589 + { 590 + profiledHaskellPackages = self.haskellPackages.override { 591 + overrides = self: super: { 592 + mkDerivation = args: super.mkDerivation (args // { 593 + enableLibraryProfiling = true; 594 + }); 569 595 }; 570 - } 571 - 596 + }; 597 + }; 598 + } 599 + ``` 572 600 Then, replace instances of `haskellPackages` in the `cabal2nix`-generated 573 601 `default.nix` or `shell.nix` files with `profiledHaskellPackages`. 574 602 ··· 580 608 7.8.4 cannot compile that binary. Now, one way to solve that problem is to 581 609 register an older version of `ghc-events` in the 7.8.x-specific package set. 582 610 The first step is to generate Nix build instructions with `cabal2nix`: 583 - 584 - $ cabal2nix cabal://ghc-events-0.4.3.0 >~/.nixpkgs/ghc-events-0.4.3.0.nix 585 - 611 + ```shell 612 + cabal2nix cabal://ghc-events-0.4.3.0 > ~/.nixpkgs/ghc-events-0.4.3.0.nix 613 + ``` 586 614 Then add the override in `~/.config/nixpkgs/config.nix`: 587 - 588 - { 589 - packageOverrides = super: let self = super.pkgs; in 590 - { 591 - haskell = super.haskell // { 592 - packages = super.haskell.packages // { 593 - ghc784 = super.haskell.packages.ghc784.override { 594 - overrides = self: super: { 595 - ghc-events = self.callPackage ./ghc-events-0.4.3.0.nix {}; 596 - }; 597 - }; 615 + ```nix 616 + { 617 + packageOverrides = super: let self = super.pkgs; in 618 + { 619 + haskell = super.haskell // { 620 + packages = super.haskell.packages // { 621 + ghc784 = super.haskell.packages.ghc784.override { 622 + overrides = self: super: { 623 + ghc-events = self.callPackage ./ghc-events-0.4.3.0.nix {}; 598 624 }; 599 625 }; 600 626 }; 601 - } 627 + }; 628 + }; 629 + } 630 + ``` 602 631 603 632 This code is a little crazy, no doubt, but it's necessary because the intuitive 604 633 version 634 + ```nix 635 + { # ... 605 636 606 - haskell.packages.ghc784 = super.haskell.packages.ghc784.override { 607 - overrides = self: super: { 608 - ghc-events = self.callPackage ./ghc-events-0.4.3.0.nix {}; 609 - }; 637 + haskell.packages.ghc784 = super.haskell.packages.ghc784.override { 638 + overrides = self: super: { 639 + ghc-events = self.callPackage ./ghc-events-0.4.3.0.nix {}; 610 640 }; 611 - 641 + }; 642 + } 643 + ``` 612 644 doesn't do what we want it to: that code replaces the `haskell` package set in 613 645 Nixpkgs with one that contains only one entry,`packages`, which contains only 614 646 one entry `ghc784`. This override loses the `haskell.compiler` set, and it ··· 618 650 619 651 Once it's accomplished, however, we can install a variant of `ghc-events` 620 652 that's compiled with GHC 7.8.4: 621 - 622 - nix-env -f "<nixpkgs>" -iA haskell.packages.ghc784.ghc-events 623 - 653 + ```shell 654 + nix-env -f "<nixpkgs>" -iA haskell.packages.ghc784.ghc-events 655 + ``` 624 656 Unfortunately, it turns out that this build fails again while executing the 625 657 test suite! Apparently, the release archive on Hackage is missing some data 626 658 files that the test suite requires, so we cannot run it. We accomplish that by 627 659 re-generating the Nix expression with the `--no-check` flag: 628 - 629 - $ cabal2nix --no-check cabal://ghc-events-0.4.3.0 >~/.nixpkgs/ghc-events-0.4.3.0.nix 630 - 660 + ```shell 661 + cabal2nix --no-check cabal://ghc-events-0.4.3.0 > ~/.nixpkgs/ghc-events-0.4.3.0.nix 662 + ``` 631 663 Now the builds succeeds. 632 664 633 665 Of course, in the concrete example of `ghc-events` this whole exercise is not ··· 642 674 643 675 GHC and distributed build farms don't get along well: 644 676 645 - https://ghc.haskell.org/trac/ghc/ticket/4012 677 + - https://ghc.haskell.org/trac/ghc/ticket/4012 646 678 647 679 When you see an error like this one 648 - 649 - package foo-0.7.1.0 is broken due to missing package 650 - text-1.2.0.4-98506efb1b9ada233bb5c2b2db516d91 651 - 680 + ``` 681 + package foo-0.7.1.0 is broken due to missing package 682 + text-1.2.0.4-98506efb1b9ada233bb5c2b2db516d91 683 + ``` 652 684 then you have to download and re-install `foo` and all its dependents from 653 685 scratch: 654 - 655 - # nix-store -q --referrers /nix/store/*-haskell-text-1.2.0.4 \ 656 - | xargs -L 1 nix-store --repair-path 686 + ```shell 687 + nix-store -q --referrers /nix/store/*-haskell-text-1.2.0.4 \ 688 + | xargs -L 1 nix-store --repair-path 689 + ``` 657 690 658 691 If you're using additional Hydra servers other than `hydra.nixos.org`, then it 659 692 might be necessary to purge the local caches that store data from those 660 693 machines to disable these binary channels for the duration of the previous 661 694 command, i.e. by running: 662 - 663 - rm /nix/var/nix/binary-cache-v3.sqlite 664 - rm /nix/var/nix/manifests/* 665 - rm /nix/var/nix/channel-cache/* 695 + ```shell 696 + rm /nix/var/nix/binary-cache-v3.sqlite 697 + rm /nix/var/nix/manifests/* 698 + rm /nix/var/nix/channel-cache/* 699 + ``` 666 700 667 701 ### How to use the Haste Haskell-to-Javascript transpiler 668 702 669 703 Open a shell with `haste-compiler` and `haste-cabal-install` (you don't actually need 670 704 `node`, but it can be useful to test stuff): 671 - 672 - $ nix-shell -p "haskellPackages.ghcWithPackages (self: with self; [haste-cabal-install haste-compiler])" -p nodejs 673 - 705 + ```shell 706 + nix-shell \ 707 + -p "haskellPackages.ghcWithPackages (self: with self; [haste-cabal-install haste-compiler])" \ 708 + -p nodejs 709 + ``` 674 710 You may not need the following step but if `haste-boot` fails to compile all the 675 711 packages it needs, this might do the trick 676 - 677 - $ haste-cabal update 678 - 712 + ```shell 713 + haste-cabal update 714 + ``` 679 715 `haste-boot` builds a set of core libraries so that they can be used from Javascript 680 716 transpiled programs: 681 - 682 - $ haste-boot 683 - 717 + ```shell 718 + haste-boot 719 + ``` 684 720 Transpile and run a "Hello world" program: 685 - 686 - $ echo 'module Main where main = putStrLn "Hello world"' > hello-world.hs 687 - $ hastec --onexec hello-world.hs 688 - $ node hello-world.js 689 - Hello world 721 + ``` 722 + $ echo 'module Main where main = putStrLn "Hello world"' > hello-world.hs 723 + $ hastec --onexec hello-world.hs 724 + $ node hello-world.js 725 + Hello world 726 + ``` 690 727 691 728 ### Builds on Darwin fail with `math.h` not found 692 729 693 730 Users of GHC on Darwin have occasionally reported that builds fail, because the 694 731 compiler complains about a missing include file: 695 - 696 - fatal error: 'math.h' file not found 697 - 732 + ``` 733 + fatal error: 'math.h' file not found 734 + ``` 698 735 The issue has been discussed at length in [ticket 699 736 6390](https://github.com/NixOS/nixpkgs/issues/6390), and so far no good 700 737 solution has been proposed. As a work-around, users who run into this problem 701 738 can configure the environment variables 702 - 703 - export NIX_CFLAGS_COMPILE="-idirafter /usr/include" 704 - export NIX_CFLAGS_LINK="-L/usr/lib" 705 - 739 + ```shell 740 + export NIX_CFLAGS_COMPILE="-idirafter /usr/include" 741 + export NIX_CFLAGS_LINK="-L/usr/lib" 742 + ``` 706 743 in their `~/.bashrc` file to avoid the compiler error. 707 744 708 745 ### Builds using Stack complain about missing system libraries 709 746 710 - -- While building package zlib-0.5.4.2 using: 711 - runhaskell -package=Cabal-1.22.4.0 -clear-package-db [... lots of flags ...] 712 - Process exited with code: ExitFailure 1 713 - Logs have been written to: /home/foo/src/stack-ide/.stack-work/logs/zlib-0.5.4.2.log 747 + ``` 748 + -- While building package zlib-0.5.4.2 using: 749 + runhaskell -package=Cabal-1.22.4.0 -clear-package-db [... lots of flags ...] 750 + Process exited with code: ExitFailure 1 751 + Logs have been written to: /home/foo/src/stack-ide/.stack-work/logs/zlib-0.5.4.2.log 714 752 715 - Configuring zlib-0.5.4.2... 716 - Setup.hs: Missing dependency on a foreign library: 717 - * Missing (or bad) header file: zlib.h 718 - This problem can usually be solved by installing the system package that 719 - provides this library (you may need the "-dev" version). If the library is 720 - already installed but in a non-standard location then you can use the flags 721 - --extra-include-dirs= and --extra-lib-dirs= to specify where it is. 722 - If the header file does exist, it may contain errors that are caught by the C 723 - compiler at the preprocessing stage. In this case you can re-run configure 724 - with the verbosity flag -v3 to see the error messages. 753 + Configuring zlib-0.5.4.2... 754 + Setup.hs: Missing dependency on a foreign library: 755 + * Missing (or bad) header file: zlib.h 756 + This problem can usually be solved by installing the system package that 757 + provides this library (you may need the "-dev" version). If the library is 758 + already installed but in a non-standard location then you can use the flags 759 + --extra-include-dirs= and --extra-lib-dirs= to specify where it is. 760 + If the header file does exist, it may contain errors that are caught by the C 761 + compiler at the preprocessing stage. In this case you can re-run configure 762 + with the verbosity flag -v3 to see the error messages. 763 + ``` 725 764 726 765 When you run the build inside of the nix-shell environment, the system 727 - is configured to find libz.so without any special flags -- the compiler 766 + is configured to find `libz.so` without any special flags -- the compiler 728 767 and linker "just know" how to find it. Consequently, Cabal won't record 729 - any search paths for libz.so in the package description, which means 768 + any search paths for `libz.so` in the package description, which means 730 769 that the package works fine inside of nix-shell, but once you leave the 731 770 shell the shared object can no longer be found. That issue is by no 732 771 means specific to Stack: you'll have that problem with any other ··· 735 774 736 775 You can remedy this issue in several ways. The easiest is to add a `nix` section 737 776 to the `stack.yaml` like the following: 777 + ```yaml 778 + nix: 779 + enable: true 780 + packages: [ zlib ] 781 + ``` 738 782 739 - nix: 740 - enable: true 741 - packages: [ zlib ] 742 - 743 - Stack's Nix support knows to add `${zlib.out}/lib` and `${zlib.dev}/include` as an 744 - `--extra-lib-dirs` and `extra-include-dirs`, respectively. Alternatively, you 745 - can achieve the same effect by hand. First of all, run 746 - 747 - $ nix-build --no-out-link "<nixpkgs>" -A zlib 748 - /nix/store/alsvwzkiw4b7ip38l4nlfjijdvg3fvzn-zlib-1.2.8 749 - 783 + Stack's Nix support knows to add `${zlib.out}/lib` and `${zlib.dev}/include` 784 + as an `--extra-lib-dirs` and `extra-include-dirs`, respectively. 785 + Alternatively, you can achieve the same effect by hand. First of all, run 786 + ``` 787 + $ nix-build --no-out-link "<nixpkgs>" -A zlib 788 + /nix/store/alsvwzkiw4b7ip38l4nlfjijdvg3fvzn-zlib-1.2.8 789 + ``` 750 790 to find out the store path of the system's zlib library. Now, you can 751 791 752 - 1) add that path (plus a "/lib" suffix) to your $LD_LIBRARY_PATH 753 - environment variable to make sure your system linker finds libz.so 754 - automatically. It's no pretty solution, but it will work. 792 + 1. add that path (plus a "/lib" suffix) to your `$LD_LIBRARY_PATH` 793 + environment variable to make sure your system linker finds `libz.so` 794 + automatically. It's no pretty solution, but it will work. 755 795 756 - 2) As a variant of (1), you can also install any number of system 757 - libraries into your user's profile (or some other profile) and point 758 - $LD_LIBRARY_PATH to that profile instead, so that you don't have to 759 - list dozens of those store paths all over the place. 760 - 761 - 3) The solution I prefer is to call stack with an appropriate 762 - --extra-lib-dirs flag like so: 796 + 2. As a variant of (1), you can also install any number of system 797 + libraries into your user's profile (or some other profile) and point 798 + `$LD_LIBRARY_PATH` to that profile instead, so that you don't have to 799 + list dozens of those store paths all over the place. 763 800 764 - $ stack --extra-lib-dirs=/nix/store/alsvwzkiw4b7ip38l4nlfjijdvg3fvzn-zlib-1.2.8/lib build 801 + 3. The solution I prefer is to call stack with an appropriate 802 + --extra-lib-dirs flag like so: 803 + ```shell 804 + stack --extra-lib-dirs=/nix/store/alsvwzkiw4b7ip38l4nlfjijdvg3fvzn-zlib-1.2.8/lib build 805 + ``` 765 806 766 - Typically, you'll need --extra-include-dirs as well. It's possible 767 - to add those flag to the project's "stack.yaml" or your user's 768 - global "~/.stack/global/stack.yaml" file so that you don't have to 769 - specify them manually every time. But again, you're likely better off using 770 - Stack's Nix support instead. 807 + Typically, you'll need `--extra-include-dirs` as well. It's possible 808 + to add those flag to the project's `stack.yaml` or your user's 809 + global `~/.stack/global/stack.yaml` file so that you don't have to 810 + specify them manually every time. But again, you're likely better off 811 + using Stack's Nix support instead. 771 812 772 - The same thing applies to `cabal configure`, of course, if you're 773 - building with `cabal-install` instead of Stack. 813 + The same thing applies to `cabal configure`, of course, if you're 814 + building with `cabal-install` instead of Stack. 774 815 775 816 ### Creating statically linked binaries 776 817 777 818 There are two levels of static linking. The first option is to configure the 778 819 build with the Cabal flag `--disable-executable-dynamic`. In Nix expressions, 779 820 this can be achieved by setting the attribute: 780 - 781 - enableSharedExecutables = false; 782 - 821 + ``` 822 + enableSharedExecutables = false; 823 + ``` 783 824 That gives you a binary with statically linked Haskell libraries and 784 825 dynamically linked system libraries. 785 826 786 827 To link both Haskell libraries and system libraries statically, the additional 787 828 flags `--ghc-option=-optl=-static --ghc-option=-optl=-pthread` need to be used. 788 829 In Nix, this is accomplished with: 830 + ``` 831 + configureFlags = [ "--ghc-option=-optl=-static" "--ghc-option=-optl=-pthread" ]; 832 + ``` 789 833 790 - configureFlags = [ "--ghc-option=-optl=-static" "--ghc-option=-optl=-pthread" ]; 791 - 792 - It's important to realize, however, that most system libraries in Nix are built 793 - as shared libraries only, i.e. there is just no static library available that 794 - Cabal could link! 834 + It's important to realize, however, that most system libraries in Nix are 835 + built as shared libraries only, i.e. there is just no static library 836 + available that Cabal could link! 795 837 796 838 ### Building GHC with integer-simple 797 839 ··· 801 843 [integer-gmp](http://hackage.haskell.org/package/integer-gmp) package. 802 844 803 845 A potential problem with this is that GMP is licensed under the 804 - [​GNU Lesser General Public License (LGPL)](http://www.gnu.org/copyleft/lesser.html), 846 + [GNU Lesser General Public License (LGPL)](http://www.gnu.org/copyleft/lesser.html), 805 847 a kind of "copyleft" license. According to the terms of the LGPL, paragraph 5, 806 848 you may distribute a program that is designed to be compiled and dynamically 807 849 linked with the library under the terms of your choice (i.e., commercially) but ··· 814 856 programs compiled with GHC because most distributions (and builds) of GHC use 815 857 static libraries. (Dynamic libraries are currently distributed only for OS X.) 816 858 The LGPL licensing situation may be worse: even though 817 - ​[The Glasgow Haskell Compiler License](https://www.haskell.org/ghc/license) 859 + [The Glasgow Haskell Compiler License](https://www.haskell.org/ghc/license) 818 860 is essentially a "free software" license (BSD3), according to 819 861 paragraph 2 of the LGPL, GHC must be distributed under the terms of the LGPL! 820 862 ··· 825 867 To get a GHC compiler build with `integer-simple` instead of `integer-gmp` use 826 868 the attribute: `haskell.compiler.integer-simple."${ghcVersion}"`. 827 869 For example: 828 - 829 - $ nix-build -E '(import <nixpkgs> {}).haskell.compiler.integer-simple.ghc802' 830 - ... 831 - $ result/bin/ghc-pkg list | grep integer 832 - integer-simple-0.1.1.1 833 - 870 + ``` 871 + $ nix-build -E '(import <nixpkgs> {}).haskell.compiler.integer-simple.ghc802' 872 + ... 873 + $ result/bin/ghc-pkg list | grep integer 874 + integer-simple-0.1.1.1 875 + ``` 834 876 The following command displays the complete list of GHC compilers build with `integer-simple`: 835 - 836 - $ nix-env -f "<nixpkgs>" -qaP -A haskell.compiler.integer-simple 837 - haskell.compiler.integer-simple.ghc7102 ghc-7.10.2 838 - haskell.compiler.integer-simple.ghc7103 ghc-7.10.3 839 - haskell.compiler.integer-simple.ghc722 ghc-7.2.2 840 - haskell.compiler.integer-simple.ghc742 ghc-7.4.2 841 - haskell.compiler.integer-simple.ghc783 ghc-7.8.3 842 - haskell.compiler.integer-simple.ghc784 ghc-7.8.4 843 - haskell.compiler.integer-simple.ghc801 ghc-8.0.1 844 - haskell.compiler.integer-simple.ghc802 ghc-8.0.2 845 - haskell.compiler.integer-simple.ghcHEAD ghc-8.1.20170106 877 + ``` 878 + $ nix-env -f "<nixpkgs>" -qaP -A haskell.compiler.integer-simple 879 + haskell.compiler.integer-simple.ghc7102 ghc-7.10.2 880 + haskell.compiler.integer-simple.ghc7103 ghc-7.10.3 881 + haskell.compiler.integer-simple.ghc722 ghc-7.2.2 882 + haskell.compiler.integer-simple.ghc742 ghc-7.4.2 883 + haskell.compiler.integer-simple.ghc783 ghc-7.8.3 884 + haskell.compiler.integer-simple.ghc784 ghc-7.8.4 885 + haskell.compiler.integer-simple.ghc801 ghc-8.0.1 886 + haskell.compiler.integer-simple.ghc802 ghc-8.0.2 887 + haskell.compiler.integer-simple.ghcHEAD ghc-8.1.20170106 888 + ``` 846 889 847 890 To get a package set supporting `integer-simple` use the attribute: 848 891 `haskell.packages.integer-simple."${ghcVersion}"`. For example 849 892 use the following to get the `scientific` package build with `integer-simple`: 850 - 851 - $ nix-build -A haskell.packages.integer-simple.ghc802.scientific 852 - 893 + ```shell 894 + nix-build -A haskell.packages.integer-simple.ghc802.scientific 895 + ``` 853 896 854 897 ## Other resources 855 898 856 - - The Youtube video [Nix Loves Haskell](https://www.youtube.com/watch?v=BsBhi_r-OeE) 857 - provides an introduction into Haskell NG aimed at beginners. The slides are 858 - available at http://cryp.to/nixos-meetup-3-slides.pdf and also -- in a form 859 - ready for cut & paste -- at 860 - https://github.com/NixOS/cabal2nix/blob/master/doc/nixos-meetup-3-slides.md. 899 + - The Youtube video [Nix Loves Haskell](https://www.youtube.com/watch?v=BsBhi_r-OeE) 900 + provides an introduction into Haskell NG aimed at beginners. The slides are 901 + available at http://cryp.to/nixos-meetup-3-slides.pdf and also -- in a form 902 + ready for cut & paste -- at 903 + https://github.com/NixOS/cabal2nix/blob/master/doc/nixos-meetup-3-slides.md. 861 904 862 - - Another Youtube video is [Escaping Cabal Hell with Nix](https://www.youtube.com/watch?v=mQd3s57n_2Y), 863 - which discusses the subject of Haskell development with Nix but also provides 864 - a basic introduction to Nix as well, i.e. it's suitable for viewers with 865 - almost no prior Nix experience. 905 + - Another Youtube video is [Escaping Cabal Hell with Nix](https://www.youtube.com/watch?v=mQd3s57n_2Y), 906 + which discusses the subject of Haskell development with Nix but also provides 907 + a basic introduction to Nix as well, i.e. it's suitable for viewers with 908 + almost no prior Nix experience. 866 909 867 - - Oliver Charles wrote a very nice [Tutorial how to develop Haskell packages with Nix](http://wiki.ocharles.org.uk/Nix). 910 + - Oliver Charles wrote a very nice [Tutorial how to develop Haskell packages with Nix](http://wiki.ocharles.org.uk/Nix). 868 911 869 - - The *Journey into the Haskell NG infrastructure* series of postings 870 - describe the new Haskell infrastructure in great detail: 912 + - The *Journey into the Haskell NG infrastructure* series of postings 913 + describe the new Haskell infrastructure in great detail: 871 914 872 - - [Part 1](http://lists.science.uu.nl/pipermail/nix-dev/2015-January/015591.html) 873 - explains the differences between the old and the new code and gives 874 - instructions how to migrate to the new setup. 915 + - [Part 1](http://lists.science.uu.nl/pipermail/nix-dev/2015-January/015591.html) 916 + explains the differences between the old and the new code and gives 917 + instructions how to migrate to the new setup. 875 918 876 - - [Part 2](http://lists.science.uu.nl/pipermail/nix-dev/2015-January/015608.html) 877 - looks in-depth at how to tweak and configure your setup by means of 878 - overrides. 919 + - [Part 2](http://lists.science.uu.nl/pipermail/nix-dev/2015-January/015608.html) 920 + looks in-depth at how to tweak and configure your setup by means of 921 + overrides. 879 922 880 - - [Part 3](http://lists.science.uu.nl/pipermail/nix-dev/2015-April/016912.html) 881 - describes the infrastructure that keeps the Haskell package set in Nixpkgs 882 - up-to-date. 923 + - [Part 3](http://lists.science.uu.nl/pipermail/nix-dev/2015-April/016912.html) 924 + describes the infrastructure that keeps the Haskell package set in Nixpkgs 925 + up-to-date.