diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ab58c766f7d0..7fff163119f3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15148,22 +15148,35 @@ with pkgs; # Below, the classic self-bootstrapping process cbqn-bootstrap = lib.dontRecurseIntoAttrs { + # Use clang to compile CBQN if we aren't already. + # CBQN's upstream primarily targets and tests clang which means using gcc + # will result in slower binaries and on some platforms failing/broken builds. + # See https://github.com/dzaima/CBQN/issues/12. + # + # Known issues: + # + # * CBQN using gcc is broken at runtime on i686 due to + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58416, + # * CBQN uses some CPP macros gcc doesn't like for aarch64. + stdenv = if !stdenv.cc.isClang then clangStdenv else stdenv; + mbqn-source = buildPackages.mbqn.src; phase0 = callPackage ../development/interpreters/bqn/cbqn { + inherit (cbqn-bootstrap) stdenv; genBytecode = false; bqn-path = null; mbqn-source = null; }; phase1 = callPackage ../development/interpreters/bqn/cbqn { - inherit (cbqn-bootstrap) mbqn-source; + inherit (cbqn-bootstrap) mbqn-source stdenv; genBytecode = true; bqn-path = "${buildPackages.cbqn-bootstrap.phase0}/bin/cbqn"; }; phase2 = callPackage ../development/interpreters/bqn/cbqn { - inherit (cbqn-bootstrap) mbqn-source; + inherit (cbqn-bootstrap) mbqn-source stdenv; genBytecode = true; bqn-path = "${buildPackages.cbqn-bootstrap.phase1}/bin/cbqn"; };