git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #131808 from Artturin/crystal-darwin-fix

Various crystal improvements

commitd0e4e9b474742efe4100f26d46394e51ab8a8182 authorArtturi <Artturin@artturin.com> dateTue 28 Sep 2021, 01:26 (5 years ago) parented8c752afb755e
6 files changed+37−85
pkgs/applications/version-management/git-and-tools/thicket/default.nix+2−2 pkgs/applications/version-management/git-and-tools/thicket/shards.nix+2−2 pkgs/development/compilers/crystal/build-package.nix+3−4 pkgs/development/compilers/crystal/default.nix+24−60 pkgs/development/tools/build-managers/shards/default.nix+5−12 pkgs/top-level/all-packages.nix+1−5
pkgs/applications/version-management/git-and-tools/thicket/default.nix+2−2
@@ -1,10 +1,10 @@
11{ lib
22, fetchFromGitHub
3−, crystal_0_33
3+, crystal_1_0
44}:
55
66let
7− crystal = crystal_0_33;
7+ crystal = crystal_1_0;
88
99in crystal.buildCrystalPackage rec {
1010 pname = "thicket";
pkgs/applications/version-management/git-and-tools/thicket/shards.nix+2−2
@@ -2,7 +2,7 @@
22 ameba = {
33 owner = "veelenga";
44 repo = "ameba";
5− rev = "v0.10.0";
6− sha256 = "1yjxzwdhigsyjn0qp362jkj85qvg4dsyzal00pgr1srnh2xry912";
5+ rev = "v0.14.3";
6+ sha256 = "1cfr95xi6hsyxw1wlrh571hc775xhwmssk3k14i8b7dgbwfmm5x1";
77 };
88}
pkgs/development/compilers/crystal/build-package.nix+3−4
@@ -10,7 +10,7 @@
1010, format ? "make"
1111, installManPages ? true
1212 # Specify binaries to build in the form { foo.src = "src/foo.cr"; }
13− # The default `crystal build` options can be overridden with { foo.options = [ "--no-debug" ]; }
13+ # The default `crystal build` options can be overridden with { foo.options = [ "--optionname" ]; }
1414, crystalBinaries ? { }
1515, ...
1616}@args:
@@ -32,8 +32,7 @@ let
3232 })
3333 (import shardsFile));
3434
35− # we previously had --no-debug here but that is not recommended by upstream
36− defaultOptions = [ "--release" "--progress" "--verbose" ];
35+ defaultOptions = [ "--release" "--progress" "--verbose" "--no-debug" ];
3736
3837 buildDirectly = shardsFile == null || crystalBinaries != { };
3938
@@ -120,7 +119,7 @@ stdenv.mkDerivation (mkDerivationArgs // {
120119
121120 installCheckPhase = args.installCheckPhase or ''
122121 for f in $out/bin/*; do
123− $f --help
122+ $f --help > /dev/null
124123 done
125124 '';
126125
pkgs/development/compilers/crystal/default.nix+24−60
@@ -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 {
pkgs/development/tools/build-managers/shards/default.nix+5−12
@@ -1,7 +1,6 @@
11{ lib
22, fetchFromGitHub
3−, crystal_0_34
4−, crystal_0_36
3+, crystal_1_0
54}:
65let
76 generic =
@@ -36,18 +35,12 @@ let
3635
3736in
3837rec {
39− # needed for anything that requires the old v1 shards format
40− shards_0_11 = generic {
41− version = "0.11.1";
42− sha256 = "05qnhc23xbmicdl4fwyxfpcvd8jq4inzh6v7jsjjw4n76vzb1f71";
43− crystal = crystal_0_34;
44− };
4538
46− shards_0_14 = generic {
47− version = "0.14.1";
39+ shards_0_15 = generic {
40+ version = "0.15.0";
4841 sha256 = "sha256-/C6whh5RbTBkFWqpn0GqyVe0opbrklm8xPv5MIG99VU=";
49− crystal = crystal_0_36;
42+ crystal = crystal_1_0;
5043 };
5144
52− shards = shards_0_14;
45+ shards = shards_0_15;
5346}
pkgs/top-level/all-packages.nix+1−5
@@ -11120,9 +11120,6 @@ with pkgs;
1112011120 inherit (callPackages ../development/compilers/crystal {
1112111121 llvmPackages = llvmPackages_10;
1112211122 })
11123− crystal_0_33
11124− crystal_0_34
11125− crystal_0_35
1112611123 crystal_0_36
1112711124 crystal_1_0
1112811125 crystal;
@@ -14723,8 +14720,7 @@ with pkgs;
1472314720 shallot = callPackage ../tools/misc/shallot { };
1472414721
1472514722 inherit (callPackage ../development/tools/build-managers/shards { })
14726− shards_0_11
14727− shards_0_14
14723+ shards_0_15
1472814724 shards;
1472914725
1473014726 shellcheck = callPackage ../development/tools/shellcheck {};