nixpkgs/pkgs/by-name/do/docfd/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

86 lines
1.7 KiB
Nix

{
lib,
ocamlPackages,
stdenv,
overrideSDK,
fetchFromGitHub,
python3,
dune_3,
makeWrapper,
pandoc,
poppler_utils,
testers,
docfd,
}:
let
# Needed for x86_64-darwin
buildDunePackage' = ocamlPackages.buildDunePackage.override {
stdenv = if stdenv.hostPlatform.isDarwin then overrideSDK stdenv "11.0" else stdenv;
};
in
buildDunePackage' rec {
pname = "docfd";
version = "8.0.3";
minimalOCamlVersion = "5.1";
src = fetchFromGitHub {
owner = "darrenldl";
repo = "docfd";
rev = version;
hash = "sha256-890/3iBruaQtWwlcvwuz4ujp7+P+5y1/2Axx4Iuik8Q=";
};
nativeBuildInputs = [
python3
dune_3
makeWrapper
];
buildInputs = with ocamlPackages; [
cmdliner
containers-data
decompress
digestif
eio_main
lwd
nottui
notty
ocolor
oseq
ppx_deriving
ppxlib
re
spelll
timedesc
yojson
];
postInstall = ''
wrapProgram $out/bin/docfd --prefix PATH : "${
lib.makeBinPath [
pandoc
poppler_utils
]
}"
'';
passthru.tests.version = testers.testVersion { package = docfd; };
meta = with lib; {
description = "TUI multiline fuzzy document finder";
longDescription = ''
Think interactive grep for text and other document files.
Word/token based instead of regex and line based, so you
can search across lines easily. Aims to provide good UX via
integration with common text editors and other file viewers.
'';
homepage = "https://github.com/darrenldl/docfd";
license = licenses.mit;
maintainers = with maintainers; [ chewblacka ];
platforms = platforms.all;
mainProgram = "docfd";
};
}