-
Notifications
You must be signed in to change notification settings - Fork 11
/
flake.nix
74 lines (66 loc) · 1.87 KB
/
flake.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
70
71
72
73
74
{
description = "Blog";
inputs.nixpkgs.url = "nixpkgs/nixos-24.05";
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
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
{
packages."${system}".default = blog;
devShells."${system}".default = pkgs.mkShell {
name = "blog";
nativeBuildInputs = [
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.python39.withPackages (ps: [
ps.brotli
ps.fontforge
ps.fonttools
]))
pkgs.brotli
pkgs.guetzli
pkgs.m4
pkgs.mozjpeg
pkgs.optipng
pkgs.scour
pkgs.zopfli
];
};
};
}