1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs synced 2024-10-19 03:47:13 -04:00
nixpkgs/pkgs/tools/misc/chafa/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

54 lines
1.5 KiB
Nix

{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, pkg-config, which
, libxslt, libxml2, docbook_xml_dtd_412, docbook_xsl, glib, imagemagick
, Foundation
}:
stdenv.mkDerivation rec {
version = "1.14.4";
pname = "chafa";
src = fetchFromGitHub {
owner = "hpjansson";
repo = "chafa";
rev = version;
sha256 = "sha256-jrLlhpPWsc1aOEH36W6MbikAj1nAX8CinHKG+iRk+18=";
};
nativeBuildInputs = [ autoconf
automake
libtool
pkg-config
which
libxslt
libxml2
docbook_xml_dtd_412
docbook_xsl
];
buildInputs = [ glib imagemagick ]
++ lib.optional stdenv.hostPlatform.isDarwin Foundation;
patches = [ ./xmlcatalog_patch.patch ];
preConfigure = ''
substituteInPlace ./autogen.sh --replace pkg-config '$PKG_CONFIG'
NOCONFIGURE=1 ./autogen.sh
'';
configureFlags = [ "--enable-man"
"--with-xml-catalog=${docbook_xml_dtd_412}/xml/dtd/docbook/catalog.xml"
];
# https://github.com/NixOS/nixpkgs/pull/240893#issuecomment-1635347507
NIX_LDFLAGS = [ "-lwebp" ];
meta = with lib; {
description = "Terminal graphics for the 21st century";
homepage = "https://hpjansson.org/chafa/";
license = licenses.lgpl3Plus;
platforms = platforms.all;
maintainers = [ maintainers.mog ];
mainProgram = "chafa";
};
}