From e8ed369edaae1808dffcc22d1c8fb1df7880e065 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Tue, 14 Apr 2020 18:41:06 +0200 Subject: Add cabal install instructions --- web/tutorials/01-installation.markdown | 72 +++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 23 deletions(-) (limited to 'web') diff --git a/web/tutorials/01-installation.markdown b/web/tutorials/01-installation.markdown index b9eceb0..16e73c8 100644 --- a/web/tutorials/01-installation.markdown +++ b/web/tutorials/01-installation.markdown @@ -8,46 +8,72 @@ Installation ------------ Installation is provided via Hackage, and some packages are available for -different distributions. For installation from source (i.e. via Hackage), -[stack] is recommended: +different distributions. There are a few different methods to install +Hakyll. - $ stack install hakyll +1. You can use [ghcup] to install Cabal and then use: -[stack]: http://www.haskellstack.org/ + $ cabal new-install hakyll + +2. Using [stack]: + + $ stack install hakyll + +3. There are also some Linux distro packages: -Linux distro packages: + - [Debian unstable](http://packages.debian.org/source/sid/haskell-hakyll) + - [Fedora](https://apps.fedoraproject.org/packages/ghc-hakyll) + - [Nix]: `$ nix-env -iA nixos.haskellPackages.hakyll` -- [Debian unstable](http://packages.debian.org/source/sid/haskell-hakyll) -- [Fedora](https://apps.fedoraproject.org/packages/ghc-hakyll) -- [Nix](https://nixos.org/nixos/packages.html#hakyll): `$ nix-env -iA nixos.haskellPackages.hakyll` +[ghcup]: https://www.haskell.org/ghcup/ +[Nix]: https://nixos.org/nixos/packages.html#hakyll +[stack]: http://www.haskellstack.org/ Building the example site ------------------------- -Apart from the main Hakyll library, the cabal package also provides you with an -executable `hakyll-init` to create an example site. This is an easy way to get -started: +Apart from the main Hakyll library, the package also provides you with an +executable `hakyll-init` to create an example site. This is an easy way to get +started. - $ stack exec hakyll-init my-site +Using cabal +=========== + +Create the example site: + + hakyll-init my-site -This creates a folder `my-site` in the current directory, with some example -content and a generic configuration. +If `hakyll-init` is not found, make sure `~/.ghcup/env` is sourced. -If `hakyll-init` is not found, you should make sure your stack bin path -(usually `$HOME/.local/bin`) is in your `$PATH`. You can check your stack local -bin path by running `stack path --local-bin`. +In the `my-site` directory, you can use `cabal new-install` to install the +`site` executable (which builds your website). Alternatively, you can just +use `cabal new-run site [command]`. + +You can build the site using: + + my-site build + +And preview (and build) it using: + + my-site watch + +Using stack +=========== + +Create the `my-site` directory with the project files inside: + + $ stack exec hakyll-init my-site -Now, change into `my-site` directory and create a file `stack.yaml` -here with the following content: +Now, change into `my-site` directory and create a file `stack.yaml` here with +the following content: resolver: lts-14.16 # Adapt this as needed packages: - . extra-deps: - - hakyll-4.13.0.1 + - hakyll-4.13.0.1 # Or a later version you installed -On NixOS you will probably have to add the following lines to this -file: +On NixOS you will probably have to add the following lines to this file: nix: enable: true @@ -60,7 +86,7 @@ haskell program. We can compile and run it like this: $ stack exec site build If you installed `hakyll` with a preview server (this is the default), you can -now use +now use: $ stack exec site watch -- cgit v1.2.3