Subject: Re: bug#39402: set-xorg-configuration pulls in unsupported packages on target architecture

From: shtwzrd <[email-masked]>
Date: Sat, 08 Feb 2020 09:30:57 +0000

I did a little bit more experimenting and can see it's not set-xorg-configuration that is the problem, it goes deeper.

Perhaps it's `xorg-configuration` itself?

Here's my full config at the minute, now trying with `xorg-start-command`, which has the same problem:

```
(use-modules (guix download)
	     (guix git-download)
	     (guix packages)
	     (gnu)
	     (gnu bootloader u-boot)
	     (gnu packages linux)
	     (gnu packages bootloaders)
	     (gnu packages libusb)
	     (gnu packages certs)
	     (gnu packages bootloaders)
	     (gnu packages suckless)
	     (gnu packages xdisorg)
	     (gnu packages gnome)
	     (gnu packages xorg)
	     (gnu services xorg)
	     (gnu services dbus)
	     (gnu services sound)
	     (gnu services networking)
	     (gnu services avahi)
	     (gnu services desktop)
	     (guix build-system trivial))
(use-service-modules desktop)

;; bootloader ---
(define-public u-boot-pinebook-pro-rk3399
  (let ((base (make-u-boot-package "pinebook_pro-rk3399" "aarch64-linux-gnu")))
    (package
     (inherit base)
     (source (origin
	      (method url-fetch)
	      (uri (string-append
		    "ftp://ftp.denx.de/pub/u-boot/"
		    "u-boot-" (package-version base)".tar.bz2"))
	      (sha256
	       (base32
		"1w9ml4jl15q6ixpdqzspxjnl7d3rgxd7f99ms1xv5c8869h3qida"))
	      ;; need a rather large patch, based on commit:
	      ;; 3034b8864e47bfbf6f0330dc67620a2a71cfe3f8
	      ;; from git.eno.space/pbp-uboot.git
	      (patches '("./patches/uboot-pinebook-pro-rk3399.patch"))))
     (arguments
      (substitute-keyword-arguments
       (package-arguments base)
       ((#:phases phases)
	`(modify-phases ,phases
			(add-after
			 'unpack 'set-environment
			 (lambda* (#:key inputs #:allow-other-keys)
			   (setenv "BL31" (string-append (assoc-ref inputs "firmware")
							 "/bl31.elf"))
			   #t))
			;; Phases do not succeed on the bl31 ELF.
			(delete 'strip)
			(delete 'validate-runpath)))))
     (native-inputs
      `(("firmware" ,arm-trusted-firmware-rk3399)
	,@(package-native-inputs base))))))

(define u-boot-pinebook-pro-bootloader
  (bootloader
   (inherit u-boot-rockpro64-rk3399-bootloader)
   (package u-boot-pinebook-pro-rk3399)))

					;(define u-boot-pinebookpro-rk3399-bootloader
;; SD and eMMC use the same format
					;  (bootloader
					;   (inherit u-boot-bootloader)
					;   (package u-boot-rockpro64-rk3399)
					;   (installer install-rockpro64-rk3399-u-boot)))

;; linux kernel ---
(define kernel-config
  (string-append (dirname (current-filename)) "/kernel.config"))

;; we need a custom patched kernel for now
;; hopefully the changes get mainlined soon
(define linux-pbp
  (let ((repo "gitlab.manjaro.org/tsys/linux-pinebook-pro")
	(commit "b262e709c608c1a5acefca280a2899acab9a802b")
	(revision "3"))
    (package
     (inherit linux-libre)
     (name "linux-pbp")
     (version (git-version "5.5.0" revision commit))
     (native-inputs
      `(("kconfig" ,kernel-config)
	,@(assoc-remove! (package-native-inputs linux-libre) "kconfig")))
     (source (origin
	      (method url-fetch)
	      (uri (string-append
		    "https://" repo "/repository/archive.tar.gz?ref=" commit))
	      (sha256
	       (base32
		"087qla48jqwa1bwn6d3qriizjfnv2xvl7q8akjmrkgfa46a5lrxr")))))))

(operating-system
 (kernel linux-pbp)
 (host-name "pinebook-pro")
 (timezone "Europe/Copenhagen")
 (locale "en_US.utf8")
 (keyboard-layout (keyboard-layout "us" "altgr-intl"))

 (bootloader
  (bootloader-configuration
   (target "/dev/mmcblk1boot0")
   (bootloader u-boot-pinebook-pro-bootloader)))

 (initrd-modules '()); (delq "ahci" %base-initrd-modules))

 (file-systems (append
		(list
		 (file-system
		  (device "/dev/mmcblk1p1")
		  (mount-point "/boot")
		  (type "vfat"))
		 (file-system
		  (device "/dev/mmcblk1p2")
		  (mount-point "/")
		  (type "ext4")))
		%base-file-systems))

 ;; This is where user accounts are specified.  The "root"
 ;; account is implicit, and is initially created with the
 ;; empty password.
 (users
  (cons
   (user-account
    (name "rock")
    (group "users")

    ;; Adding the account to the "wheel" group
    ;; makes it a sudoer.  Adding it to "audio"
    ;; and "video" allows the user to play sound
    ;; and access the webcam.
    (supplementary-groups '("wheel"
			    "audio" "video")))
   %base-user-accounts))

 ;; Globally-installed packages.
 (packages (append
	    (list
	     nss-certs)
	    %base-packages))

 (services (append
	    (list
	     ;; desktop environment and xorg config
	     (service xfce-desktop-service-type)
					;	      slim-service-type)
	     (simple-service 'startx-file
			     special-files-service-type
			     (let
				 ((startx
				   (xorg-start-command
				    (xorg-configuration
				     (keyboard-layout keyboard-layout)
				     (extra-config
				      '(
					;; small fix for the trackpad, as described on wiki.pine64.org
					"Section \"InputClass\"
                        		     Identifier \"touchpad catchall\"
                           		     Driver \"synaptics\"
                         		     MatchIsTouchpad \"on\"
                              		     MatchDevicePath \"/dev/input/event*\"
                           		     Option \"MinSpeed\" \"0.25\"
                                	 EndSection"))))))
			       `(("/bin/startx" ,(file-append startx "/bin/startx")))))

	     (screen-locker-service slock)
	     (screen-locker-service xlockmore "xlock")

	     ;; Add udev rules for MTP devices so that non-root users can access
	     ;; them.
	     (simple-service 'mtp udev-service-type (list libmtp))

	     ;; network management
	     (service network-manager-service-type)
	     (service wpa-supplicant-service-type)
	     (simple-service 'network-manager-applet
			     profile-service-type
			     (list network-manager-applet))
	     (service modem-manager-service-type)

	     (service usb-modeswitch-service-type)
	     (service avahi-service-type)
	     (udisks-service)
	     (service upower-service-type)
	     (service cups-pk-helper-service-type)
	     (geoclue-service)
	     (service polkit-service-type)
	     (elogind-service)
	     (dbus-service)
	     (service ntp-service-type)
	     x11-socket-directory-service
	     (service alsa-service-type))
	    %base-services))

 ;; Allow resolution of '.local' host names with mDNS.
 (name-service-switch %mdns-host-lookup-nss))
```

I wonder, does the use of `default` in `xorg-configuration` cause the default provided parameters to be evaluated and included even when the given field was initialized with a different value?

I want to try to fix this in guix but my knowledge of the project and guile are limited at the moment.

Alternatively, are there any cute workarounds I could do? I tried to find a way to do a package replacement but I couldn't see how ot make it work in this case, where the package is pulled in by a service somehow and doesn't provide a way to configure what it uses.

Thanks for helping. :)

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, February 4, 2020 11:05 AM, Efraim Flashner <[email-masked]> wrote:

> On Mon, Feb 03, 2020 at 01:22:16AM +0000, shtwzrd via Bug reports for GNU Guix wrote:
>
> > Howdy :),
> > I've found that the `set-xorg-configuration` service ends up pulling in `xf86-video-intel` as a dependency. But `xf86-video-intel` fails to build, with:
> >
> >     checking whether to include UXA support... no
> >     checking whether to include SNA support... auto
> >     checking for xvmc dri2proto x11 x11-xcb xcb-dri2 xcb-aux libdrm_intel... no
> >     checking whether to include XvMC support... no
> >     checking which acceleration method to use by default... configure: error: UXA requested as default, but is not enabled
> >     command "/gnu/store/iql3p5zvz0nwcsckdpywdkqxccx95ygx-bash-minimal-5.0.7/bin/bash" "./configure" "CONFIG_SHELL=/gnu/store/iql3p5zvz0nwcsckdpywdkqxccx95ygx-bash-minimal-5.0.7/bin/bash" "SHELL=/gnu/store/iql3p5zvz0nwcsckdpywdkqxccx95ygx-bash-minimal-5.0.7/bin/bash" "--prefix=/gnu/store/grlry4nmhxmb2ahlbpzdvyy33wgnh87h-xf86-video-intel-2.99.917-15.f66d395" "--enable-fast-install" "--build=aarch64-unknown-linux-gnu" "--with-default-accel=uxa" failed with status 1
> >
> >
> > What's more, the package definition for xf86-video-intel contains this:
> >
> >     (supported-systems
> >            ;; This driver is only supported on Intel systems.
> >            (filter (lambda (system) (or (string-prefix? "i686-" system)
> >                                         (string-prefix? "x86_64-" system)))
> >                    %supported-systems))
> >
> >
> > So it seems like it's a bug that it currently gets included on non i686 and x86_64 targets.
> > Even if I supply a modules field in set-xorg-configuration where I exclude `xf86-video-intel`, guix still tries to build it.
>
> Can you share your config? We might be able to work around it for now.
>
> > The only reference to `xf86-video-intel` is its inclusion in %default-xorg-modules -- would making the contents of that list target-aware be a potential fix?
>
> That sounds like a good long-term solution, to only include modules
> which are appropriate for that architecture.
>
> -------------------------------------------------------------------------------------------------------------------
>
> Efraim Flashner [email-masked] אפרים פלשנר
> GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
> Confidentiality cannot be guaranteed on emails sent or received unencrypted