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 1/2] profiles: Add xdg-desktop-database hook. Date: Sun, 31 Jan 2016 20:03:17 +0800 Message-ID: <1454241798-14243-1-git-send-email-iyzsong@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPqjB-00073h-0P for guix-devel@gnu.org; Sun, 31 Jan 2016 07:03:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aPqj7-0002iX-R7 for guix-devel@gnu.org; Sun, 31 Jan 2016 07:03:36 -0500 Received: from smtp22.openmailbox.org ([62.4.1.56]:54432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPqj7-0002hW-Lb for guix-devel@gnu.org; Sun, 31 Jan 2016 07:03:33 -0500 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-desktop-database): New function. (%default-profile-hooks): Add it. --- guix/profiles.scm | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/guix/profiles.scm b/guix/profiles.scm index ce86ff8..38e2730 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -684,13 +684,45 @@ creates the GTK+ 'icon-theme.cache' file for each theme." #:substitutable? #f) (return #f)))) +(define (xdg-desktop-database manifest) + "Return a derivation that builds the @file{mimeinfo.cache} database from +desktop files." + (define desktop-file-utils + (module-ref (resolve-interface '(gnu packages gnome)) + 'desktop-file-utils)) + + (define build + #~(begin + (use-modules (srfi srfi-26) + (guix build utils) + (guix build union)) + (let* ((destdir (string-append #$output "/share/applications")) + (appdirs (filter file-exists? + (map (cut string-append <> + "/share/applications") + '#$(manifest-inputs manifest)))) + (update-desktop-database (string-append + #+desktop-file-utils + "/bin/update-desktop-database"))) + (mkdir-p (string-append #$output "/share")) + (union-build destdir appdirs + #:log-port (%make-void-port "w")) + (zero? (system* update-desktop-database destdir))))) + + (gexp->derivation "xdg-desktop-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. (list info-dir-file ghc-package-cache-file ca-certificate-bundle - gtk-icon-themes)) + gtk-icon-themes + xdg-desktop-database)) (define* (profile-derivation manifest #:key -- 2.5.0