nixpkgs/pkgs/development/compilers/chez-racket/shared.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

41 lines
1.1 KiB
Nix

args:
{ stdenv, lib, fetchFromGitHub, coreutils, cctools, darwin
, ncurses, libiconv, libX11, zlib, lz4
}:
stdenv.mkDerivation (args // {
version = "unstable-2021-12-11";
src = fetchFromGitHub {
owner = "racket";
repo = "ChezScheme";
rev = "8846c96b08561f05a937d5ecfe4edc96cc99be39";
sha256 = "IYJQzT88T8kFahx2BusDOyzz6lQDCbZIfSz9rZoNF7A=";
fetchSubmodules = true;
};
prePatch = ''
rm -rf zlib/*.c lz4/lib/*.c
'';
postPatch = ''
export ZLIB="$(find ${zlib.out}/lib -type f | sort | head -n1)"
export LZ4="$(find ${lz4.out}/lib -type f | sort | head -n1)"
'';
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin ([ cctools darwin.autoSignDarwinBinariesHook ]);
buildInputs = [ libiconv libX11 lz4 ncurses zlib ];
enableParallelBuilding = true;
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-Wno-error=format-truncation";
meta = {
description = "Fork of Chez Scheme for Racket";
homepage = "https://github.com/racket/ChezScheme";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ l-as ];
platforms = lib.platforms.unix;
};
})