-
Notifications
You must be signed in to change notification settings - Fork 1
/
release.nix
97 lines (84 loc) · 3.34 KB
/
release.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
{ nixpkgs ? <nixpkgs>, nixpkgsArgs ? {}, compiler ? "ghc802" }:
with rec {
pkgs = import nixpkgs nixpkgsArgs;
inherit (pkgs) haskell;
# Compute, e.g.: "x86_64-linux-ghc-8.0.2"
computeHaskellDir = hp: pkg: "${pkg.system}-${hp.ghc.name}";
addHydraHaddock = hp: pkg: (
with rec {
suffix = "share/doc/${computeHaskellDir hp pkg}/${pkg.name}/html";
};
haskell.lib.overrideCabal pkg (old: rec {
doHaddock = true;
postInstall = ((old.postInstall or "") + ''
mkdir -pv "$out/nix-support"
echo "doc haddock $out/${suffix} index.html" \
>> "$out/nix-support/hydra-build-products"
'');
}));
addHydraTasty = hp: pkg: (
with rec {
dir = computeHaskellDir hp hp.tasty-html;
data = "${hp.tasty-html}/share/${dir}/${hp.tasty-html.name}/data/";
static = pkgs.runCommand "tasty-html-static" {} ''
mkdir -pv "$out"
ln -sv ${data}/jquery-*.min.js "$out/"
ln -sv ${data}/bootstrap/dist/css/bootstrap.min.css "$out/"
ln -sv ${data}/bootstrap/dist/js/bootstrap.min.js "$out/"
'';
};
haskell.lib.overrideCabal pkg (old: rec {
testTarget = "--test-options=\"--html tasty.html --assets static\"";
postInstall = ((old.postInstall or "") + ''
mkdir -pv "$out/nix-support/test-results"
mv -v tasty.html "$out/nix-support/test-results/index.html"
ln -sv ${static} "$out/nix-support/test-results/static"
echo "report tests $out/nix-support/test-results index.html" \
>> "$out/nix-support/hydra-build-products"
'');
}));
addHydraHPC = hp: pkg: (
haskell.lib.overrideCabal pkg (old: rec {
doCoverage = true;
postInstall = ((old.postInstall or "") + ''
mkdir -pv "$out/nix-support"
echo "report hpc $out/share/hpc/dyn/html/${pkg.name} hpc_index.html" \
>> "$out/nix-support/hydra-build-products"
'');
}));
hp = haskell.packages.${compiler}.override {
overrides = self: super: (
with haskell.lib;
with { cp = file: (self.callPackage (./nix/haskell + "/${file}") {}); };
{
makefile = cp "makefile.nix";
monad-mock = cp "monad-mock.nix";
prettyprinter = cp "prettyprinter.nix";
prettyprinter-ansi-terminal = cp "prettyprinter-ansi-terminal.nix";
smallcheck-lens = doJailbreak super.smallcheck-lens;
tasty-lens = doJailbreak super.tasty-lens;
versions = cp "versions.nix";
language-ninja = cp "language-ninja.nix";
ninja2nix = (cp "ninja2nix.nix").overrideDerivation (old:
with {
sf = name: type: let bn = baseNameOf (toString name); in !(
(type == "directory" && (bn == ".git"))
|| pkgs.lib.hasSuffix "~" bn
|| pkgs.lib.hasSuffix ".o" bn
|| pkgs.lib.hasSuffix ".so" bn
|| pkgs.lib.hasSuffix ".nix" bn
|| (type == "symlink" && pkgs.lib.hasPrefix "result" bn)
);
};
{ src = builtins.filterSource sf ./.; });
}
);
};
};
{
ninja2nix = addHydraHaddock hp (addHydraHPC hp hp.ninja2nix);
# ninja2nix = (
# addHydraHaddock hp
# (addHydraHPC hp
# (addHydraTasty hp hp.ninja2nix)));
}