nixpkgs/pkgs/applications/graphics/feh/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

59 lines
1.4 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, xorg
, imlib2
, libjpeg
, libpng
, curl
, libexif
, jpegexiforient
, perl
, enableAutoreload ? !stdenv.hostPlatform.isDarwin
}:
stdenv.mkDerivation (finalAttrs: {
pname = "feh";
version = "3.10.3";
src = fetchFromGitHub {
owner = "derf";
repo = "feh";
rev = finalAttrs.version;
hash = "sha256-FtaFoLjI3HTLAxRTucp5VDYS73UuWqw9r9UWKK6T+og=";
};
outputs = [ "out" "man" "doc" ];
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ xorg.libXt xorg.libX11 xorg.libXinerama imlib2 libjpeg libpng curl libexif ];
makeFlags = [
"PREFIX=${placeholder "out"}"
"exif=1"
] ++ lib.optional stdenv.hostPlatform.isDarwin "verscmp=0"
++ lib.optional enableAutoreload "inotify=1";
installTargets = [ "install" ];
postInstall = ''
wrapProgram "$out/bin/feh" --prefix PATH : "${lib.makeBinPath [ libjpeg jpegexiforient ]}" \
--add-flags '--theme=feh'
'';
nativeCheckInputs = lib.singleton (perl.withPackages (p: [ p.TestCommand ]));
doCheck = true;
meta = with lib; {
description = "Light-weight image viewer";
homepage = "https://feh.finalrewind.org/";
# released under a variant of the MIT license
# https://spdx.org/licenses/MIT-feh.html
license = licenses.mit-feh;
maintainers = with maintainers; [ gepbird globin willibutz ];
platforms = platforms.unix;
mainProgram = "feh";
};
})