-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.nix
108 lines (96 loc) · 2.36 KB
/
package.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{ pkgs
, servant-prometheus
, hc ? "ghc884"
}:
let
haskellPackages =
pkgs.haskell.packages.${hc}.override {
overrides = self: super: rec {
/* No overrides needed for now */
};
};
ghcWithPackages =
haskellPackages.ghcWithPackages (p: [
p.servant-server
p.servant-blaze
p.http-client-tls
p.prometheus-client
p.prometheus-metrics-ghc
p.split
p.tar
p.unix
p.uuid
p.unagi-chan
servant-prometheus
]);
backendInputs = [
ghcWithPackages
pkgs.cabal-install
pkgs.git
pkgs.zlib
pkgs.pkgconfig
];
frontendInputs = [
ghcWithPackages /* for the build script */
pkgs.nodePackages.typescript
pkgs.closurecompiler
pkgs.sass
];
shellInputs = [
pkgs.haskellPackages.html-validator-cli
pkgs.ghcid
] ++
(if pkgs.stdenv.isLinux then [pkgs.inotify-tools] else []);
LOCALE_ARCHIVE =
if pkgs.stdenv.isLinux
then "${pkgs.glibcLocales}/lib/locale/locale-archive"
else "";
in
rec {
download =
pkgs.stdenv.mkDerivation rec {
name = "hackage-download";
src = ./backend;
buildCommand = ''
mkdir -p "$out/bin"
mkdir backend-build-artifacts
ghc "$src/Download.hs" \
-outputdir backend-build-artifacts \
-o "$out/bin/hackage-download" \
-Wall -threaded -O2 -with-rtsopts="-N"
'';
buildInputs = backendInputs;
inherit LOCALE_ARCHIVE;
};
search =
pkgs.stdenv.mkDerivation rec {
name = "hackage-search";
src = ./backend;
buildCommand = ''
mkdir -p "$out/bin"
mkdir backend-build-artifacts
ghc "$src/Search.hs" \
-outputdir backend-build-artifacts \
-o "$out/bin/hackage-search" \
-Wall -threaded -O2 -with-rtsopts="-N"
'';
buildInputs = backendInputs;
inherit LOCALE_ARCHIVE;
};
frontend =
pkgs.stdenv.mkDerivation rec {
name = "hackage-search-frontend";
src = ./frontend;
buildCommand = ''
mkdir -p "$out/html"
runghc "$src/Build.hs" \
--src "$src" \
--out "$out/html/index.html"
cp "$src/favicon.svg" \
"$out/html/favicon.svg"
'';
buildInputs = frontendInputs;
inherit LOCALE_ARCHIVE;
};
shellExtraInputs = backendInputs ++ frontendInputs ++ shellInputs;
}