[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
52/56: profiles: Add xdg-mime-database hook.
From: |
??? |
Subject: |
52/56: profiles: Add xdg-mime-database hook. |
Date: |
Mon, 02 May 2016 13:38:41 +0000 |
iyzsong pushed a commit to branch gnome-updates
in repository guix.
commit 238cb63f6d42f4e564d817a674d24b78346438e4
Author: 宋文武 <address@hidden>
Date: Thu Feb 4 15:35:03 2016 +0800
profiles: Add xdg-mime-database hook.
* guix/profiles.scm (xdg-mime-database): New function.
(%default-profile-hooks): Add it.
---
guix/profiles.scm | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/guix/profiles.scm b/guix/profiles.scm
index c298bac..93d03ce 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -721,6 +721,42 @@ MIME type."
#:substitutable? #f)
(with-monad %store-monad (return #f))))
+(define (xdg-mime-database manifest)
+ "Return a derivation that builds the @file{mime.cache} database from manifest
+entries. It's used to query the MIME type of a given file."
+ (define shared-mime-info
+ (module-ref (resolve-interface '(gnu packages gnome))
+ 'shared-mime-info))
+
+ (define build
+ #~(begin
+ (use-modules (srfi srfi-26)
+ (guix build utils)
+ (guix build union))
+ (let* ((datadir (string-append #$output "/share"))
+ (destdir (string-append datadir "/mime"))
+ (mimedirs (filter file-exists?
+ (map (cut string-append <>
+ "/share/mime")
+ '#$(manifest-inputs manifest))))
+ (update-mime-database (string-append
+ #+shared-mime-info
+ "/bin/update-mime-database")))
+ (mkdir-p datadir)
+ (union-build destdir mimedirs
+ #:log-port (%make-void-port "w"))
+ (setenv "XDG_DATA_HOME" datadir)
+ (zero? (system* update-mime-database destdir)))))
+
+ ;; Don't run the hook when 'shared-mime-info' is not installed.
+ (if (manifest-lookup manifest (manifest-pattern (name "shared-mime-info")))
+ (gexp->derivation "xdg-mime-database" build
+ #:modules '((guix build utils)
+ (guix build union))
+ #:local-build? #t
+ #:substitutable? #f)
+ (with-monad %store-monad (return #f))))
+
(define %default-profile-hooks
;; This is the list of derivation-returning procedures that are called by
;; default when making a non-empty profile.
@@ -728,7 +764,8 @@ MIME type."
ghc-package-cache-file
ca-certificate-bundle
gtk-icon-themes
- xdg-desktop-database))
+ xdg-desktop-database
+ xdg-mime-database))
(define* (profile-derivation manifest
#:key
- 28/56: gnu: yelp: Update to 3.20.1., (continued)
- 28/56: gnu: yelp: Update to 3.20.1., ???, 2016/05/02
- 13/56: gnu: gnome-desktop: Update to 3.20.1., ???, 2016/05/02
- 29/56: gnu: shotwell: Update to 0.22.1., ???, 2016/05/02
- 31/56: gnu: gnome-session: Update to 3.20.1, fix build., ???, 2016/05/02
- 30/56: gnu: file-roller: Update to 3.20.1., ???, 2016/05/02
- 43/56: gnu: libpeas: Add inputs., ???, 2016/05/02
- 22/56: gnu: gnome-klotski: Update to 3.20.1., ???, 2016/05/02
- 41/56: gnu: librsvg: Drop 'loaders.cache' file., ???, 2016/05/02
- 39/56: gnu: baobab: Update to 3.20.1., ???, 2016/05/02
- 45/56: gnu: grilo: Update to 0.3.0., ???, 2016/05/02
- 52/56: profiles: Add xdg-mime-database hook.,
??? <=
- 54/56: profiles: Factor out 'manifest-lookup-package'., ???, 2016/05/02
- 34/56: gnu: evolution-data-server: Update to 3.20.1, fix build., ???, 2016/05/02
- 42/56: gnu: network-manager: Update to 1.2.0., ???, 2016/05/02
- 40/56: gnu: dconf-editor: Update to 3.20.1., ???, 2016/05/02
- 17/56: gnu: libsoup: Update to 2.54.1., ???, 2016/05/02
- 44/56: gnu: gedit: Enable Python Console plugin., ???, 2016/05/02
- 48/56: gnu: gnome: Add baobab, gnome-backgrounds and gvfs., ???, 2016/05/02
- 49/56: gnu: udisks: Update to 2.1.7., ???, 2016/05/02
- 55/56: gnu: gom: Update to 0.3.2., ???, 2016/05/02
- 47/56: gnu: nautilus: Update to 3.20.1., ???, 2016/05/02