@@ -0,0 +1,105 @@
1+{ stdenv, fetchurl, dpkg, makeWrapper
2+, alsaLib, atk, cairo, cups, curl, dbus, expat, fontconfig, freetype, glib
3+, gnome3, gtk3, gdk_pixbuf, libnotify, libxcb, nspr, nss, pango
4+, systemd, wget, xorg, xprintidle-ng }:
5+
6+let
7+
8+ version = "1.10.45";
9+
10+ rpath = stdenv.lib.makeLibraryPath [
11+ alsaLib
12+ atk
13+ cairo
14+ cups
15+ curl
16+ dbus
17+ expat
18+ fontconfig
19+ freetype
20+ glib
21+ gnome3.gconf
22+ gdk_pixbuf
23+ gtk3
24+ pango
25+ libnotify
26+ libxcb
27+ nspr
28+ nss
29+ stdenv.cc.cc
30+ systemd
31+
32+ xorg.libxkbfile
33+ xorg.libX11
34+ xorg.libXcomposite
35+ xorg.libXcursor
36+ xorg.libXdamage
37+ xorg.libXext
38+ xorg.libXfixes
39+ xorg.libXi
40+ xorg.libXrandr
41+ xorg.libXrender
42+ xorg.libXtst
43+ xorg.libXScrnSaver
44+ ] + ":${stdenv.cc.cc.lib}/lib64";
45+
46+ src =
47+ if stdenv.system == "x86_64-linux" then
48+ fetchurl {
49+ url = "https://github.com/johannesjo/super-productivity/releases/download/v${version}/superProductivity_${version}_amd64.deb";
50+ sha256 = "0jfi0lfijnhij9jvkhxgyvq8m1jzaym8n1c7707fv3hjh1h0vxn1";
51+ }
52+ else
53+ throw "super-productivity is not supported on ${stdenv.system}";
54+
55+in stdenv.mkDerivation {
56+ name = "super-productivity-${version}";
57+
58+ inherit src;
59+
60+ buildInputs = [
61+ dpkg
62+ gtk3 # needed for GSETTINGS_SCHEMAS_PATH
63+ ];
64+
65+ nativeBuildInputs = [ makeWrapper ];
66+
67+ unpackPhase = "dpkg -x $src .";
68+
69+ installPhase = ''
70+ runHook preInstall
71+
72+ mkdir -p $out
73+
74+ cp -R usr/share $out/share
75+ cp -R opt $out/libexec
76+
77+ # Otherwise it looks "suspicious"
78+ chmod -R g-w $out
79+
80+ # set linker and rpath
81+ patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$out/libexec/superProductivity/superproductivity"
82+ patchelf --set-rpath ${rpath}:$out/libexec/superProductivity "$out/libexec/superProductivity/superproductivity"
83+
84+ # wrapper for xdg_data_dirs and xprintidle path
85+ makeWrapper $out/libexec/superProductivity/superproductivity $out/bin/superproductivity \
86+ --prefix XDG_DATA_DIRS : $GSETTINGS_SCHEMAS_PATH \
87+ --prefix PATH : "${xprintidle-ng}/bin"
88+
89+ # Fix the desktop link
90+ substituteInPlace $out/share/applications/superproductivity.desktop \
91+ --replace /opt/superProductivity/ $out/bin/
92+
93+ runHook postInstall
94+ '';
95+
96+ dontStrip = true;
97+
98+ meta = with stdenv.lib; {
99+ description = "To Do List / Time Tracker with Jira Integration.";
100+ homepage = http://super-productivity.com;
101+ license = licenses.mit;
102+ platforms = [ "x86_64-linux" ];
103+ maintainers = with maintainers; [ offline ];
104+ };
105+}