nixpkgs/pkgs/applications/office/qnotero/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

54 lines
1.5 KiB
Nix

{ lib, stdenv, fetchFromGitHub, python3Packages, wrapQtAppsHook }:
python3Packages.buildPythonPackage rec {
pname = "qnotero";
version = "2.3.1";
src = fetchFromGitHub {
owner = "ealbiter";
repo = pname;
rev = "refs/tags/v${version}";
sha256 = "sha256-Rym7neluRbYCpuezRQyLc6gSl3xbVR9fvhOxxW5+Nzo=";
};
propagatedBuildInputs = [ python3Packages.pyqt5 wrapQtAppsHook ];
patchPhase = ''
substituteInPlace ./setup.py \
--replace "/usr/share" "usr/share"
substituteInPlace ./libqnotero/_themes/light.py \
--replace "/usr/share" "$out/usr/share"
'';
preFixup = ''
wrapQtApp "$out"/bin/qnotero
'';
postInstall = ''
mkdir $out/share
mv $out/usr/share/applications $out/share/applications
substituteInPlace $out/share/applications/qnotero.desktop \
--replace "Icon=/usr/share/qnotero/resources/light/qnotero.png" "Icon=qnotero"
mkdir -p $out/share/icons/hicolor/64x64/apps
ln -s $out/usr/share/qnotero/resources/light/qnotero.png \
$out/share/icons/hicolor/64x64/apps/qnotero.png
'';
# no tests executed
doCheck = false;
meta = {
description = "Quick access to Zotero references";
mainProgram = "qnotero";
homepage = "https://www.cogsci.nl/software/qnotero";
license = lib.licenses.gpl2;
platforms = lib.platforms.unix;
broken = stdenv.hostPlatform.isDarwin; # Build fails even after adding cx-freeze to `buildInputs`
maintainers = [ lib.maintainers.nico202 ];
};
}