summaryrefslogtreecommitdiff
path: root/nongnu/packages/productivity.scm
blob: 4bdc8fa4da1787f14cb44dfae8a7969c31541e98 (plain)
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
;;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org>
;;; Copyright © 2024 Karl Hallsby <karl@hallsby.com

(define-module (nongnu packages productivity)
  #:use-module (gnu packages base)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages image)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages pciutils)
  #:use-module (gnu packages photo)
  #:use-module (gnu packages xiph)
  #:use-module (gnu packages xorg)
  #:use-module (gnu packages video)
  #:use-module (gnu packages wget)
  #:use-module (guix download)
  #:use-module (guix gexp)
  #:use-module (guix packages)
  #:use-module (nonguix build-system chromium-binary)
  #:use-module ((nonguix licenses) #:prefix license:)
  #:use-module ((guix licenses) #:prefix free-license:))

(define-public anytype
  (package
    (name "anytype")
    (version "0.41.0")
    (source
     (origin
       (method url-fetch)
       (uri
        (string-append "https://anytype-release.fra1.cdn.digitaloceanspaces.com/"
                       name "_" version "_amd64.deb"))
       (file-name (string-append "anytype-" version ".deb"))
       (sha256
        (base32
         "1bzkq7if5n58qdr6mdx31862k47h612qw6hb2ifpf8yaqb93v4jb"))))
    (build-system chromium-binary-build-system)
    (arguments
     (list
      ;; almost 300MB
      #:substitutable? #f
      #:validate-runpath? #f ; TODO: fails on wrapped binary and included other files
      #:wrapper-plan
      #~(map (lambda (file)
               (string-append "opt/Anytype/" file))
             '("anytype"
               "chrome-sandbox"
               "chrome_crashpad_handler"
               "libEGL.so"
               "libffmpeg.so"
               "libGLESv2.so"
               "libvk_swiftshader.so"
               "libvulkan.so.1"
               "resources/app.asar.unpacked/node_modules/keytar/build/Release/keytar.node"
               "resources/app.asar.unpacked/node_modules/keytar/build/Release/obj.target/keytar.node"))
      #:install-plan
      #~'(("opt/" "/share")
          ("usr/share/" "/share"))
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'binary-unpack 'strip-python
            (lambda _
              (delete-file
               (string-append "opt/Anytype/resources/app.asar.unpacked/"
                              "node_modules/keytar/build/node_gyp_bins/python3"))))
          (add-before 'install 'patch-assets
            (lambda _
              (let* ((bin (string-append #$output "/bin"))
                     (usr/share "./usr/share")
                     (old-exe "/opt/Anytype/anytype")
                     (exe (string-append bin "/anytype")))
                (substitute* (string-append usr/share "/applications/anytype.desktop")
                  (((string-append "^Exec=" old-exe)) (string-append "Exec=" exe))))))
          (add-before 'install-wrapper 'symlink-entrypoint
            (lambda _
              (let* ((bin (string-append #$output "/bin"))
                     (exe (string-append bin "/anytype"))
                     (share (string-append #$output "/share/Anytype"))
                     (target (string-append share "/anytype")))
                (mkdir-p bin)
                (symlink target exe)
                (wrap-program exe
                  `("LD_LIBRARY_PATH" = (,share)))))))))
    (inputs
     (list bzip2
           flac
           gdk-pixbuf
           harfbuzz
           libexif
           libglvnd
           libpng
           libva
           libxscrnsaver
           opus
           pciutils
           snappy
           util-linux
           xdg-utils
           wget))
    (synopsis "Productivity and note-taking app")
    (supported-systems '("x86_64-linux"))
    (description "Anytype is an E2E encrypted, cross-platform, productivity and
note taking app. It stores all the data locally and allows for peer-to-peer
synchronization.")
    (home-page "https://anytype.io")
    (license (license:nonfree
              "https://github.com/anyproto/anytype-ts/blob/main/LICENSE.md"))))

(define-public zotero
  (package
    (name "zotero")
    (version "6.0.35")
    (source
     (origin
       ;; Can switch to git-fetch from Github too!
       (method url-fetch)
       (uri
        (string-append "https://download.zotero.org/client/release/"
                       version "/Zotero-" version "_linux-x86_64.tar.bz2"))
       (sha256
        (base32
         "17f9an43jwnqpcslbvnhg7hrzkvs2whzwg4ysdgy2gl4m6cln18w"))
       (snippet
        #~(begin
            (use-modules (guix build utils))
            ;; Disable Zotero's automatic update feature.
            (substitute* "defaults/preferences/prefs.js"
              (("pref\\(\"app.update.enabled\", true\\)")
               "pref(\"app.update.enabled\", false)")
              (("pref\\(\"app.update.auto\", true\\)")
               "pref(\"app.update.auto\", false)"))))))
    (build-system chromium-binary-build-system)
    (arguments
     (list
      ;; ~70 MiB
      #:substitutable? #f
      #:validate-runpath? #t
      #:wrapper-plan
      #~'("zotero-bin")
      #:phases
      #~(modify-phases %standard-phases
          (add-before 'install-wrapper 'install-entrypoint
            (lambda _
              (let* ((bin (string-append #$output "/bin")))
                (mkdir-p bin)
                (symlink (string-append #$output "/zotero")
                         (string-append bin "/zotero")))))
          (add-after 'install 'create-desktop-file
            (lambda _
              (make-desktop-entry-file
               (string-append #$output "/share/applications/zotero.desktop")
               #:name "Zotero"
               #:type "Application"
               #:generic-name "Reference Management"
               #:exec (string-append #$output "/bin/zotero -url %U")
               #:icon "zotero"
               #:keywords '("zotero")
               #:categories '("Office" "Database")
               #:terminal #f
               #:startup-notify #t
               #:startup-w-m-class "zotero"
               ;; MIME-type list taken from Zotero's shipped .desktop file
               #:mime-type '("x-scheme-handler/zotero" "text/plain"
                             "application/x-research-info-systems"
                             "text/x-research-info-systems"
                             "text/ris"
                             "application/x-endnote-refer"
                             "application/x-inst-for-Scientific-info"
                             "application/mods+xml"
                             "application/rdf+xml"
                             "application/x-bibtex"
                             "text/x-bibtex"
                             "application/marc"
                             "application/vnd.citationstyles.style+xml")
               #:comment
               '(("en" "Collect, organize, cite, and share your research sources")
                 (#f "Collect, organize, cite, and share your research sources")))))
          (add-after 'install 'install-icons
            (lambda _
              (let ((icon-sizes (list 16 32 48 256)))
                (for-each
                 (lambda (size)
                   (mkdir-p (string-append #$output "/share/icons/hicolor/"
                                           size "x" size "/apps"))
                   (copy-file
                    (string-append "chrome/icons/default/default" size ".png")
                    (string-append #$output "/share/icons/hicolor/"
                                   size "x" size "/apps/zotero.png")))
                 (map number->string icon-sizes))))))))
          ;; The zotero script that we wrap (which produces .zotero-real), has
          ;; this open file limit step done for us. If that script ever goes
          ;; away, then we can just uncomment this one.
          ;; (add-after 'install-wrapper 'raise-open-file-limit
          ;;   (lambda _
          ;;     (let ((file (string-append #$output "/bin/zotero")))
          ;;       (with-output-to-file file
          ;;         (lambda _
          ;;           (display
          ;;            (string-append
          ;;             "#!/bin/sh\n"
          ;;             ;; Raise the open files limit because Mozilla file
          ;;             ;; functions leave files open for a tiny bit longer than
          ;;             ;; necessary, so an installation with many translators and
          ;;             ;; styles can exceed the default 1024 file limit. ulimit
          ;;             ;; is a shell built-in, so we cannot use Guix's
          ;;             ;; program-file function.
          ;;             "ulimit -n 4096\n"
          ;;             #$output "/bin/zotero-bin" " -app " #$output "/application.ini" " \"$@\""))))
          ;;       (chmod file #o755))))
    (inputs (list dbus-glib libxt))
    (synopsis "Collect, organize, cite, and share your research sources")
    ;; If we build from source, then we may be able to support more
    ;; architectures. But Zotero is a Firefox/Electron app that uses a lot of
    ;; JavaScript, which may be problematic when packaging using Guix.
    (supported-systems '("x86_64-linux"))
    (description "Zotero is a research reference and bibliography tool.
Zotero helps you organize your research any way you want.  You can sort items
into collections and tag them with keywords.  Zotero instantly creates
references and bibliographies for any text editor, and directly inside Word,
LibreOffice, and Google Docs for over 10,000 citation styles.")
    (home-page "https://www.zotero.org")
    (license free-license:agpl3)))