forked from ruuda/blog
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
69 lines (63 loc) · 1.67 KB
/
default.nix
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
let
pkgs = import ./nixpkgs-pinned.nix {};
# Even though Nixpkgs ships a recent fonttools, pin to version 3.0.
# Later versions produce fonts which don't load correctly in IE 9.
fonttools = ps: ps.buildPythonPackage rec {
pname = "fonttools";
version = "3.0";
src = ps.fetchPypi {
inherit pname version;
sha256 = "0f4iblpbf3y3ghajiccvdwk2f46cim6dsj6fq1kkrbqfv05dr4nz";
};
};
ghc = pkgs.ghc.withPackages (ps: [
ps.async
ps.containers
ps.pandoc
ps.tagsoup
ps.text
]);
# Build the static site generator directly and make it part of the development
# environment.
blog = pkgs.stdenv.mkDerivation rec {
name = "${pname}-${version}";
pname = "blog";
version = "3.1.0";
src = ./src;
# For the run time options, use 4 threads (-N4), and use a heap of 256 MiB
# (-H). These settings were found to be optimal by running ghc-gc-tune.
ghcOptions = [
"-Wall"
"-fwarn-tabs"
"-O3"
"-threaded"
"-rtsopts \"-with-rtsopts=-N4 -A8388608 -H268435456\""
];
buildPhase = ''
${ghc}/bin/ghc -o blog -outputdir . "$ghcOptions" $src/*.hs
'';
installPhase = ''
mkdir -p $out/bin
cp blog $out/bin
'';
};
in
pkgs.buildEnv {
name = "blog-devenv";
paths = [
blog
# Include GHC so we can still hack on the generator without having to run
# "nix build" all the time.
ghc
# And the runtime dependencies of the generator and utilities.
(pkgs.python38.withPackages (ps: [
ps.brotli
(fonttools ps)
]))
pkgs.brotli
pkgs.guetzli
pkgs.mozjpeg
pkgs.optipng
pkgs.zopfli
];
}