From: 宋文武 <iyzsong@openmailbox.org>
To: guix-devel@gnu.org
Subject: How to build a file which depends on the actual contents of store items?
Date: Fri, 20 Nov 2015 12:22:58 +0800 [thread overview]
Message-ID: <2fa656caf8ce0f255c5f9b70ac05b706@openmailbox.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 868 bytes --]
when look at our xorg service, the first thing I want to do is remove
the hard-coded modules and fonts from the xserver.conf.
the attach show what I intend to do, but I don't know how to
feed `mixed-text-file` the desired arguments now.
for each module, a line of `ModulePath "$package/lib/xorg/modules/"`
(or more specified one like `lib/xorg/modules/drivers`? I haven't test)
need to be added to the Files Section. Since package is an object,
I can't use string-append to compose them as one argument to
mixed-text-file, do I need a macro?
for fonts, it's more difficult (and on topic), because it does need to
know the actual contents (the directories contains fonts.dir).
see NixOS, it did the same thing by run shell commands on store items
:-)
https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/x11/xserver.nix#L74-L105
How I can do it?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: wip-xorg.scm --]
[-- Type: text/x-diff; name=wip-xorg.scm, Size: 2947 bytes --]
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index dc2625d..23a7642 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -54,7 +54,29 @@
;;;
;;; Code:
-(define* (xorg-configuration-file #:key (drivers '()) (resolutions '())
+(define %default-xorg-modules
+ (list xf86-video-vesa
+ xf86-video-fbdev
+ xf86-video-modesetting
+ xf86-video-cirrus
+ xf86-video-intel
+ xf86-video-mach64
+ xf86-video-nouveau
+ xf86-video-nv
+ xf86-video-sis
+ xf86-input-libinput
+ xf86-input-evdev
+ xf86-input-keyboard
+ xf86-input-mouse
+ xf86-input-synaptics))
+
+(define %default-xorg-fonts
+ (list font-alias
+ font-adobe75dpi))
+
+(define* (xorg-configuration-file #:key (modules %default-xorg-modules)
+ (fonts %default-xorg-fonts)
+ (drivers '()) (resolutions '())
(extra-config '()))
"Return a configuration file for the Xorg server containing search paths for
all the common drivers.
@@ -92,6 +114,9 @@ Section \"Screen\"
EndSubSection
EndSection"))
+ (define (module-path module)
+ (list " ModulePath \"" module "/lib/xorg/modules\"\n"))
+
(apply mixed-text-file "xserver.conf" "
Section \"Files\"
FontPath \"" font-alias "/share/fonts/X11/75dpi\"
@@ -99,28 +124,7 @@ Section \"Files\"
FontPath \"" font-alias "/share/fonts/X11/misc\"
FontPath \"" font-alias "/share/fonts/X11/cyrillic\"
FontPath \"" font-adobe75dpi "/share/fonts/X11/75dpi\"
- ModulePath \"" xf86-video-vesa "/lib/xorg/modules/drivers\"
- ModulePath \"" xf86-video-fbdev "/lib/xorg/modules/drivers\"
- ModulePath \"" xf86-video-modesetting "/lib/xorg/modules/drivers\"
- ModulePath \"" xf86-video-cirrus "/lib/xorg/modules/drivers\"
- ModulePath \"" xf86-video-intel "/lib/xorg/modules/drivers\"
- ModulePath \"" xf86-video-mach64 "/lib/xorg/modules/drivers\"
- ModulePath \"" xf86-video-nouveau "/lib/xorg/modules/drivers\"
- ModulePath \"" xf86-video-nv "/lib/xorg/modules/drivers\"
- ModulePath \"" xf86-video-sis "/lib/xorg/modules/drivers\"
-
- # Libinput is the new thing and is recommended over evdev/synaptics
- # by those who know:
- # <http://who-t.blogspot.fr/2015/01/xf86-input-libinput-compatibility-with.html>.
- ModulePath \"" xf86-input-libinput "/lib/xorg/modules/input\"
-
- ModulePath \"" xf86-input-evdev "/lib/xorg/modules/input\"
- ModulePath \"" xf86-input-keyboard "/lib/xorg/modules/input\"
- ModulePath \"" xf86-input-mouse "/lib/xorg/modules/input\"
- ModulePath \"" xf86-input-synaptics "/lib/xorg/modules/input\"
- ModulePath \"" xorg-server "/lib/xorg/modules\"
- ModulePath \"" xorg-server "/lib/xorg/modules/extensions\"
- ModulePath \"" xorg-server "/lib/xorg/modules/multimedia\"
+" (apply string-append (map module-path modules)) "
EndSection
Section \"ServerFlags\"
next reply other threads:[~2015-11-20 4:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-20 4:22 宋文武 [this message]
2015-11-20 14:12 ` How to build a file which depends on the actual contents of store items? Ludovic Courtès
2015-11-23 9:59 ` 宋文武
2015-11-23 14:43 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2fa656caf8ce0f255c5f9b70ac05b706@openmailbox.org \
--to=iyzsong@openmailbox.org \
--cc=guix-devel@gnu.org \
--cc=iyzsong@member.fsf.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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.