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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
{ stdenv
, lib
, makeWrapper
, fetchurl
, dpkg
, wrapGAppsHook
, autoPatchelfHook
, gtk3
, cairo
, pango
, atk
, gdk-pixbuf
, glib
, at-spi2-atk
, dbus
, libX11
, libxcb
, libXi
, libXcursor
, libXdamage
, libXrandr
, libXcomposite
, libXext
, libXfixes
, libXrender
, libXtst
, libXScrnSaver
, nss
, nspr
, alsa-lib
, cups
, fontconfig
, expat
, libudev0-shim
, glibc
, curl
, openssl
, libnghttp2
, gsettings-desktop-schemas
, libdrm
, mesa
}:
stdenv.mkDerivation rec {
pname = "polar-bookshelf";
version = "2.0.103";
# fetching a .deb because there's no easy way to package this Electron app
src = fetchurl {
url = "https://github.com/burtonator/polar-bookshelf/releases/download/v${version}/polar-desktop-app-${version}-amd64.deb";
hash = "sha256-jcq0hW698bAhVM3fLQQeKAnld33XLkHsGjS3QwUpciQ=";
};
buildInputs = [
libdrm
mesa
gsettings-desktop-schemas
glib
gtk3
cairo
pango
atk
gdk-pixbuf
at-spi2-atk
dbus
libX11
libxcb
libXi
libXcursor
libXdamage
libXrandr
libXcomposite
libXext
libXfixes
libXrender
libXtst
libXScrnSaver
nss
nspr
alsa-lib
cups
fontconfig
expat
];
nativeBuildInputs = [
wrapGAppsHook
autoPatchelfHook
makeWrapper
dpkg
];
runtimeLibs = lib.makeLibraryPath [ libudev0-shim glibc curl openssl libnghttp2 ];
unpackPhase = "dpkg-deb -x $src .";
installPhase = ''
runHook preInstall
mkdir -p $out/share/polar-bookshelf
mkdir -p $out/bin
mkdir -p $out/lib
mv opt/Polar/* $out/share/polar-bookshelf
mv $out/share/polar-bookshelf/*.so $out/lib
mv usr/share/* $out/share/
ln -s $out/share/polar-bookshelf/polar-desktop-app $out/bin/polar-desktop-app
substituteInPlace $out/share/applications/polar-desktop-app.desktop \
--replace "/opt/Polar/polar-desktop-app" "$out/bin/polar-desktop-app"
runHook postInstall
'';
preFixup = ''
gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "${runtimeLibs}" )
'';
meta = {
homepage = "https://getpolarized.io/";
description = "Personal knowledge repository for PDF and web content supporting incremental reading and document annotation";
mainProgram = "polar-desktop-app";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.gpl3Only;
platforms = lib.platforms.linux;
maintainers = [ ];
};
}
|