diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index 1e0f8656ef0..2e823fe1f0f 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -1,11 +1,11 @@ { stdenv, lib, fetchFromGitHub, fetchurl, makeWrapper -, gmp, openssl, readline, tzdata, libxml2, libyaml +, coreutils, git, gmp, nettools, openssl, readline, tzdata, libxml2, libyaml , boehmgc, libatomic_ops, pcre, libevent, libiconv, llvm, clang, which, zlib }: # We need multiple binaries as a given binary isn't always able to build -# (even slightly) older or newer version. +# (even slightly) older or newer versions. # - 0.26.1 can build 0.25.x and 0.26.x but not 0.27.x -# - 0.27.2 can build 0.27.x but not 0.25.x and 0.26.x +# - 0.27.2 can build 0.27.x but not 0.25.x, 0.26.x and 0.29.x # # We need to keep around at least the latest version released with a stable # NixOS @@ -19,7 +19,7 @@ let arch = archs."${stdenv.system}" or (throw "system ${stdenv.system} not supported"); - checkInputs = [ gmp openssl readline libxml2 libyaml tzdata ]; + checkInputs = [ git gmp openssl readline libxml2 libyaml ]; genericBinary = { version, sha256s, rel ? 1 }: stdenv.mkDerivation rec { @@ -38,8 +38,8 @@ let generic = { version, sha256, binary, doCheck ? true }: stdenv.mkDerivation rec { - inherit doCheck; - name = "crystal-${version}"; + pname = "crystal"; + inherit doCheck version; src = fetchFromGitHub { owner = "crystal-lang"; @@ -48,14 +48,30 @@ let inherit sha256; }; + # we are almost able to run the full test suite now postPatch = '' + substituteInPlace src/crystal/system/unix/time.cr \ + --replace /usr/share/zoneinfo ${tzdata}/share/zoneinfo + ln -s spec/compiler spec/std + + substituteInPlace spec/std/file_spec.cr \ + --replace '/bin/ls' '${coreutils}/bin/ls' \ + --replace '/usr/share' '/tmp/test' + substituteInPlace spec/std/process_spec.cr \ - --replace /bin/ /run/current-system/sw/bin/ + --replace '/bin/cat' '${coreutils}/bin/cat' \ + --replace '/bin/ls' '${coreutils}/bin/ls' \ + --replace '/usr/bin/env' '${coreutils}/bin/env' \ + --replace '"env"' '"${coreutils}/bin/env"' \ + --replace '"/usr"' '"/tmp"' + + substituteInPlace spec/std/system_spec.cr \ + --replace '`hostname`' '`${nettools}/bin/hostname`' ''; buildInputs = [ - boehmgc libatomic_ops pcre libevent + boehmgc libatomic_ops pcre libevent libyaml llvm zlib openssl ] ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv @@ -111,7 +127,11 @@ let checkTarget = "spec"; preCheck = '' + export HOME=/tmp + mkdir -p $HOME/test + export LIBRARY_PATH=${lib.makeLibraryPath checkInputs}:$LIBRARY_PATH + export PATH=${lib.makeBinPath checkInputs}:$PATH ''; meta = with lib; { @@ -142,6 +162,15 @@ in rec { }; }; + binaryCrystal_0_29 = genericBinary { + version = "0.29.0"; + sha256s = { + "x86_64-linux" = "1wrk29sfx35akg7hxwpdiikvl18wd40gq1kwirw7x522hnq7vlna"; + "i686-linux" = "1nx0piis2k3nn7kqiijqazzbvlaavhgvsln0l3dxmpfa4i4dz5h2"; + "x86_64-darwin" = "1fd0fbyf05abivnp3igjlrm2axf65n2wdmg4aq6nqj60ipc01rvd"; + }; + }; + crystal_0_25 = generic { version = "0.25.1"; sha256 = "15xmbkalsdk9qpc6wfpkly3sifgw6a4ai5jzlv78dh3jp7glmgyl"; @@ -163,5 +192,12 @@ in rec { binary = binaryCrystal_0_27; }; - crystal = crystal_0_27; + crystal_0_29 = generic { + version = "0.29.0"; + sha256 = "0v9l253b2x8yw6a43vvalywpwciwr094l3g5wakmndfrzak2s3zr"; + doCheck = false; # 6 checks are failing now + binary = binaryCrystal_0_29; + }; + + crystal = crystal_0_29; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6246cc4a5fb..eb95e09793d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7145,6 +7145,8 @@ in }) crystal_0_25 crystal_0_26 + crystal_0_27 + crystal_0_29 crystal; icr = callPackage ../development/tools/icr {};