summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Hallsby <karl@hallsby.com>2024-05-03 10:28:31 -0500
committerJohn Kehayias <john.kehayias@protonmail.com>2025-02-21 00:05:12 -0500
commit1a9aaed3c467a646e04699d7655c476412a06e7e (patch)
tree421c464cc5f8f59ed8948d2172c62e40d082e975
parent6aa6de9fc86ddc3bcce8801a029f26b8bc0d074f (diff)
nongnu: Add obsidian.
* nongnu/packages/productivity.scm (obsidian): New variable. Signed-off-by: John Kehayias <john.kehayias@protonmail.com>
-rw-r--r--nongnu/packages/productivity.scm106
1 files changed, 105 insertions, 1 deletions
diff --git a/nongnu/packages/productivity.scm b/nongnu/packages/productivity.scm
index 446a654..0350cfd 100644
--- a/nongnu/packages/productivity.scm
+++ b/nongnu/packages/productivity.scm
@@ -1,6 +1,6 @@
1;;; SPDX-License-Identifier: GPL-3.0-or-later 1;;; SPDX-License-Identifier: GPL-3.0-or-later
2;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org> 2;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org>
3;;; Copyright © 2024 Karl Hallsby <karl@hallsby.com 3;;; Copyright © 2024, 2025 Raven Hallsby <karl@hallsby.com>
4 4
5(define-module (nongnu packages productivity) 5(define-module (nongnu packages productivity)
6 #:use-module (gnu packages base) 6 #:use-module (gnu packages base)
@@ -10,6 +10,8 @@
10 #:use-module (gnu packages glib) 10 #:use-module (gnu packages glib)
11 #:use-module (gnu packages gtk) 11 #:use-module (gnu packages gtk)
12 #:use-module (gnu packages image) 12 #:use-module (gnu packages image)
13 #:use-module (gnu packages imagemagick)
14 #:use-module (gnu packages inkscape)
13 #:use-module (gnu packages linux) 15 #:use-module (gnu packages linux)
14 #:use-module (gnu packages pciutils) 16 #:use-module (gnu packages pciutils)
15 #:use-module (gnu packages photo) 17 #:use-module (gnu packages photo)
@@ -20,6 +22,7 @@
20 #:use-module (guix download) 22 #:use-module (guix download)
21 #:use-module (guix gexp) 23 #:use-module (guix gexp)
22 #:use-module (guix packages) 24 #:use-module (guix packages)
25 #:use-module (ice-9 match)
23 #:use-module (nonguix build-system chromium-binary) 26 #:use-module (nonguix build-system chromium-binary)
24 #:use-module ((nonguix licenses) #:prefix license:) 27 #:use-module ((nonguix licenses) #:prefix license:)
25 #:use-module ((guix licenses) #:prefix free-license:)) 28 #:use-module ((guix licenses) #:prefix free-license:))
@@ -234,3 +237,104 @@ references and bibliographies for any text editor, and directly inside Word,
234LibreOffice, and Google Docs for over 10,000 citation styles.") 237LibreOffice, and Google Docs for over 10,000 citation styles.")
235 (home-page "https://www.zotero.org") 238 (home-page "https://www.zotero.org")
236 (license free-license:agpl3))) 239 (license free-license:agpl3)))
240
241(define-public obsidian
242 (package
243 (name "obsidian")
244 (version "1.8.7")
245 (source
246 (origin
247 (method url-fetch)
248 (uri
249 (string-append "https://github.com/obsidianmd/obsidian-releases/releases/download/"
250 "v" version "/obsidian-" version
251 (match (or (%current-target-system) (%current-system))
252 ("x86_64-linux" "") ; x86_64 does not have any special indication
253 ("aarch64-linux" "-arm64")
254 ;; We should provide a default case.
255 (_ "unsupported"))
256 ".tar.gz"))
257 (file-name (string-append "obsidian-" version ".tar.gz"))
258 (sha256
259 (base32
260 (match (or (%current-target-system) (%current-system))
261 ("x86_64-linux" "1kwhi5c56l97brp590f4qbi1z45ljm7g03wl3wdbz64mfn8zgqxl")
262 ("aarch64-linux" "0gk34q3bjbxyihmji9qkpypzby2jy607iz2jdwk14sp9riz31zr5")
263 ;; We need a valid base case for base32
264 (_ "0000000000000000000000000000000000000000000000000000"))))))
265 (build-system chromium-binary-build-system)
266 (arguments
267 (list
268 #:validate-runpath? #f ; TODO: fails on wrapped binary (.obsidian-real)
269 #:substitutable? #f
270 #:wrapper-plan
271 #~(list "obsidian")
272 #:phases
273 #~(modify-phases %standard-phases
274 (add-before 'install-wrapper 'install-entrypoint
275 (lambda _
276 (let* ((bin (string-append #$output "/bin")))
277 (mkdir-p bin)
278 (symlink (string-append #$output "/obsidian")
279 (string-append bin "/obsidian")))))
280 ;; NOTE: Obsidian's icon SVG does not conform to SVG standards.
281 (add-after 'install 'create-desktop-icons
282 (lambda* (#:key inputs outputs #:allow-other-keys)
283 (let ((convert (search-input-file inputs "/bin/convert"))
284 (svg (assoc-ref inputs "obsidian-logo-gradient.svg"))
285 (sizes (list "32x32" "48x48" "64x64" "128x128" "256x256"
286 "512x512")))
287 (for-each
288 (lambda (size)
289 (mkdir-p (string-append #$output "/share/icons/hicolor/"
290 size
291 "/apps"))
292 (invoke convert
293 "-background" "none"
294 "-resize" size
295 svg
296 (string-append #$output "/share/icons/hicolor/"
297 size
298 "/apps/obsidian.png")))
299 sizes))))
300 (add-after 'install 'create-desktop-file
301 (lambda _
302 (make-desktop-entry-file
303 (string-append #$output "/share/applications/obsidian.desktop")
304 #:name "Obsidian"
305 #:type "Application"
306 #:generic-name "Markdown Editor"
307 #:exec (string-append #$output "/obsidian")
308 #:icon "obsidian"
309 #:keywords '("obsidian")
310 #:categories '("Application" "Office")
311 #:terminal #f
312 #:startup-notify #t
313 #:startup-w-m-class "obsidian"
314 #:mime-type "x-scheme-handler/obsidian"
315 #:comment
316 '(("en" "Knowledge base")
317 (#f "Knowledge base"))))))))
318 (native-inputs
319 ;; imagemagick & inkscape needed to create desktop icons. We use the
320 ;; stable versions because we only need them for generating icons.
321 (list imagemagick/stable inkscape/stable))
322 (inputs
323 (list
324 (origin
325 (method url-fetch)
326 (uri "https://obsidian.md/images/obsidian-logo-gradient.svg")
327 (sha256
328 (base32 "100j8fcrc5q8zv525siapminffri83s2khs2hw4kdxwrdjwh36qi")))))
329 (synopsis "Markdown-based knowledge base")
330 (supported-systems '("x86_64-linux" "aarch64-linux"))
331 (description "Obsidian is a powerful knowledge base that works on top of a
332local folder of plain text Markdown files. Obsidian makes following
333connections frictionless, and with the connections in place, you can explore
334all of your knowledge in the interactive graph view. Obsidian supports
335CommonMark and GitHub Flavored Markdown (GFM), along with other useful
336notetaking features such as tags, LaTeX mathematical expressions, mermaid
337diagrams, footnotes, internal links and embedding Obsidian notes or external
338files. Obsidian also has a plugin system to expand its capabilities.")
339 (home-page "https://obsidian.md")
340 (license (license:nonfree "https://obsidian.md/license"))))