diff options
author | Christopher Baines <mail@cbaines.net> | 2020-11-29 14:19:55 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-11-29 17:34:18 +0000 |
commit | ff01206345e2306cc633db48e0b29eab9077091a (patch) | |
tree | 25c7ee17005dadc9bf4fae3f0873e03a4704f782 /guix/profiles.scm | |
parent | ed2545f0fa0e2ad99d5a0c45f532c539b299b9fb (diff) | |
parent | 7c2e67400ffaef8eb6f30ef7126c976ee3d7e36c (diff) | |
download | guix-patches-ff01206345e2306cc633db48e0b29eab9077091a.tar guix-patches-ff01206345e2306cc633db48e0b29eab9077091a.tar.gz |
Merge remote-tracking branch 'origin/master' into core-updates
Diffstat (limited to 'guix/profiles.scm')
-rw-r--r-- | guix/profiles.scm | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm index 856a05eed1..1b15257210 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -1301,31 +1301,43 @@ entries. It's used to query the MIME type of a given file." (define shared-mime-info ; lazy reference (module-ref (resolve-interface '(gnu packages gnome)) 'shared-mime-info)) - (mlet %store-monad ((glib - (manifest-lookup-package - manifest "glib"))) + (mlet %store-monad ((glib (manifest-lookup-package manifest "glib"))) (define build (with-imported-modules '((guix build utils) (guix build union)) #~(begin - (use-modules (srfi srfi-26) - (guix build utils) - (guix build union)) + (use-modules (guix build utils) + (guix build union) + (srfi srfi-26) + (ice-9 match)) + (let* ((datadir (string-append #$output "/share")) (destdir (string-append datadir "/mime")) (pkgdirs (filter file-exists? (map (cut string-append <> "/share/mime/packages") (cons #+shared-mime-info - '#$(manifest-inputs manifest))))) - (update-mime-database (string-append - #+shared-mime-info - "/bin/update-mime-database"))) - (mkdir-p destdir) - (union-build (string-append destdir "/packages") pkgdirs - #:log-port (%make-void-port "w")) - (setenv "XDG_DATA_HOME" datadir) - (exit (zero? (system* update-mime-database destdir))))))) + '#$(manifest-inputs manifest)))))) + + (match pkgdirs + ((shared-mime-info) + ;; PKGDIRS contains nothing but 'shared-mime-info', which + ;; already contains its database, so nothing to do. + (mkdir-p datadir) + (symlink #$(file-append shared-mime-info "/share/mime") + destdir)) + (_ + ;; PKGDIRS contains additional packages providing + ;; 'share/mime/packages' (very few packages do so) so rebuild + ;; the database. TODO: Find a way to avoid reprocessing + ;; 'shared-mime-info', which is the most expensive one. + (mkdir-p destdir) + (union-build (string-append destdir "/packages") pkgdirs + #:log-port (%make-void-port "w")) + (setenv "XDG_DATA_HOME" datadir) + (invoke #+(file-append shared-mime-info + "/bin/update-mime-database") + destdir))))))) ;; Don't run the hook when there are no GLib based applications. (if glib |