Skip to content


Repository files navigation

My personal website. Statically generated using Pencil.


First, install nix:

curl | sh

nix-channel --add nixpkgs
nix-channel --update

Building a new elbenshiracom.nix:

# If cabal2nix is not installed:
nix-env -i cabal2nix

rm -f elbenshiracom.nix && cabal2nix . > elbenshiracom.nix

Build using Nix:


Calling nix-build everytime can be slow, however. When developing, it'll be faster to get into a nix shell and use cabal to build incrementally:

# Note that we pass in zlib and libiconv manually so that cabal can build pencil properly.
# See!msg/haskell-stack/_ZBh01VP_fo/0v4SxPw7GwAJ
nix-shell -p zlib libiconv

cabal install pencil
cabal build
cabal run elbenshiracom-exe
cd out && python -m SimpleHTTPServer 8000
open localhost:8000


Environment file problems

If nix-build is producing this error:

/nix/store/4mdp8nhyfddh7bllbi7xszz7k9955n79-Setup.hs:1:1: error:
    Could not load module ‘Distribution.Simple’
    It is a member of the hidden package ‘Cabal-’.
    You can run ‘:set -package Cabal’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v to see a list of the files searched for.
1 | import Distribution.Simple
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
builder for '/nix/store/ybg658ybq9whx2fhd6pbsgw4b58m6dv9-elbenshiracom-' failed with exit code 1
error: build of '/nix/store/ybg658ybq9whx2fhd6pbsgw4b58m6dv9-elbenshiracom-' failed

Remove .ghc.environment files in the local directory.

These files are auto-generated by cabal new-configure/build/repl/etc. The file represents all the packages that cabal has figured out it will use. But these packages differ than the ones specified via nix (specifically, the package versions in the nix channels). This causes the build to break, because I suppose nix is running ghc or ghci, and these will attempt to load packages specified in the env file.

So the solution is to (1) not cabal new-* and (2) delete these .ghc.environment* files if you do use new-*.

See cabal issue #4542 for more details.