From: 宋文武 <iyzsong@gmail.com>
To: guix-devel@gnu.org
Cc: 宋文武 <iyzsong@gmail.com>
Subject: [PATCH 1/2] profiles: Add xdg-desktop-database hook.
Date: Sun, 31 Jan 2016 20:03:17 +0800 [thread overview]
Message-ID: <1454241798-14243-1-git-send-email-iyzsong@gmail.com> (raw)
* 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
next reply other threads:[~2016-01-31 12:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-31 12:03 宋文武 [this message]
2016-01-31 12:03 ` [PATCH 2/2] profiles: Add xdg-mime-database hook 宋文武
2016-01-31 12:32 ` 宋文武
2016-02-02 13:11 ` Ludovic Courtès
2016-02-02 13:10 ` Ludovic Courtès
2016-02-02 13:09 ` [PATCH 1/2] profiles: Add xdg-desktop-database hook Ludovic Courtès
2016-02-04 7:54 ` 宋文武
2016-02-07 20:13 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454241798-14243-1-git-send-email-iyzsong@gmail.com \
--to=iyzsong@gmail.com \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).