all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to build a file which depends on the actual contents of store items?
@ 2015-11-20  4:22 宋文武
  2015-11-20 14:12 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: 宋文武 @ 2015-11-20  4:22 UTC (permalink / raw)
  To: guix-devel

[-- 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\"

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-23 14:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-20  4:22 How to build a file which depends on the actual contents of store items? 宋文武
2015-11-20 14:12 ` Ludovic Courtès
2015-11-23  9:59   ` 宋文武
2015-11-23 14:43     ` Ludovic Courtès

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.