3.9 KiB
3.9 KiB
hakyll-nix-template
Usage
- Click the "Use this template" button and create your repository
- Renaming
- Rename all instances of
hakyll-nix-template
with the name of your project - Rename
generator/hakyll-nix-template.cabal
to reflect your project name - Cachix
- Create a cachix cache for your project on https://app.cachix.org
- Follow the cachix instructions to generate a signing keypair
- Copy the signing keypair value to a new
CACHIX_SIGNING_KEY
secret on https://github.com///settings/secrets - Run
nix-build
to build the project andnix-shell
to open the nix shell - If you want to update
niv
and the other pinned dependencies, then in thenix-shell
runniv init
and thenniv update
and thenexit
to leave the nix shell - To start an environment for running hakyll commands like
hakyll-site watch
(the dev server) andhakyll-site build
:cd generator && nix-shell
. You'll then have access to thehakyll-site
executable defined ingenerator/hakyll-nix-template.cabal
. While you can donix-shell
in the root and thencd generator && hakyll-site watch
, you get some more tools if younix-shell
from within thegenerator/
folder. - Once you're satisfied, create a branch, push your project up there, and check that the GitHub Actions successfully build. If so, you're good to merge your project with your main branch.
- Once you have a successful build on your main branch, open
https://github.com///settings and set the GitHub Pages
branch to be the
gh-pages
branch
Features
tl;dr: nix-build
will collect all your pinned dependencies, build your hakyll
site, and output the built site in a result/
directory. If you set up the
main GitHub Action with what it needs (your
cachix cache, and your app needs a CACHIX_SIGNING_KEY
secret), it will deploy your built site to a gh-pages
branch.
- Hakyll (see the generator folder)
- Haskell
nix-shell
environment inside thegenerator
folder through which you can runhakyll-site watch
and all other hakyll commands, including the ability to runghci
and load haskell modules for testing - Ability to patch hakyll via
hakyll.patch
- Ability to provide nixpkgs overrides for packages whose versions need to come from hackage
- RSS & Atom XML feed generation
- Sitemap generation
- Reasonable pandoc markdown customization to make it as close to GitHub's style as possible
Slug.hs
module that makes nice URIs- Many other opinionated general website setup features that should be very helpful
- Haskell
- Nix
- Pinned nixpkgs, niv, and pre-commit-hooks.nix
nix-build
will build your site into aresult/
directorynix-shell
in the root will give you a shell with thetools
dependencies in ./nix/default.nixnix-shell
in ./generator will give you a haskell shell with yourhakyll-site
available, as well asghci
- Dev linting via pre-commit-hooks.nix
- Encourages dev use of lorri
- Deployment through a GitHub Actions
build with cachix and deploying to
GitHub Pages via a
gh-pages
branch