nixpkgs/pkgs/by-name/ch/chawan/package.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

85 lines
1.7 KiB
Nix

{ lib
, stdenv
, fetchFromSourcehut
, makeBinaryWrapper
, curlMinimal
, mandoc
, ncurses
, nim
, pandoc
, pkg-config
, zlib
, unstableGitUpdater
, libseccomp
, substituteAll
}:
stdenv.mkDerivation {
pname = "chawan";
version = "0-unstable-2024-09-03";
src = fetchFromSourcehut {
owner = "~bptato";
repo = "chawan";
rev = "298684d174be90be57967f15c2f1bf0d24ba2446";
hash = "sha256-R/+qLoyewqoOfi264GvZUvpZbN5FX8LtGikQ3FxJEvw=";
fetchSubmodules = true;
};
patches = [
# Include chawan's man pages in mancha's search path
(substituteAll {
src = ./mancha-augment-path.diff;
out = placeholder "out";
})
];
env.NIX_CFLAGS_COMPILE = toString (
lib.optional stdenv.cc.isClang "-Wno-error=implicit-function-declaration"
);
nativeBuildInputs = [
makeBinaryWrapper
nim
pandoc
pkg-config
];
buildInputs = [
curlMinimal
libseccomp
ncurses
zlib
];
buildFlags = [ "all" "manpage" ];
installFlags = [
"DESTDIR=$(out)"
"PREFIX=/"
];
postInstall =
let
makeWrapperArgs = ''
--set MANCHA_CHA $out/bin/cha \
--set MANCHA_MAN ${mandoc}/bin/man
'';
in
''
wrapProgram $out/bin/cha ${makeWrapperArgs}
wrapProgram $out/bin/mancha ${makeWrapperArgs}
'';
passthru.updateScript = unstableGitUpdater { };
meta = {
description = "Lightweight and featureful terminal web browser";
homepage = "https://sr.ht/~bptato/chawan/";
license = lib.licenses.publicDomain;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ jtbx ];
mainProgram = "cha";
broken = stdenv.hostPlatform.isDarwin; # pending PR #292043
};
}