nixpkgs/pkgs/by-name/ns/nsxiv/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

71 lines
1.9 KiB
Nix

{ lib
, stdenv
, fetchFromGitea
, giflib
, imlib2
, libXft
, libexif
, libwebp
, libinotify-kqueue
, conf ? null
}:
stdenv.mkDerivation (finalAttrs: {
pname = "nsxiv";
version = "32";
src = fetchFromGitea {
domain = "codeberg.org";
owner = "nsxiv";
repo = "nsxiv";
rev = "v${finalAttrs.version}";
hash = "sha256-UWaet7hVtgfuWTiNY4VcsMWTfS6L9r5w1fb/0dWz8SI=";
};
outputs = [ "out" "man" "doc" ];
buildInputs = [
giflib
imlib2
libXft
libexif
libwebp
] ++ lib.optional stdenv.hostPlatform.isDarwin libinotify-kqueue;
postPatch = lib.optionalString (conf != null) ''
cp ${(builtins.toFile "config.def.h" conf)} config.def.h
'';
env.NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-linotify";
makeFlags = [ "CC:=$(CC)" ];
installFlags = [ "PREFIX=$(out)" ];
installTargets = [ "install-all" ];
meta = {
homepage = "https://nsxiv.codeberg.page/";
description = "New Suckless X Image Viewer";
mainProgram = "nsxiv";
longDescription = ''
nsxiv is a fork of now unmaintained sxiv with the purpose of being a
drop-in replacement of sxiv, maintaining it and adding simple, sensible
features, like:
- Basic image operations, e.g. zooming, panning, rotating
- Customizable key and mouse button mappings (in config.h)
- Script-ability via key-handler
- Thumbnail mode: grid of selectable previews of all images
- Ability to cache thumbnails for fast re-loading
- Basic support for animated/multi-frame images (GIF/WebP)
- Display image information in status bar
- Display image name/path in X title
'';
changelog = "https://codeberg.org/nsxiv/nsxiv/src/tag/${finalAttrs.src.rev}/etc/CHANGELOG.md";
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ AndersonTorres sikmir ];
platforms = lib.platforms.unix;
};
})