Nix Stuff
1: let
2: pkgsOriginal = import <nixpkgs> {};
3: pkgsSrc = pkgsOriginal.fetchzip {
4: url = "https://github.com/NixOS/nixpkgs/archive/18.03.zip";
5: sha256 = "0hk4y2vkgm1qadpsm4b0q1vxq889jhxzjx3ragybrlwwg54mzp4f";
6: };
7: pkgs = import (pkgsSrc) {};
8: stdenv = pkgs.stdenv;
9:
10: # Taken from:
11: # http://www.cs.yale.edu/homes/lucas.paul/posts/2017-04-10-hakyll-on-nix.html
12: websiteBuilder = pkgs.stdenv.mkDerivation {
13: name = "website-builder";
14: src = ./hakyll;
15: phases = "unpackPhase buildPhase";
16: buildInputs = [
17: (pkgs.haskellPackages.ghcWithPackages (p: with p; [ hakyll ]))
18: ];
19: buildPhase = ''
20: mkdir -p $out/bin
21: ghc -O2 -dynamic --make Main.hs -o $out/bin/generate-site
22: '';
23: };
24: in rec {
25: euandrehWebsite = stdenv.mkDerivation rec {
26: name = "euandreh-website";
27: src = ./site;
28: phases = "unpackPhase buildPhase";
29: # version = "0.1";
30: buildInputs = [ websiteBuilder ];
31: buildPhase = ''
32: export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive";
33: export LANG=en_US.UTF-8
34: generate-site build
35:
36: mkdir $out
37: cp -r _site/* $out
38: '';
39: };
40: }