writing: c64c6088064ac3d36971f43c9dbf43ba9b90a7ad
1: { textWidth ? "345.0" }:
2: with builtins;
3: with { inherit (import ../../resources) bibtex nixpkgs styles; };
4: with nixpkgs;
5: with lib;
6: rec {
7: # External repos, which contain useful data
8:
9: # Implements hashspec (pseudorandom) and MLSpec (recurrent clustering)
10: bucketingSrc = fetchgit {
11: url = http://chriswarbo.net/git/bucketing-algorithms.git;
12: rev = "1efc1a3";
13: sha256 = "10i89hfn8yr64dqx25k982z7n78cacbbagxfg3ac9b7p0d5wkz53";
14: };
15:
16: bucketing = import "${bucketingSrc}";
17:
18: # Implements wrappers around QuickSpec 1 and contains runtime benchmarks
19: inherit (bucketing) haskellTE haskellTESrc;
20:
21: # There is a bug in i686 nixpkgs which causes errors like:
22: # ImportError:
23: # /nix/store/...-scipy-1.1.0/.../_sparsetools.cpython-36m-i386-linux-gnu.so:
24: # undefined symbol: __divmoddi4
25: # This is caused by the wrong GCC being used, affecting many packages (Qt,
26: # spidermonkey, etc.). Until it's fixed upstream (which hasn't happened as of
27: # nixpkgs18.09) the workaround is to add a version of libgcc_s.so.1 to the
28: # LD_LIBRARY_PATH.
29: # See https://github.com/NixOS/nixpkgs/issues/36947
30: libgccFix = ''
31: echo "Looking for libgcc" 1>&2
32: FOUND=0
33: for F in "${gcc.cc.lib}"/lib/libgcc_s.so.*
34: do
35: FOUND=1
36: echo "Forcing LD_LIBRARY_PATH to use '$F'" 1>&2
37: D=$(dirname "$F")
38: export LD_LIBRARY_PATH="$D:$LD_LIBRARY_PATH"
39: done
40: if [[ "$FOUND" -eq 0 ]]
41: then
42: echo "Failed to find libgcc_s.so" 1>&2
43: exit 1
44: fi
45: '';
46:
47: # Runs $script to put stuff in $out
48: runner = ''
49: ${libgccFix}
50: mkdir "$out"
51: cd "$out"
52: "$script"
53: '';
54:
55: # Raw and analysed data
56: graphs = callPackage ./graphs.nix {
57: inherit basicTex bucketingSrc runner textWidth;
58: };
59: data = callPackage ./data.nix { inherit haskellTESrc; };
60: contents = callPackage ./contents.nix { inherit basicTex data textWidth; };
61: toxic = callPackage ./toxic {
62: inherit haskellTE;
63: inherit (contents.all) readableToxic;
64: };
65: survivalAnalysis = callPackage ./survival.nix {
66: inherit basicTex libgccFix runner textWidth;
67: };
68: allSurvival = survivalAnalysis { data = data.data.result;
69: label = "all"; };
70: nontoxicSurvival = survivalAnalysis { data = contents.nontoxic.samples;
71: label = "nontoxic"; };
72:
73: # Extract content (graphs, etc.) from the above analyses
74: content = runCommand "bucketing-content"
75: {
76: ds = [
77: contents.all.proportions
78: contents.nontoxic.proportions
79: allSurvival.survivalGraph
80: allSurvival.timeoutGraph
81: nontoxicSurvival.survivalGraph
82: nontoxicSurvival.timeoutGraph
83: graphs.boundsGraph
84: graphs.bucketingGraph
85: graphs.clustering-vs-random.graph
86: ];
87: }
88: ''
89: mkdir -p "$out/images"
90: mkdir -p "$out/text"
91: for D in $ds
92: do
93: find "$D" -type f | while read -r F
94: do
95: NAME=$(basename "$F")
96: case "$NAME" in
97: *.pgf);&
98: *.pdf);&
99: *.png)
100: cp -v "$F" "$out/images/$NAME"
101: ;;
102:
103: *.tex)
104: cp -v "$F" "$out/text/$NAME"
105: ;;
106:
107: *)
108: echo "Error, don't know where to put '$F'" 1>&2
109: exit 1
110: ;;
111: esac
112: done
113: done
114: '';
115:
116: # Just enough LaTeX packages to render PDF graphs
117: basicTex = texlive.combine {
118: inherit (texlive)
119: scheme-small
120: type1cm
121: ucs
122: ;
123: };
124:
125: # All of the LaTeX and related tools for rendering the paper
126: fullTex = buildEnv {
127: name = "bucketing-tex";
128: paths = [
129: pythonPackages.pygments # For minted
130: which # For minted
131: (texlive.combine {
132: inherit (texlive)
133: algorithm2e
134: algorithmicx
135: algorithms
136: framed # Required by minted
137: fvextra # Required by minted
138: ifplatform # Required by minted
139: minted # Code listings
140: scheme-small
141: tikzinclude
142: tikz-qtree
143: xstring # Required by minted
144: ;
145: })
146: ];
147: };
148:
149: render = wrap {
150: name = "render-bucketing-paper";
151: paths = [ fullTex gnumake ];
152: vars = {
153: inherit bibtex content;
154:
155: go = wrap {
156: name = "go";
157: script = ''
158: #!${bash}/bin/bash
159: set -e
160: DRAFT='-draftmode'
161: [[ "$FINAL" -eq 1 ]] && DRAFT=""
162: echo "Running pdflatex $DRAFT" 1>&2
163: pdflatex -interaction=batchmode $DRAFT \
164: -halt-on-error \
165: --shell-escape report || {
166: echo "ERROR: pdflatex $DRAFT gave error code $?" 1>&2
167: exit 1
168: }
169: '';
170: };
171:
172: source = filterSource (path: _: hasSuffix ".tex" path ||
173: hasSuffix ".cls" path)
174: ./..;
175:
176: styles = concatStringsSep " " (attrValues styles);
177: };
178: script = ''
179: #!${bash}/bin/bash
180: set -e
181: cp -r "$source" ./src
182: chmod -R +w ./src
183: cp "$bibtex" ./src/Bibtex.bib
184:
185: for D in "$content"/*
186: do
187: cp -rL "$D" ./src/"$(basename "$D")"
188: done
189:
190: for STYLE in $styles
191: do
192: cp "$STYLE" ./src
193: done
194:
195: cd ./src
196: [[ -z "$FIDDLESOURCE" ]] || $FIDDLESOURCE
197:
198: "$go"
199: echo "RUNNING bibtex"
200: bibtex report
201: "$go"
202: FINAL=1 "$go"
203: '';
204: };
205:
206: #inherit graphs;
207:
208: checks = callPackage ./check.nix { inherit bibtex render; };
209:
210: paperUntested = runCommand "bucketing-paper" { inherit render; } ''
211: "$render"
212: mkdir "$out"
213: mv src/report.pdf "$out"/
214: '';
215:
216: paper = withDeps (allDrvsIn checks) paperUntested;
217: }
Generated by git2html.