nixpkgs/pkgs/by-name/ph/photoqt/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

82 lines
1.7 KiB
Nix

{
lib,
stdenv,
fetchurl,
cmake,
extra-cmake-modules,
exiv2,
graphicsmagick,
libarchive,
libraw,
mpv,
pugixml,
qt6,
qt6Packages,
zxing-cpp,
}:
stdenv.mkDerivation rec {
pname = "photoqt";
version = "4.6";
src = fetchurl {
url = "https://photoqt.org/pkgs/photoqt-${version}.tar.gz";
hash = "sha256-5VbGMJ1B9yDbTiri7SZ+r+c9LdfG/C1c0/01QBUvbCY=";
};
nativeBuildInputs = [
cmake
extra-cmake-modules
qt6.qttools
qt6.wrapQtAppsHook
];
buildInputs =
[
exiv2
graphicsmagick
libarchive
libraw
pugixml
qt6.qtbase
qt6.qtcharts
qt6.qtdeclarative
qt6.qtimageformats
qt6.qtlocation
qt6.qtmultimedia
qt6.qtpositioning
qt6.qtsvg
qt6Packages.poppler
zxing-cpp
]
++ lib.optionals stdenv.hostPlatform.isLinux [
mpv
qt6.qtwayland
];
cmakeFlags = [
(lib.cmakeBool "DEVIL" false)
(lib.cmakeBool "CHROMECAST" false)
(lib.cmakeBool "FREEIMAGE" false)
(lib.cmakeBool "IMAGEMAGICK" false)
(lib.cmakeBool "VIDEO_MPV" (!stdenv.hostPlatform.isDarwin))
];
env.MAGICK_LOCATION = "${graphicsmagick}/include/GraphicsMagick";
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/Applications
mv $out/bin/photoqt.app $out/Applications
makeWrapper $out/{Applications/photoqt.app/Contents/MacOS,bin}/photoqt
'';
meta = {
description = "Simple, yet powerful and good looking image viewer";
homepage = "https://photoqt.org/";
license = lib.licenses.gpl2Plus;
mainProgram = "photoqt";
maintainers = with lib.maintainers; [ wegank ];
platforms = lib.platforms.unix;
};
}