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

53 lines
1.5 KiB
Nix

{ lib
, fetchFromGitHub
, python3
, qt5
, stdenv
, installShellFiles
}:
python3.pkgs.buildPythonApplication rec {
pname = "vimiv-qt";
version = "0.9.0";
src = fetchFromGitHub {
owner = "karlch";
repo = pname;
rev = "v${version}";
sha256 = "sha256-28sk5qDVmrgXYX2wm5G8zv564vG6GwxNp+gjrFHCRfU=";
};
nativeBuildInputs = [ installShellFiles qt5.wrapQtAppsHook python3.pkgs.setuptools ];
propagatedBuildInputs = with python3.pkgs; [ pyqt5 py3exiv2 ];
buildInputs = [ qt5.qtsvg ] ++ lib.optionals stdenv.hostPlatform.isLinux [ qt5.qtwayland ];
postInstall = ''
install -Dm644 misc/vimiv.desktop $out/share/applications/vimiv.desktop
install -Dm644 misc/org.karlch.vimiv.qt.metainfo.xml $out/metainfo/org.karlch.vimiv.qt.metainfo.xml
install -Dm644 LICENSE $out/licenses/vimiv/LICENSE
install -Dm644 icons/vimiv.svg $out/icons/hicolor/scalable/apps/vimiv.svg
installManPage misc/vimiv.1
for i in 16 32 64 128 256 512; do
install -Dm644 icons/vimiv_''${i}x''${i}.png $out/icons/hicolor/''${i}x''${i}/apps/vimiv.png
done
'';
# Vimiv has to be wrapped manually because it is a non-ELF executable.
dontWrapQtApps = true;
preFixup = ''
wrapQtApp $out/bin/vimiv
'';
meta = with lib; {
description = "Image viewer with Vim-like keybindings (Qt port)";
license = licenses.gpl3Plus;
homepage = "https://github.com/karlch/vimiv-qt";
maintainers = with maintainers; [ dschrempf ];
mainProgram = "vimiv";
platforms = platforms.all;
};
}