diff options
Diffstat (limited to '')
-rw-r--r-- | default.nix | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..f5966e8 --- /dev/null +++ b/default.nix @@ -0,0 +1,39 @@ +let + pkgsOriginal = import <nixpkgs> {}; + pkgsSrc = pkgsOriginal.fetchzip { + url = "https://github.com/NixOS/nixpkgs/archive/18.03.zip"; + sha256 = "0hk4y2vkgm1qadpsm4b0q1vxq889jhxzjx3ragybrlwwg54mzp4f"; + }; + pkgs = import (pkgsSrc) {}; + stdenv = pkgs.stdenv; + + # Taken from: + # http://www.cs.yale.edu/homes/lucas.paul/posts/2017-04-10-hakyll-on-nix.html + websiteBuilder = pkgs.stdenv.mkDerivation { + name = "website-builder"; + src = ./hakyll; + phases = "unpackPhase buildPhase"; + buildInputs = [ + (pkgs.haskellPackages.ghcWithPackages (p: with p; [ hakyll ])) + ]; + buildPhase = '' + mkdir -p $out/bin + ghc -O2 -dynamic --make Main.hs -o $out/bin/build-site + ''; + }; +in rec { + euandrehWebsite = stdenv.mkDerivation rec { + name = "euandreh-website"; + src = ./site; + phases = "unpackPhase buildPhase"; + buildInputs = [ websiteBuilder ]; + buildPhase = '' + export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive"; + export LANG=en_US.UTF-8 + build-site build + + mkdir $out + cp -r _site/* $out + ''; + }; +} |