nixpkgs/pkgs/development/interpreters/icon-lang/default.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

48 lines
1.4 KiB
Nix

{ lib, stdenv
, fetchFromGitHub
, libX11
, libXt
, withGraphics ? true
}:
stdenv.mkDerivation rec {
pname = "icon-lang";
version = "unstable-2020-02-05";
src = fetchFromGitHub {
owner = "gtownsend";
repo = "icon";
rev = "829cff33de4a21546fb269de3ef5acd7b4f0c0c7";
sha256 = "1lj2f13pbaajcy4v3744bz46rghhw5sv4dwwfnzhsllbj5gnjsv2";
};
buildInputs = lib.optionals withGraphics [ libX11 libXt ];
configurePhase =
let
target = if withGraphics then "X-Configure" else "Configure";
platform =
if stdenv.hostPlatform.isLinux then "linux"
else if stdenv.hostPlatform.isDarwin then "macintosh"
else if stdenv.hostPlatform.isBSD then "bsd"
else if stdenv.hostPlatform.isCygwin then "cygwin"
else if stdenv.hostPlatform.isSunOS then "solaris"
else throw "unsupported system";
in
"make ${target} name=${platform}";
installPhase = ''
make Install dest=$out
rm $out/README
mkdir -p $out/share/doc
mv $out/doc $out/share/doc/icon
'';
meta = with lib; {
description = "Very high level general-purpose programming language";
maintainers = with maintainers; [ yurrriq ];
platforms = with platforms; linux ++ darwin ++ freebsd ++ netbsd ++ openbsd ++ cygwin ++ illumos;
license = licenses.publicDomain;
homepage = "https://www.cs.arizona.edu/icon/";
};
}