-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflake.nix
48 lines (43 loc) · 1.44 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
{
description = "hakyll-website";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = inputs:
inputs.flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import inputs.nixpkgs { inherit system; };
# the name of the cabal package and command line
name = "changemetrics-io";
haskellExtend = hpFinal: hpPrev: {
${name} =
hpPrev.callCabal2nix name inputs.self { };
};
hsPkgs = pkgs.haskellPackages.extend haskellExtend;
website = pkgs.stdenv.mkDerivation {
name = "${name}-pages";
buildInputs = [ hsPkgs.${name} ];
src = inputs.self;
# https://github.com/jaspervdj/hakyll/issues/614
# https://github.com/NixOS/nix/issues/318#issuecomment-52986702
# https://github.com/MaxDaten/brutal-recipes/blob/source/default.nix#L24
LOCALE_ARCHIVE =
pkgs.lib.optionalString (pkgs.buildPlatform.libc == "glibc")
"${pkgs.glibcLocales}/lib/locale/locale-archive";
LANG = "en_US.UTF-8";
buildPhase = ''
${name} build
'';
installPhase = ''
mv _site $out
'';
};
in {
packages.website = website;
devShell = hsPkgs.shellFor {
packages = p: [ p.${name} ];
buildInputs = [ pkgs.cabal-install ];
};
});
}