Skip to content
source
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
app
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

elbenshira.com

My personal website. Statically generated using Pencil.

Development

First, install nix:

curl https://nixos.org/nix/install | sh

nix-channel --add https://nixos.org/channels/nixos-18.09 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:

nix-build

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 https://groups.google.com/forum/#!msg/haskell-stack/_ZBh01VP_fo/0v4SxPw7GwAJ
nix-shell -p zlib libiconv

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

Notes

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-2.4.0.1’.
    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-0.1.0.0.drv' failed with exit code 1
error: build of '/nix/store/ybg658ybq9whx2fhd6pbsgw4b58m6dv9-elbenshiracom-0.1.0.0.drv' 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.