From e0d0d1c0938f97f082f47d2af95990ef9b1fa900 Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Tue, 11 Oct 2022 14:41:41 +0300 Subject: [PATCH 01/19] crystal: 1.2 -> 1.6 --- .../development/compilers/crystal/default.nix | 102 ++++++++---------- pkgs/top-level/all-packages.nix | 5 +- 2 files changed, 48 insertions(+), 59 deletions(-) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index 88274ef73c945..372615dfec69c 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -2,7 +2,6 @@ , callPackage , fetchFromGitHub , fetchurl -, fetchpatch , lib # Dependencies , boehmgc @@ -10,11 +9,11 @@ , git , gmp , hostname -, libatomic_ops , libevent , libiconv , libxml2 , libyaml +, libffi , llvmPackages , makeWrapper , openssl @@ -31,21 +30,21 @@ let archs = { x86_64-linux = "linux-x86_64"; - i686-linux = "linux-i686"; - x86_64-darwin = "darwin-x86_64"; + #i686-linux = "linux-i686"; + #x86_64-darwin = "darwin-x86_64"; + x86_64-darwin = "darwin-universal"; aarch64-darwin = "darwin-universal"; - aarch64-linux = "linux-aarch64"; + #aarch64-linux = "linux-aarch64"; }; arch = archs.${stdenv.system} or (throw "system ${stdenv.system} not supported"); - isAarch64Darwin = stdenv.system == "aarch64-darwin"; - checkInputs = [ git gmp openssl readline libxml2 libyaml ]; + checkInputs = [ git gmp openssl readline libxml2 libyaml libffi ]; binaryUrl = version: rel: - if arch == archs.aarch64-linux then - "https://dev.alpinelinux.org/archive/crystal/crystal-${version}-aarch64-alpine-linux-musl.tar.gz" - else + # if arch == archs.aarch64-linux then + # "https://dev.alpinelinux.org/archive/crystal/crystal-${version}-aarch64-alpine-linux-musl.tar.gz" + # else "https://github.com/crystal-lang/crystal/releases/download/${version}/crystal-${version}-${toString rel}-${arch}.tar.gz"; genericBinary = { version, sha256s, rel ? 1 }: @@ -63,13 +62,10 @@ let tar --strip-components=1 -C $out -xf ${src} patchShebangs $out/bin/crystal ''; - - meta.broken = lib.versionOlder version "1.2.0" && isAarch64Darwin; }; commonBuildInputs = extraBuildInputs: [ boehmgc - libatomic_ops pcre libevent libyaml @@ -98,21 +94,12 @@ let inherit sha256; }; - patches = lib.optionals (lib.versionOlder version "1.2.0") [ - # add support for DWARF5 debuginfo, fixes builds on recent compilers - # the PR is 8 commits from 2019, so just fetch the whole thing - # and hope it doesn't change - (fetchpatch { - url = "https://github.com/crystal-lang/crystal/pull/11399.patch"; - sha256 = "sha256-CjNpkQQ2UREADmlyLUt7zbhjXf0rTjFhNbFYLwJKkc8="; - }) - ]; - outputs = [ "out" "lib" "bin" ]; postPatch = '' export TMP=$(mktemp -d) export HOME=$TMP + export TMPDIR=$TMP mkdir -p $HOME/test # Add dependency of crystal to docs to avoid issue on flag changes between releases @@ -123,8 +110,6 @@ let substituteInPlace src/crystal/system/unix/time.cr \ --replace /usr/share/zoneinfo ${tzdata}/share/zoneinfo - ln -sf spec/compiler spec/std - mkdir -p $TMP/crystal substituteInPlace spec/std/file_spec.cr \ @@ -163,12 +148,12 @@ let makeFlags = [ "CRYSTAL_CONFIG_VERSION=${version}" + "progress=1" ]; LLVM_CONFIG = "${llvmPackages.llvm.dev}/bin/llvm-config"; FLAGS = [ - "--release" "--single-module" # needed for deterministic builds ]; @@ -220,6 +205,7 @@ let export PATH=${lib.makeBinPath checkInputs}:$PATH ''; + passthru.buildBinary = binary; passthru.buildCrystalPackage = callPackage ./build-package.nix { crystal = compiler; }; @@ -230,48 +216,52 @@ let homepage = "https://crystal-lang.org/"; license = licenses.asl20; maintainers = with maintainers; [ david50407 manveru peterhoeg ]; - platforms = let archNames = builtins.attrNames archs; in - if (lib.versionOlder version "1.2.0") then remove "aarch64-darwin" archNames else archNames; + platforms = let archNames = builtins.attrNames archs; in archNames; }; }) ); in rec { - binaryCrystal_1_0 = genericBinary { - version = "1.0.0"; - sha256s = { - x86_64-linux = "1949argajiyqyq09824yj3wjyv88gd8wbf20xh895saqfykiq880"; - i686-linux = "0w0f4fwr2ijhx59i7ppicbh05hfmq7vffmgl7lal6im945m29vch"; - x86_64-darwin = "01n0rf8zh551vv8wq3h0ifnsai0fz9a77yq87xx81y9dscl9h099"; - aarch64-linux = "0sns7l4q3z82qi3dc2r4p63f4s8hvifqzgq56ykwyrvawynjhd53"; - }; - }; - - binaryCrystal_1_2 = genericBinary { - version = "1.2.0"; + #binaryCrystal_1_0 = genericBinary { + # version = "1.0.0"; + # sha256s = { + # x86_64-linux = "1949argajiyqyq09824yj3wjyv88gd8wbf20xh895saqfykiq880"; + # i686-linux = "0w0f4fwr2ijhx59i7ppicbh05hfmq7vffmgl7lal6im945m29vch"; + # x86_64-darwin = "01n0rf8zh551vv8wq3h0ifnsai0fz9a77yq87xx81y9dscl9h099"; + # aarch64-linux = "0sns7l4q3z82qi3dc2r4p63f4s8hvifqzgq56ykwyrvawynjhd53"; + # }; + #}; + + #binaryCrystal_1_2 = genericBinary { + # version = "1.2.0"; + # sha256s = { + # aarch64-darwin = "1hrs8cpjxdkcf8mr9qgzilwbg6bakq87sd4yydfsk2f4pqd6g7nf"; + # }; + #}; + + binaryCrystal_1_5 = genericBinary { + version = "1.5.0"; sha256s = { - aarch64-darwin = "1hrs8cpjxdkcf8mr9qgzilwbg6bakq87sd4yydfsk2f4pqd6g7nf"; + x86_64-linux = "sha256-YnNg8PyAUgLYAxAAfVA8ei/AdFsdsiEVN9f1TpqZQ0c="; + #i686-linux = ""; no prebuilt binaries since 1.2.0 + x86_64-darwin = "sha256-KU6+HLFlpYJSJS4F1zlHBeBt/rzxb7U57GmqRQnLm0Y=="; + #aarch64-linux = ""; not available yet + aarch64-darwin = "sha256-KU6+HLFlpYJSJS4F1zlHBeBt/rzxb7U57GmqRQnLm0Y=="; }; }; - crystal_1_0 = generic { - version = "1.0.0"; - sha256 = "sha256-RI+a3w6Rr+uc5jRf7xw0tOenR+q6qii/ewWfID6dbQ8="; - binary = binaryCrystal_1_0; - }; - - crystal_1_1 = generic { - version = "1.1.1"; - sha256 = "sha256-hhhT3reia8acZiPsflwfuD638Ll2JiXwMfES1TyGyNQ="; - binary = crystal_1_0; + crystal_1_5 = generic { + version = "1.5.0"; + sha256 = "sha256-twDWnJBLc5tvkg3HvbxXJsCPTMJr9vGvvHvfukMXGyA="; + binary = binaryCrystal_1_5; }; - crystal_1_2 = generic { - version = "1.2.2"; - sha256 = "sha256-nyOXhsutVBRdtJlJHe2dALl//BUXD1JeeQPgHU4SwiU="; - binary = if isAarch64Darwin then binaryCrystal_1_2 else crystal_1_1; + crystal_1_6 = generic { + version = "1.6.0"; + sha256 = "sha256-B6Pq2J1r+PbYT1C+2u9rNzRR5zOnbmN1/RG7mVpVHQk="; + binary = binaryCrystal_1_5; }; - crystal = crystal_1_2; + crystal = crystal_1_6; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a63f783a98e02..b045cd4f8d2cd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13444,9 +13444,8 @@ with pkgs; inherit (callPackages ../development/compilers/crystal { llvmPackages = if stdenv.system == "aarch64-darwin" then llvmPackages_11 else llvmPackages_10; }) - crystal_1_0 - crystal_1_1 - crystal_1_2 + crystal_1_5 + crystal_1_6 crystal; crystal2nix = callPackage ../development/compilers/crystal2nix { }; From 9b6172aa2deb23c280e250fbf50781bc51aa5132 Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Sat, 22 Oct 2022 23:37:53 +0300 Subject: [PATCH 02/19] fix: re-enable 1.0.x - 1.2.x feat: bump 1.6.x to 1.6.1 fix: fetch 12601 patch for 1.3.x-1.6.0 fix: darwin url for versions < 1.2.0 --- .../development/compilers/crystal/default.nix | 96 ++++++++++++++----- pkgs/top-level/all-packages.nix | 3 + 2 files changed, 75 insertions(+), 24 deletions(-) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index 372615dfec69c..d761431326fe2 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -2,6 +2,7 @@ , callPackage , fetchFromGitHub , fetchurl +, fetchpatch , lib # Dependencies , boehmgc @@ -9,6 +10,7 @@ , git , gmp , hostname +, libatomic_ops , libevent , libiconv , libxml2 @@ -30,21 +32,23 @@ let archs = { x86_64-linux = "linux-x86_64"; - #i686-linux = "linux-i686"; - #x86_64-darwin = "darwin-x86_64"; + i686-linux = "linux-i686"; x86_64-darwin = "darwin-universal"; aarch64-darwin = "darwin-universal"; - #aarch64-linux = "linux-aarch64"; + aarch64-linux = "linux-aarch64"; }; arch = archs.${stdenv.system} or (throw "system ${stdenv.system} not supported"); + isAarch64Darwin = stdenv.system == "aarch64-darwin"; checkInputs = [ git gmp openssl readline libxml2 libyaml libffi ]; binaryUrl = version: rel: - # if arch == archs.aarch64-linux then - # "https://dev.alpinelinux.org/archive/crystal/crystal-${version}-aarch64-alpine-linux-musl.tar.gz" - # else + if arch == archs.aarch64-linux then + "https://dev.alpinelinux.org/archive/crystal/crystal-${version}-aarch64-alpine-linux-musl.tar.gz" + else if arch == archs.x86_64-darwin && lib.versionOlder version "1.2.0" then + "https://github.com/crystal-lang/crystal/releases/download/${version}/crystal-${version}-${toString rel}-darwin-x86_64.tar.gz" + else "https://github.com/crystal-lang/crystal/releases/download/${version}/crystal-${version}-${toString rel}-${arch}.tar.gz"; genericBinary = { version, sha256s, rel ? 1 }: @@ -62,6 +66,8 @@ let tar --strip-components=1 -C $out -xf ${src} patchShebangs $out/bin/crystal ''; + + meta.broken = lib.versionOlder version "1.2.0" && isAarch64Darwin; }; commonBuildInputs = extraBuildInputs: [ @@ -94,6 +100,25 @@ let inherit sha256; }; + patches = [ ] + ++ lib.optionals (lib.versionOlder version "1.2.0") [ + # add support for DWARF5 debuginfo, fixes builds on recent compilers + # the PR is 8 commits from 2019, so just fetch the whole thing + # and hope it doesn't change + (fetchpatch { + url = "https://github.com/crystal-lang/crystal/pull/11399.patch"; + sha256 = "sha256-CjNpkQQ2UREADmlyLUt7zbhjXf0rTjFhNbFYLwJKkc8="; + }) + ] ++ lib.optionals (lib.versionAtLeast version "1.3.0" && lib.versionOlder version "1.6.1") [ + # fixes an issue that prevented tests from passing when ran with + # the --release flag + # the PR has been merged since version 1.6.1 + (fetchpatch { + url = "https://github.com/crystal-lang/crystal/pull/12601.patch"; + sha256 = "sha256-3NiUC4EyP/jSn62sv38eieKcVw9zUfRB78aAvnxV57E="; + }) + ]; + outputs = [ "out" "lib" "bin" ]; postPatch = '' @@ -148,6 +173,7 @@ let makeFlags = [ "CRYSTAL_CONFIG_VERSION=${version}" + "release=1" "progress=1" ]; @@ -216,29 +242,30 @@ let homepage = "https://crystal-lang.org/"; license = licenses.asl20; maintainers = with maintainers; [ david50407 manveru peterhoeg ]; - platforms = let archNames = builtins.attrNames archs; in archNames; + platforms = let archNames = builtins.attrNames archs; in + if (lib.versionOlder version "1.2.0") then remove "aarch64-darwin" archNames else archNames; }; }) ); in rec { - #binaryCrystal_1_0 = genericBinary { - # version = "1.0.0"; - # sha256s = { - # x86_64-linux = "1949argajiyqyq09824yj3wjyv88gd8wbf20xh895saqfykiq880"; - # i686-linux = "0w0f4fwr2ijhx59i7ppicbh05hfmq7vffmgl7lal6im945m29vch"; - # x86_64-darwin = "01n0rf8zh551vv8wq3h0ifnsai0fz9a77yq87xx81y9dscl9h099"; - # aarch64-linux = "0sns7l4q3z82qi3dc2r4p63f4s8hvifqzgq56ykwyrvawynjhd53"; - # }; - #}; - - #binaryCrystal_1_2 = genericBinary { - # version = "1.2.0"; - # sha256s = { - # aarch64-darwin = "1hrs8cpjxdkcf8mr9qgzilwbg6bakq87sd4yydfsk2f4pqd6g7nf"; - # }; - #}; + binaryCrystal_1_0 = genericBinary { + version = "1.0.0"; + sha256s = { + x86_64-linux = "1949argajiyqyq09824yj3wjyv88gd8wbf20xh895saqfykiq880"; + i686-linux = "0w0f4fwr2ijhx59i7ppicbh05hfmq7vffmgl7lal6im945m29vch"; + x86_64-darwin = "01n0rf8zh551vv8wq3h0ifnsai0fz9a77yq87xx81y9dscl9h099"; + aarch64-linux = "0sns7l4q3z82qi3dc2r4p63f4s8hvifqzgq56ykwyrvawynjhd53"; + }; + }; + + binaryCrystal_1_2 = genericBinary { + version = "1.2.0"; + sha256s = { + aarch64-darwin = "1hrs8cpjxdkcf8mr9qgzilwbg6bakq87sd4yydfsk2f4pqd6g7nf"; + }; + }; binaryCrystal_1_5 = genericBinary { version = "1.5.0"; @@ -251,6 +278,27 @@ rec { }; }; + crystal_1_0 = generic { + version = "1.0.0"; + sha256 = "sha256-RI+a3w6Rr+uc5jRf7xw0tOenR+q6qii/ewWfID6dbQ8="; + binary = binaryCrystal_1_0; + extraBuildInputs = [ libatomic_ops ]; + }; + + crystal_1_1 = generic { + version = "1.1.1"; + sha256 = "sha256-hhhT3reia8acZiPsflwfuD638Ll2JiXwMfES1TyGyNQ="; + binary = crystal_1_0; + extraBuildInputs = [ libatomic_ops ]; + }; + + crystal_1_2 = generic { + version = "1.2.2"; + sha256 = "sha256-nyOXhsutVBRdtJlJHe2dALl//BUXD1JeeQPgHU4SwiU="; + binary = if isAarch64Darwin then binaryCrystal_1_2 else crystal_1_1; + extraBuildInputs = [ libatomic_ops ]; + }; + crystal_1_5 = generic { version = "1.5.0"; sha256 = "sha256-twDWnJBLc5tvkg3HvbxXJsCPTMJr9vGvvHvfukMXGyA="; @@ -258,7 +306,7 @@ rec { }; crystal_1_6 = generic { - version = "1.6.0"; + version = "1.6.1"; sha256 = "sha256-B6Pq2J1r+PbYT1C+2u9rNzRR5zOnbmN1/RG7mVpVHQk="; binary = binaryCrystal_1_5; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b045cd4f8d2cd..49d1abbf9d05f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13444,6 +13444,9 @@ with pkgs; inherit (callPackages ../development/compilers/crystal { llvmPackages = if stdenv.system == "aarch64-darwin" then llvmPackages_11 else llvmPackages_10; }) + crystal_1_0 + crystal_1_1 + crystal_1_2 crystal_1_5 crystal_1_6 crystal; From ffa22c68ea210b041efe56d7a0bffc194711fe64 Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Sun, 23 Oct 2022 00:19:47 +0300 Subject: [PATCH 03/19] fix: mark broken if > 1.3.x and 1686-linux or > 1.5.x and aarch64-linux --- pkgs/development/compilers/crystal/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index d761431326fe2..67b9296b5d686 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -67,7 +67,7 @@ let patchShebangs $out/bin/crystal ''; - meta.broken = lib.versionOlder version "1.2.0" && isAarch64Darwin; + meta.broken = (lib.versionOlder version "1.2.0" && isAarch64Darwin) || (lib.versionAtLeast version "1.3.0" && stdenv.system == "i686-linux") || (lib.versionAtLeast version "1.5.0" && stdenv.system == "aarch64-linux"); }; commonBuildInputs = extraBuildInputs: [ From 89dab4d1843129be23308c4ae6587ad4696d71f7 Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Sat, 12 Nov 2022 12:24:43 +0200 Subject: [PATCH 04/19] feat: bump 1.6.x to 1.6.2 --- pkgs/development/compilers/crystal/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index 67b9296b5d686..ff04bc9f67086 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -306,8 +306,8 @@ rec { }; crystal_1_6 = generic { - version = "1.6.1"; - sha256 = "sha256-B6Pq2J1r+PbYT1C+2u9rNzRR5zOnbmN1/RG7mVpVHQk="; + version = "1.6.2"; + sha256 = "sha256-WgU6Y8ww1IYyB0vd5tXwmWBEL5RiPjHA7YzPd21jlsY="; binary = binaryCrystal_1_5; }; From 4bd897e55011adf9662a76f10ba2e15cc1e68ecf Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Sat, 12 Nov 2022 12:27:54 +0200 Subject: [PATCH 05/19] fix: add another patch for < 1.6.0 so 12601 gets applied successfully --- pkgs/development/compilers/crystal/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index ff04bc9f67086..db0ac01891d91 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -109,6 +109,12 @@ let url = "https://github.com/crystal-lang/crystal/pull/11399.patch"; sha256 = "sha256-CjNpkQQ2UREADmlyLUt7zbhjXf0rTjFhNbFYLwJKkc8="; }) + ] ++ lib.optionals (lib.versionAtLeast version "1.3.0" && lib.versionOlder version "1.6.0") [ + # needed for #12601 to get applied successfully + (fetchpatch { + url = "https://github.com/crystal-lang/crystal/commit/bf4009dacbf67a63a1cbaffddbdc99549bb70a03.patch"; + sha256 = "sha256-KpMA5Zdy0QI+HcfuZVRT2gLPS7oH2D4MsdYEnHGDt/0="; + }) ] ++ lib.optionals (lib.versionAtLeast version "1.3.0" && lib.versionOlder version "1.6.1") [ # fixes an issue that prevented tests from passing when ran with # the --release flag From b8ae9f94aa85b154963779cc5e75f1937525a8bd Mon Sep 17 00:00:00 2001 From: ento <21108+ento@users.noreply.github.com> Date: Sat, 12 Nov 2022 12:32:28 +0200 Subject: [PATCH 06/19] fix: supported platforms per version --- pkgs/development/compilers/crystal/default.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index db0ac01891d91..9423e9c7e4fce 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -67,7 +67,7 @@ let patchShebangs $out/bin/crystal ''; - meta.broken = (lib.versionOlder version "1.2.0" && isAarch64Darwin) || (lib.versionAtLeast version "1.3.0" && stdenv.system == "i686-linux") || (lib.versionAtLeast version "1.5.0" && stdenv.system == "aarch64-linux"); + meta.platforms = lib.attrNames sha256s; }; commonBuildInputs = extraBuildInputs: [ @@ -243,13 +243,11 @@ let }; meta = with lib; { - broken = stdenv.isDarwin; + inherit (binary.meta) platforms; description = "A compiled language with Ruby like syntax and type inference"; homepage = "https://crystal-lang.org/"; license = licenses.asl20; maintainers = with maintainers; [ david50407 manveru peterhoeg ]; - platforms = let archNames = builtins.attrNames archs; in - if (lib.versionOlder version "1.2.0") then remove "aarch64-darwin" archNames else archNames; }; }) ); From ce5ce4bfefca34ef220c242c21d4de1858bdf5da Mon Sep 17 00:00:00 2001 From: "M. Ian Graham" <704580+miangraham@users.noreply.github.com> Date: Mon, 21 Nov 2022 04:31:27 +0200 Subject: [PATCH 07/19] fix: downstreams --- pkgs/development/tools/ameba/default.nix | 4 ++-- pkgs/top-level/all-packages.nix | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/ameba/default.nix b/pkgs/development/tools/ameba/default.nix index 4239f5c0056a9..27068cbc4c49f 100644 --- a/pkgs/development/tools/ameba/default.nix +++ b/pkgs/development/tools/ameba/default.nix @@ -2,13 +2,13 @@ crystal.buildCrystalPackage rec { pname = "ameba"; - version = "1.0.1"; + version = "1.3.1"; src = fetchFromGitHub { owner = "crystal-ameba"; repo = "ameba"; rev = "v${version}"; - hash = "sha256-dvhGk6IbSV3pxtoIV7+0+qf47hz2TooPhsSwFd2+xkw="; + hash = "sha256-SZ2sBQeZgtPOYioH9eK5MveFtWVGPvgKMrqsCfjoRGM="; }; format = "make"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 49d1abbf9d05f..ed61424497ce7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13455,7 +13455,7 @@ with pkgs; icr = callPackage ../development/tools/icr { }; - scry = callPackage ../development/tools/scry { }; + scry = callPackage ../development/tools/scry { crystal = crystal_1_2; }; dasm = callPackage ../development/compilers/dasm { }; @@ -14500,7 +14500,7 @@ with pkgs; millet = callPackage ../development/tools/millet {}; - mint = callPackage ../development/compilers/mint { }; + mint = callPackage ../development/compilers/mint { crystal = crystal_1_2; }; mitscheme = callPackage ../development/compilers/mit-scheme { stdenv = gcc10StdenvCompat; texLive = texlive.combine { inherit (texlive) scheme-small epsf texinfo; }; }; From 8a4536cba8feb567471da7d9174c6523eb91e375 Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Mon, 21 Nov 2022 21:04:41 +0200 Subject: [PATCH 08/19] fix: make kakoune-cr use crystal 1.2 Co-authored-by: M. Ian Graham <704580+miangraham@users.noreply.github.com> --- pkgs/top-level/all-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ed61424497ce7..a89076f081c2e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8134,7 +8134,7 @@ with pkgs; inherit (darwin.apple_sdk.frameworks) Security SystemConfiguration; }; - kakoune-cr = callPackage ../tools/misc/kakoune-cr { }; + kakoune-cr = callPackage ../tools/misc/kakoune-cr { crystal = crystal_1_2; }; kbdd = callPackage ../applications/window-managers/kbdd { }; From b1be734009b3b9aa217d8561846fce9c9beafb37 Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Mon, 21 Nov 2022 22:30:19 +0200 Subject: [PATCH 09/19] fix: disable ffi on < 1.6.1 instead of patching the spec --- pkgs/development/compilers/crystal/default.nix | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index 9423e9c7e4fce..4fac18debfc9f 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -109,20 +109,6 @@ let url = "https://github.com/crystal-lang/crystal/pull/11399.patch"; sha256 = "sha256-CjNpkQQ2UREADmlyLUt7zbhjXf0rTjFhNbFYLwJKkc8="; }) - ] ++ lib.optionals (lib.versionAtLeast version "1.3.0" && lib.versionOlder version "1.6.0") [ - # needed for #12601 to get applied successfully - (fetchpatch { - url = "https://github.com/crystal-lang/crystal/commit/bf4009dacbf67a63a1cbaffddbdc99549bb70a03.patch"; - sha256 = "sha256-KpMA5Zdy0QI+HcfuZVRT2gLPS7oH2D4MsdYEnHGDt/0="; - }) - ] ++ lib.optionals (lib.versionAtLeast version "1.3.0" && lib.versionOlder version "1.6.1") [ - # fixes an issue that prevented tests from passing when ran with - # the --release flag - # the PR has been merged since version 1.6.1 - (fetchpatch { - url = "https://github.com/crystal-lang/crystal/pull/12601.patch"; - sha256 = "sha256-3NiUC4EyP/jSn62sv38eieKcVw9zUfRB78aAvnxV57E="; - }) ]; outputs = [ "out" "lib" "bin" ]; @@ -187,6 +173,9 @@ let FLAGS = [ "--single-module" # needed for deterministic builds + ] ++ lib.optionals (lib.versionAtLeast version "1.3.0" && lib.versionOlder version "1.6.1") [ + # ffi is only used by the interpreter and its spec are broken on < 1.6.1 + "-Dwithout_ffi" ]; # This makes sure we don't keep depending on the previous version of From 5564346d68f6696e18dab41cf3546325e7b4647a Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Mon, 21 Nov 2022 22:30:48 +0200 Subject: [PATCH 10/19] feat: use release mode only on the compiler and not the specs --- pkgs/development/compilers/crystal/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index 4fac18debfc9f..c1d6b5bf83adf 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -87,7 +87,7 @@ let , binary , doCheck ? true , extraBuildInputs ? [ ] - , buildFlags ? [ "all" "docs" ] + , buildFlags ? [ "all" "docs" "release=1"] }: lib.fix (compiler: stdenv.mkDerivation { pname = "crystal"; @@ -165,7 +165,6 @@ let makeFlags = [ "CRYSTAL_CONFIG_VERSION=${version}" - "release=1" "progress=1" ]; From 392df0cf61d6d2ea4a370d266a32dad0eb61adda Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Mon, 21 Nov 2022 22:44:54 +0200 Subject: [PATCH 11/19] feat: 1.5.0 -> 1.5.1 and enable aarch64-linux builds --- pkgs/development/compilers/crystal/default.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index c1d6b5bf83adf..548c72cab7ec1 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -260,13 +260,13 @@ rec { }; binaryCrystal_1_5 = genericBinary { - version = "1.5.0"; + version = "1.5.1"; sha256s = { - x86_64-linux = "sha256-YnNg8PyAUgLYAxAAfVA8ei/AdFsdsiEVN9f1TpqZQ0c="; + x86_64-linux = "sha256-pHXD2Z2+Dy1actRx+iXgPBJLWZ5HM27tdGlztLTXh7w="; #i686-linux = ""; no prebuilt binaries since 1.2.0 - x86_64-darwin = "sha256-KU6+HLFlpYJSJS4F1zlHBeBt/rzxb7U57GmqRQnLm0Y=="; - #aarch64-linux = ""; not available yet - aarch64-darwin = "sha256-KU6+HLFlpYJSJS4F1zlHBeBt/rzxb7U57GmqRQnLm0Y=="; + x86_64-darwin = "sha256-QywvyZIkf2Ztt+VfsVUJRBUQgxpyvro0r/otdrby4JI="; + aarch64-linux = "sha256-SdgHd3e5R+/gF7OYz3MEaC7ezI/jcyfpCWmZ3qPeRBI="; + aarch64-darwin = "sha256-QywvyZIkf2Ztt+VfsVUJRBUQgxpyvro0r/otdrby4JI="; }; }; @@ -292,7 +292,7 @@ rec { }; crystal_1_5 = generic { - version = "1.5.0"; + version = "1.5.1"; sha256 = "sha256-twDWnJBLc5tvkg3HvbxXJsCPTMJr9vGvvHvfukMXGyA="; binary = binaryCrystal_1_5; }; From 159ddb54957e58b52588ce592f995f57f02f2a77 Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Tue, 22 Nov 2022 04:20:28 +0200 Subject: [PATCH 12/19] feat: get rid of unused versions feat: use 1.2.2 to build 1_2 and 1_6 feat: use llvm 13 --- .../development/compilers/crystal/default.nix | 52 +++---------------- pkgs/top-level/all-packages.nix | 5 +- 2 files changed, 8 insertions(+), 49 deletions(-) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index 548c72cab7ec1..f8765466328bc 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -242,65 +242,27 @@ let in rec { - binaryCrystal_1_0 = genericBinary { - version = "1.0.0"; - sha256s = { - x86_64-linux = "1949argajiyqyq09824yj3wjyv88gd8wbf20xh895saqfykiq880"; - i686-linux = "0w0f4fwr2ijhx59i7ppicbh05hfmq7vffmgl7lal6im945m29vch"; - x86_64-darwin = "01n0rf8zh551vv8wq3h0ifnsai0fz9a77yq87xx81y9dscl9h099"; - aarch64-linux = "0sns7l4q3z82qi3dc2r4p63f4s8hvifqzgq56ykwyrvawynjhd53"; - }; - }; - binaryCrystal_1_2 = genericBinary { - version = "1.2.0"; - sha256s = { - aarch64-darwin = "1hrs8cpjxdkcf8mr9qgzilwbg6bakq87sd4yydfsk2f4pqd6g7nf"; - }; - }; - - binaryCrystal_1_5 = genericBinary { - version = "1.5.1"; + version = "1.2.2"; sha256s = { - x86_64-linux = "sha256-pHXD2Z2+Dy1actRx+iXgPBJLWZ5HM27tdGlztLTXh7w="; - #i686-linux = ""; no prebuilt binaries since 1.2.0 - x86_64-darwin = "sha256-QywvyZIkf2Ztt+VfsVUJRBUQgxpyvro0r/otdrby4JI="; - aarch64-linux = "sha256-SdgHd3e5R+/gF7OYz3MEaC7ezI/jcyfpCWmZ3qPeRBI="; - aarch64-darwin = "sha256-QywvyZIkf2Ztt+VfsVUJRBUQgxpyvro0r/otdrby4JI="; + x86_64-linux = "sha256-sW5nhihW/6Dkq95i3vJNWs2D1CtQhujhxVbgQCAas6E="; + aarch64-darwin = "sha256-4VB4yYGl1/YeYSsHOZq7fdeQ8IQMfloAPhEU0iKrvxs="; + x86_64-darwin = "sha256-4VB4yYGl1/YeYSsHOZq7fdeQ8IQMfloAPhEU0iKrvxs="; + aarch64-linux = "sha256-QgPKUDFyodqY1+b85AybSpbbr0RmfISdNpB08Wf34jo="; }; }; - crystal_1_0 = generic { - version = "1.0.0"; - sha256 = "sha256-RI+a3w6Rr+uc5jRf7xw0tOenR+q6qii/ewWfID6dbQ8="; - binary = binaryCrystal_1_0; - extraBuildInputs = [ libatomic_ops ]; - }; - - crystal_1_1 = generic { - version = "1.1.1"; - sha256 = "sha256-hhhT3reia8acZiPsflwfuD638Ll2JiXwMfES1TyGyNQ="; - binary = crystal_1_0; - extraBuildInputs = [ libatomic_ops ]; - }; - crystal_1_2 = generic { version = "1.2.2"; sha256 = "sha256-nyOXhsutVBRdtJlJHe2dALl//BUXD1JeeQPgHU4SwiU="; - binary = if isAarch64Darwin then binaryCrystal_1_2 else crystal_1_1; + binary = binaryCrystal_1_2; extraBuildInputs = [ libatomic_ops ]; }; - crystal_1_5 = generic { - version = "1.5.1"; - sha256 = "sha256-twDWnJBLc5tvkg3HvbxXJsCPTMJr9vGvvHvfukMXGyA="; - binary = binaryCrystal_1_5; - }; - crystal_1_6 = generic { version = "1.6.2"; sha256 = "sha256-WgU6Y8ww1IYyB0vd5tXwmWBEL5RiPjHA7YzPd21jlsY="; - binary = binaryCrystal_1_5; + binary = binaryCrystal_1_2; }; crystal = crystal_1_6; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a89076f081c2e..c8c75c6101385 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13442,12 +13442,9 @@ with pkgs; copper = callPackage ../development/compilers/copper {}; inherit (callPackages ../development/compilers/crystal { - llvmPackages = if stdenv.system == "aarch64-darwin" then llvmPackages_11 else llvmPackages_10; + llvmPackages = llvmPackages_13; }) - crystal_1_0 - crystal_1_1 crystal_1_2 - crystal_1_5 crystal_1_6 crystal; From eab3f4d896caa291fbe824efa9e2e1f2cbf6ed16 Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Sun, 18 Dec 2022 16:53:29 +0200 Subject: [PATCH 13/19] fix: darwin compile errors Co-authored-by: Brian J. Cardiff <459923+bcardiff@users.noreply.github.com> --- pkgs/development/compilers/crystal/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index f8765466328bc..720e64469cdd8 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -149,6 +149,11 @@ let # See https://github.com/crystal-lang/crystal/issues/8629 substituteInPlace spec/std/socket/udp_socket_spec.cr \ --replace 'it "joins and transmits to multicast groups"' 'pending "joins and transmits to multicast groups"' + + '' + lib.optionalString (stdenv.isDarwin && versionOlder version "1.3.0") '' + # See https://github.com/NixOS/nixpkgs/pull/195606#issuecomment-1356491277 + substituteInPlace spec/compiler/loader/unix_spec.cr \ + --replace 'it "parses file paths"' 'pending "parses file paths"' ''; # Defaults are 4 @@ -156,6 +161,7 @@ let export CRYSTAL_WORKERS=$NIX_BUILD_CORES export threads=$NIX_BUILD_CORES export CRYSTAL_CACHE_DIR=$TMP + export MACOSX_DEPLOYMENT_TARGET="10.11" ''; From 3efc4e5f0365462048da25bed62d1b237f733a55 Mon Sep 17 00:00:00 2001 From: GeopJr Date: Sun, 18 Dec 2022 17:22:59 +0200 Subject: [PATCH 14/19] fix: versionOlder => lib.versionOlder --- pkgs/development/compilers/crystal/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index 720e64469cdd8..f1143572956b7 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -150,7 +150,7 @@ let substituteInPlace spec/std/socket/udp_socket_spec.cr \ --replace 'it "joins and transmits to multicast groups"' 'pending "joins and transmits to multicast groups"' - '' + lib.optionalString (stdenv.isDarwin && versionOlder version "1.3.0") '' + '' + lib.optionalString (stdenv.isDarwin && lib.versionOlder version "1.3.0") '' # See https://github.com/NixOS/nixpkgs/pull/195606#issuecomment-1356491277 substituteInPlace spec/compiler/loader/unix_spec.cr \ --replace 'it "parses file paths"' 'pending "parses file paths"' From 44073f6d1667ba1c723a6240b91ebacb3e72ee05 Mon Sep 17 00:00:00 2001 From: GeopJr Date: Sun, 18 Dec 2022 18:42:51 +0200 Subject: [PATCH 15/19] fix: version limits on unix_spec --- pkgs/development/compilers/crystal/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index f1143572956b7..ef835ff69f0a3 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -150,7 +150,7 @@ let substituteInPlace spec/std/socket/udp_socket_spec.cr \ --replace 'it "joins and transmits to multicast groups"' 'pending "joins and transmits to multicast groups"' - '' + lib.optionalString (stdenv.isDarwin && lib.versionOlder version "1.3.0") '' + '' + lib.optionalString (stdenv.isDarwin && lib.versionAtLeast version "1.3.0" && lib.versionOlder version "1.7.0") '' # See https://github.com/NixOS/nixpkgs/pull/195606#issuecomment-1356491277 substituteInPlace spec/compiler/loader/unix_spec.cr \ --replace 'it "parses file paths"' 'pending "parses file paths"' @@ -161,7 +161,7 @@ let export CRYSTAL_WORKERS=$NIX_BUILD_CORES export threads=$NIX_BUILD_CORES export CRYSTAL_CACHE_DIR=$TMP - export MACOSX_DEPLOYMENT_TARGET="10.11" + export MACOSX_DEPLOYMENT_TARGET=10.11 ''; From a979bd9214a622ef444a20e2023d37c268c43ea4 Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Wed, 21 Dec 2022 16:30:37 +0200 Subject: [PATCH 16/19] fix(tzdata): prepend to ZONE_SOURCES instead of substituting in place --- pkgs/development/compilers/crystal/default.nix | 11 +++++++---- pkgs/development/compilers/crystal/tzdata.patch | 12 ++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/compilers/crystal/tzdata.patch diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index ef835ff69f0a3..e642e8ee7bc59 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -4,6 +4,7 @@ , fetchurl , fetchpatch , lib +, substituteAll # Dependencies , boehmgc , coreutils @@ -100,7 +101,12 @@ let inherit sha256; }; - patches = [ ] + patches = [ + (substituteAll { + src = ./tzdata.patch; + inherit tzdata; + }) + ] ++ lib.optionals (lib.versionOlder version "1.2.0") [ # add support for DWARF5 debuginfo, fixes builds on recent compilers # the PR is 8 commits from 2019, so just fetch the whole thing @@ -124,9 +130,6 @@ let substituteInPlace Makefile \ --replace 'docs: ## Generate standard library documentation' 'docs: crystal ## Generate standard library documentation' - substituteInPlace src/crystal/system/unix/time.cr \ - --replace /usr/share/zoneinfo ${tzdata}/share/zoneinfo - mkdir -p $TMP/crystal substituteInPlace spec/std/file_spec.cr \ diff --git a/pkgs/development/compilers/crystal/tzdata.patch b/pkgs/development/compilers/crystal/tzdata.patch new file mode 100644 index 0000000000000..b687336753ad9 --- /dev/null +++ b/pkgs/development/compilers/crystal/tzdata.patch @@ -0,0 +1,12 @@ +diff --git a/src/crystal/system/unix/time.cr b/src/crystal/system/unix/time.cr +index 333b66075..1c29a0e55 100644 +--- a/src/crystal/system/unix/time.cr ++++ b/src/crystal/system/unix/time.cr +@@ -43,6 +43,7 @@ module Crystal::System::Time + # Many systems use /usr/share/zoneinfo, Solaris 2 has + # /usr/share/lib/zoneinfo, IRIX 6 has /usr/lib/locale/TZ. + ZONE_SOURCES = { ++ "@tzdata@/share/zoneinfo/", + "/usr/share/zoneinfo/", + "/usr/share/lib/zoneinfo/", + "/usr/lib/locale/TZ/", From f29f0d07982c8ec766adef7106b69c5af42882f8 Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Mon, 9 Jan 2023 22:41:18 +0200 Subject: [PATCH 17/19] feat: 1.7.0 --- pkgs/development/compilers/crystal/default.nix | 8 ++++---- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index e642e8ee7bc59..24832bdaa1061 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -268,11 +268,11 @@ rec { extraBuildInputs = [ libatomic_ops ]; }; - crystal_1_6 = generic { - version = "1.6.2"; - sha256 = "sha256-WgU6Y8ww1IYyB0vd5tXwmWBEL5RiPjHA7YzPd21jlsY="; + crystal_1_7 = generic { + version = "1.7.0"; + sha256 = "sha256-no6b6PGmc/dhicMLVZIHwi/HOKCVTiWHZ5I+ImBjoQc="; binary = binaryCrystal_1_2; }; - crystal = crystal_1_6; + crystal = crystal_1_7; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3b22223300cfe..7d4bc26d16d5f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13892,7 +13892,7 @@ with pkgs; llvmPackages = llvmPackages_13; }) crystal_1_2 - crystal_1_6 + crystal_1_7 crystal; crystal2nix = callPackage ../development/compilers/crystal2nix { }; From 52c3f58bad18601cee8bbef1fe1cb78f5c305c4e Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Tue, 17 Jan 2023 20:51:42 +0200 Subject: [PATCH 18/19] feat: 1.7.1 --- pkgs/development/compilers/crystal/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index 24832bdaa1061..af4d3a19337c8 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -269,8 +269,8 @@ rec { }; crystal_1_7 = generic { - version = "1.7.0"; - sha256 = "sha256-no6b6PGmc/dhicMLVZIHwi/HOKCVTiWHZ5I+ImBjoQc="; + version = "1.7.1"; + sha256 = "sha256-PaeqqY+rSxntzz+30mJnjxzj2Xgu/BNkolw3Y30aZgk="; binary = binaryCrystal_1_2; }; From 3597e7e518b2a1c8f0ce3a2324e7fab687194f9f Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Tue, 17 Jan 2023 22:14:03 +0200 Subject: [PATCH 19/19] fix(darwin): use sdk 11 --- pkgs/top-level/all-packages.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3e4c50b01490d..ce7abad052b82 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13973,6 +13973,7 @@ with pkgs; inherit (callPackages ../development/compilers/crystal { llvmPackages = llvmPackages_13; + stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv; }) crystal_1_2 crystal_1_7