@@ -56,6 +56,7 @@ let
5656 buildCommand = ''
5757 mkdir -p $out
5858 tar --strip-components=1 -C $out -xf ${src}
59+ patchShebangs $out/bin/crystal
5960 '';
6061 };
6162
@@ -93,6 +94,10 @@ let
9394 outputs = [ "out" "lib" "bin" ];
9495
9596 postPatch = ''
97+ export TMP=$(mktemp -d)
98+ export HOME=$TMP
99+ mkdir -p $HOME/test
100+
96101 # Add dependency of crystal to docs to avoid issue on flag changes between releases
97102 # https://github.com/crystal-lang/crystal/pull/8792#issuecomment-614004782
98103 substituteInPlace Makefile \
@@ -103,39 +108,35 @@ let
103108
104109 ln -sf spec/compiler spec/std
105110
106− # Dirty fix for when no sandboxing is enabled
107− rm -rf /tmp/crystal
108− mkdir -p /tmp/crystal
111+ mkdir -p $TMP/crystal
109112
110113 substituteInPlace spec/std/file_spec.cr \
111114 --replace '/bin/ls' '${coreutils}/bin/ls' \
112− --replace '/usr/share' '/tmp/crystal' \
113− --replace '/usr' '/tmp'
115+ --replace '/usr/share' "$TMP/crystal" \
116+ --replace '/usr' "$TMP" \
117+ --replace '/tmp' "$TMP"
114118
115119 substituteInPlace spec/std/process_spec.cr \
116120 --replace '/bin/cat' '${coreutils}/bin/cat' \
117121 --replace '/bin/ls' '${coreutils}/bin/ls' \
118122 --replace '/usr/bin/env' '${coreutils}/bin/env' \
119123 --replace '"env"' '"${coreutils}/bin/env"' \
120− --replace '"/usr"' '"/tmp"'
121−
122− substituteInPlace spec/std/socket/tcp_server_spec.cr \
123− --replace '{% if flag?(:gnu) %}"listen: "{% else %}"bind: "{% end %}' '"bind: "'
124+ --replace '/usr' "$TMP" \
125+ --replace '/tmp' "$TMP"
124126
125127 substituteInPlace spec/std/system_spec.cr \
126128 --replace '`hostname`' '`${hostname}/bin/hostname`'
127129
128− # See https://github.com/crystal-lang/crystal/pull/8640
129− substituteInPlace spec/std/http/cookie_spec.cr \
130− --replace '01 Jan 2020' '01 Jan #{Time.utc.year + 2}'
131−
132130 # See https://github.com/crystal-lang/crystal/issues/8629
133131 substituteInPlace spec/std/socket/udp_socket_spec.cr \
134132 --replace 'it "joins and transmits to multicast groups"' 'pending "joins and transmits to multicast groups"'
133+ '';
135134
136− # See https://github.com/crystal-lang/crystal/pull/8699
137− substituteInPlace spec/std/xml/xml_spec.cr \
138− --replace 'it "handles errors"' 'pending "handles errors"'
135+ # Defaults are 4
136+ preBuild = ''
137+ export CRYSTAL_WORKERS=$NIX_BUILD_CORES
138+ export threads=$NIX_BUILD_CORES
139+ export CRYSTAL_CACHE_DIR=$TMP
139140 '';
140141
141142 buildInputs = commonBuildInputs extraBuildInputs;
@@ -197,9 +198,6 @@ let
197198 checkTarget = "compiler_spec";
198199
199200 preCheck = ''
200− export HOME=/tmp
201− mkdir -p $HOME/test
202−
203201 export LIBRARY_PATH=${lib.makeLibraryPath checkInputs}:$LIBRARY_PATH
204202 export PATH=${lib.makeBinPath checkInputs}:$PATH
205203 '';
@@ -214,60 +212,26 @@ let
214212 license = licenses.asl20;
215213 maintainers = with maintainers; [ david50407 fabianhjr manveru peterhoeg ];
216214 platforms = builtins.attrNames archs;
217− # Error running at_exit handler: Nil assertion failed
218− broken = lib.versions.minor version == "32" && stdenv.isDarwin;
215+ broken = lib.versionOlder version "0.36.1" && stdenv.isDarwin;
219216 };
220217 })
221218 );
222219
223220in
224221rec {
225− binaryCrystal_0_31 = genericBinary {
226− version = "0.31.1";
222+ binaryCrystal_0_36 = genericBinary {
223+ version = "0.36.1";
227224 sha256s = {
228− x86_64-linux = "0r8salf572xrnr4m6ll9q5hz6jj8q7ff1rljlhmqb1r26a8mi2ih";
229− i686-linux = "0hridnis5vvrswflx0q67xfg5hryhz6ivlwrb9n4pryj5d1gwjrr";
230− x86_64-darwin = "1dgxgv0s3swkc5cwawzgpbc6bcd2nx4hjxc7iw2h907y1vgmbipz";
225+ x86_64-linux = "065vzq34g7hgzl2mrzy9gwwsfikc78nj7xxsbrk67r6rz0a7bk1q";
226+ i686-linux = "18m4b1lnd682i5ygbg6cljqjny60nn2mlrzrk765h2ip6fljqbm1";
227+ x86_64-darwin = "0xggayk92zh64pb5sz77n12hkcd1hg8kw90z7gb18594q551sf1v";
231228 };
232229 };
233230
234− crystal_0_31 = generic {
235− version = "0.31.1";
236− sha256 = "1dswxa32w16gnc6yjym12xj7ibg0g6zk3ngvl76lwdjqb1h6lwz8";
237− doCheck = false; # 5 checks are failing now
238− binary = binaryCrystal_0_31;
239− };
240−
241− crystal_0_32 = generic {
242− version = "0.32.1";
243− sha256 = "120ndi3nhh2r52hjvhwfb49cdggr1bzdq6b8xg7irzavhjinfza6";
244− binary = crystal_0_31;
245− };
246−
247− crystal_0_33 = generic {
248− version = "0.33.0";
249− sha256 = "1zg0qixcws81s083wrh54hp83ng2pa8iyyafaha55mzrh8293jbi";
250− binary = crystal_0_32;
251− };
252−
253− crystal_0_34 = generic {
254− version = "0.34.0";
255− sha256 = "110lfpxk9jnqyznbfnilys65ixj5sdmy8pvvnlhqhc3ccvrlnmq4";
256− binary = crystal_0_33;
257− };
258−
259− crystal_0_35 = generic {
260− version = "0.35.1";
261− sha256 = "0p51bjl1nsvwsm64lqq421dcsxa201w7wwq8plw4r8wqarpq0g69";
262− binary = crystal_0_34;
263− # Needs git to build as per https://github.com/crystal-lang/crystal/issues/9789
264− extraBuildInputs = [ git ];
265− };
266−
267231 crystal_0_36 = generic {
268232 version = "0.36.1";
269233 sha256 = "sha256-5rjrvwZKM4lHpmxLyUVbi0Zw98xT+iJKonxwfUwS/Wk=";
270− binary = crystal_0_35;
234+ binary = binaryCrystal_0_36;
271235 };
272236
273237 crystal_1_0 = generic {