about summary refs log tree commit diff
path: root/pkgs/applications/office/qnotero/default.nix
blob: c091f61dffc6aac811f448755f669a096e69f5b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ 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.isDarwin; # Build fails even after adding cx-freeze to `buildInputs`
    maintainers = [ lib.maintainers.nico202 ];
  };
}