blob: 39523e5d14be727ea738a19117b5d5a4b44b65d1 (
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
59
60
61
62
63
64
65
66
67
68
69
70
|
let
pkgsOriginal = import <nixpkgs> {};
pkgs = import (pkgsOriginal.fetchzip {
url = "https://github.com/NixOS/nixpkgs/archive/dd6b4b7078d89decabefc6b1a698327db132fbfe.zip";
sha256 = "1cs5vibi2gab8i9m317v1b1spvmm2ppad8pxpkkp64fp1s3q6zy9";
}) {};
# 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 with pkgs; with pkgs.stdenv; rec {
build = mkDerivation rec {
name = "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
'';
};
test = mkDerivation rec {
name = "website-test";
src = ./.;
phases = "unpackPhase buildPhase";
buildInputs = [perl];
buildPhase = ''
mkdir txt
podchecker website.pl 2>&1 | tee txt/podchecker.txt
mv txt/ $out/
'';
};
shell = mkShell rec {
# See also the reference documentation:
# https://nixos.org/nixpkgs/manual/#sec-pkgs-mkShell
name = "website-shell";
buildInputs = [
websiteBuilder
(pkgs.haskellPackages.ghcWithPackages (p: with p; [ hakyll ]))
racket
];
};
publishScript = pkgs.writeShellScriptBin "publish.sh" ''
set -euo pipefail
${pkgs.rsync}/bin/rsync --verbose \
--copy-links \
--progress \
--stats \
--update \
--recursive \
--rsh="ssh -o StrictHostKeyChecking=no" \
${build}/ \
"$SERVER_URL:$DOCS_SERVER_PATH"
'';
}
|