From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Subject: [PATCH 2/2] profiles: Add xdg-mime-database hook. Date: Sun, 31 Jan 2016 20:03:18 +0800 Message-ID: <1454241798-14243-2-git-send-email-iyzsong@gmail.com> References: <1454241798-14243-1-git-send-email-iyzsong@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPqjH-00078x-Bw for guix-devel@gnu.org; Sun, 31 Jan 2016 07:03:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aPqjE-0002jY-5f for guix-devel@gnu.org; Sun, 31 Jan 2016 07:03:43 -0500 Received: from smtp17.openmailbox.org ([62.4.1.51]:57728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPqjE-0002jP-0H for guix-devel@gnu.org; Sun, 31 Jan 2016 07:03:40 -0500 In-Reply-To: <1454241798-14243-1-git-send-email-iyzsong@gmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= * guix/profiles (xdg-mime-database): New function. (%default-profile-hooks): Add it. --- guix/profiles.scm | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/guix/profiles.scm b/guix/profiles.scm index 38e2730..84bcbd2 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -715,6 +715,39 @@ desktop files." #:local-build? #t #:substitutable? #f)) +(define (xdg-mime-database manifest) + "Return a derivation that builds the @file{mime.cache} database from manifest +entries." + (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))))) + + (gexp->derivation "xdg-mime-database" build + #:modules '((guix build utils) + (guix build union)) + #:local-build? #t + #:substitutable? #f)) + (define %default-profile-hooks ;; This is the list of derivation-returning procedures that are called by ;; default when making a non-empty profile. @@ -722,7 +755,8 @@ desktop files." ghc-package-cache-file ca-certificate-bundle gtk-icon-themes - xdg-desktop-database)) + xdg-desktop-database + xdg-mime-database)) (define* (profile-derivation manifest #:key -- 2.5.0