blob: 23d75b69fb44955236a1f7cde18083d783fc30c6 (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
---
title: Nix exps
date: 2018-07-25
layout: post
lang: en
eu_categories: nix
ref: nix-exps
---
```nix
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/generate-site
'';
};
in rec {
euandrehWebsite = stdenv.mkDerivation rec {
name = "euandreh-website";
src = ./site;
phases = "unpackPhase buildPhase";
# version = "0.1";
buildInputs = [ websiteBuilder ];
buildPhase = ''
export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive";
export LANG=en_US.UTF-8
generate-site build
mkdir $out
cp -r _site/* $out
'';
};
}
```
|