git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #63725 from peterhoeg/u/crystal

crystal: init at 0.29.0

commite3afc85cbaf57637f829712f338aa12eff2f253a authorPeter Hoeg <peter@hoeg.com> dateTue 25 Jun 2019, 12:59 (7 years ago) parent4ec4dc0fda3f06
5 files changed+74−15
pkgs/development/compilers/crystal/default.nix+45−9 pkgs/development/tools/build-managers/shards/default.nix+2−2 pkgs/development/tools/scry/default.nix+5−4 pkgs/development/tools/scry/fix_for_crystal_0_28_and_above.patch+20 pkgs/top-level/all-packages.nix+2
pkgs/development/compilers/crystal/default.nix+45−9
@@ -1,11 +1,11 @@
11{ stdenv, lib, fetchFromGitHub, fetchurl, makeWrapper
2−, gmp, openssl, readline, tzdata, libxml2, libyaml
2+, coreutils, git, gmp, nettools, openssl, readline, tzdata, libxml2, libyaml
33, boehmgc, libatomic_ops, pcre, libevent, libiconv, llvm, clang, which, zlib }:
44
55# We need multiple binaries as a given binary isn't always able to build
6−# (even slightly) older or newer version.
6+# (even slightly) older or newer versions.
77# - 0.26.1 can build 0.25.x and 0.26.x but not 0.27.x
8−# - 0.27.2 can build 0.27.x but not 0.25.x and 0.26.x
8+# - 0.27.2 can build 0.27.x but not 0.25.x, 0.26.x and 0.29.x
99#
1010# We need to keep around at least the latest version released with a stable
1111# NixOS
@@ -19,7 +19,7 @@ let
1919
2020 arch = archs."${stdenv.system}" or (throw "system ${stdenv.system} not supported");
2121
22− checkInputs = [ gmp openssl readline libxml2 libyaml tzdata ];
22+ checkInputs = [ git gmp openssl readline libxml2 libyaml ];
2323
2424 genericBinary = { version, sha256s, rel ? 1 }:
2525 stdenv.mkDerivation rec {
@@ -38,8 +38,8 @@ let
3838
3939 generic = { version, sha256, binary, doCheck ? true }:
4040 stdenv.mkDerivation rec {
41− inherit doCheck;
42− name = "crystal-${version}";
41+ pname = "crystal";
42+ inherit doCheck version;
4343
4444 src = fetchFromGitHub {
4545 owner = "crystal-lang";
@@ -48,14 +48,30 @@ let
4848 inherit sha256;
4949 };
5050
51+ # we are almost able to run the full test suite now
5152 postPatch = ''
53+ substituteInPlace src/crystal/system/unix/time.cr \
54+ --replace /usr/share/zoneinfo ${tzdata}/share/zoneinfo
55+
5256 ln -s spec/compiler spec/std
57+
58+ substituteInPlace spec/std/file_spec.cr \
59+ --replace '/bin/ls' '${coreutils}/bin/ls' \
60+ --replace '/usr/share' '/tmp/test'
61+
5362 substituteInPlace spec/std/process_spec.cr \
54− --replace /bin/ /run/current-system/sw/bin/
63+ --replace '/bin/cat' '${coreutils}/bin/cat' \
64+ --replace '/bin/ls' '${coreutils}/bin/ls' \
65+ --replace '/usr/bin/env' '${coreutils}/bin/env' \
66+ --replace '"env"' '"${coreutils}/bin/env"' \
67+ --replace '"/usr"' '"/tmp"'
68+
69+ substituteInPlace spec/std/system_spec.cr \
70+ --replace '`hostname`' '`${nettools}/bin/hostname`'
5571 '';
5672
5773 buildInputs = [
58− boehmgc libatomic_ops pcre libevent
74+ boehmgc libatomic_ops pcre libevent libyaml
5975 llvm zlib openssl
6076 ] ++ stdenv.lib.optionals stdenv.isDarwin [
6177 libiconv
@@ -111,7 +127,11 @@ let
111127 checkTarget = "spec";
112128
113129 preCheck = ''
130+ export HOME=/tmp
131+ mkdir -p $HOME/test
132+
114133 export LIBRARY_PATH=${lib.makeLibraryPath checkInputs}:$LIBRARY_PATH
134+ export PATH=${lib.makeBinPath checkInputs}:$PATH
115135 '';
116136
117137 meta = with lib; {
@@ -142,6 +162,15 @@ in rec {
142162 };
143163 };
144164
165+ binaryCrystal_0_29 = genericBinary {
166+ version = "0.29.0";
167+ sha256s = {
168+ "x86_64-linux" = "1wrk29sfx35akg7hxwpdiikvl18wd40gq1kwirw7x522hnq7vlna";
169+ "i686-linux" = "1nx0piis2k3nn7kqiijqazzbvlaavhgvsln0l3dxmpfa4i4dz5h2";
170+ "x86_64-darwin" = "1fd0fbyf05abivnp3igjlrm2axf65n2wdmg4aq6nqj60ipc01rvd";
171+ };
172+ };
173+
145174 crystal_0_25 = generic {
146175 version = "0.25.1";
147176 sha256 = "15xmbkalsdk9qpc6wfpkly3sifgw6a4ai5jzlv78dh3jp7glmgyl";
@@ -163,5 +192,12 @@ in rec {
163192 binary = binaryCrystal_0_27;
164193 };
165194
166− crystal = crystal_0_27;
195+ crystal_0_29 = generic {
196+ version = "0.29.0";
197+ sha256 = "0v9l253b2x8yw6a43vvalywpwciwr094l3g5wakmndfrzak2s3zr";
198+ doCheck = false; # 6 checks are failing now
199+ binary = binaryCrystal_0_29;
200+ };
201+
202+ crystal = crystal_0_29;
167203}
pkgs/development/tools/build-managers/shards/default.nix+2−2
@@ -2,13 +2,13 @@
22
33stdenv.mkDerivation rec {
44 name = "shards-${version}";
5− version = "0.8.1";
5+ version = "0.9.0";
66
77 src = fetchFromGitHub {
88 owner = "crystal-lang";
99 repo = "shards";
1010 rev = "v${version}";
11− sha256 = "1cjn2lafr08yiqzlhyqx14jjjxf1y24i2kk046px07gljpnlgqwk";
11+ sha256 = "19q0xww4v0h5ln9gz8d8zv0c9ig761ik7gw8y31yxynzgzihwpf4";
1212 };
1313
1414 buildInputs = [ crystal libyaml pcre which ];
pkgs/development/tools/scry/default.nix+5−4
@@ -1,9 +1,8 @@
1−{ stdenv, fetchFromGitHub, crystal, shards, which }:
1+{ stdenv, lib, fetchFromGitHub, crystal, shards, llvm, which }:
22
33stdenv.mkDerivation rec {
44 pname = "scry";
5− # 0.7.1 doesn't work with crystal > 0.25
6− version = "0.7.1.20180919";
5+ version = "0.8.0";
76
87 src = fetchFromGitHub {
98 owner = "crystal-lang-tools";
@@ -12,7 +11,9 @@ stdenv.mkDerivation rec {
1211 sha256 = "1yq7jap3y5pr2yqc6fn6bxshzwv7dz3w97incq7wpcvi7ibb4lcn";
1312 };
1413
15− nativeBuildInputs = [ crystal shards which ];
14+ patches = lib.optional (lib.versionAtLeast crystal.version "0.28") ./fix_for_crystal_0_28_and_above.patch;
15+
16+ nativeBuildInputs = [ crystal shards llvm which ];
1617
1718 buildPhase = ''
1819 runHook preBuild
pkgs/development/tools/scry/fix_for_crystal_0_28_and_above.patchnew file+20
@@ -0,0 +1,20 @@
1+diff --git a/src/scry/completion_provider.cr b/src/scry/completion_provider.cr
2+index 29e0d36..f67438c 100644
3+--- a/src/scry/completion_provider.cr
4++++ b/src/scry/completion_provider.cr
5+@@ -1,4 +1,5 @@
6+ require "./log"
7++require "compiler/crystal/codegen/target"
8+ require "compiler/crystal/crystal_path"
9+ require "./completion/*"
10+
11+diff --git a/src/scry/parse_analyzer.cr b/src/scry/parse_analyzer.cr
12+index d87eca4..bbe9ed5 100644
13+--- a/src/scry/parse_analyzer.cr
14++++ b/src/scry/parse_analyzer.cr
15+@@ -1,4 +1,5 @@
16+ require "compiler/crystal/syntax"
17++require "compiler/crystal/codegen/target"
18+ require "compiler/crystal/crystal_path"
19+ require "./workspace"
20+ require "./text_document"
pkgs/top-level/all-packages.nix+2
@@ -7192,6 +7192,8 @@ in
71927192 })
71937193 crystal_0_25
71947194 crystal_0_26
7195+ crystal_0_27
7196+ crystal_0_29
71957197 crystal;
71967198
71977199 icr = callPackage ../development/tools/icr {};