bug#65575: [PATCH v3 1/4] gnu: emacs: Use lexical binding for guix-emacs.el startup library.

2023-08-31 Thread Maxim Cournoyer
* gnu/packages/aux-files/emacs/guix-emacs.el: Declare LEXCICAL-BINDING file
variable to true.
---

(no changes since v1)

 gnu/packages/aux-files/emacs/guix-emacs.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el 
b/gnu/packages/aux-files/emacs/guix-emacs.el
index 708093267d..c98e7fe369 100644
--- a/gnu/packages/aux-files/emacs/guix-emacs.el
+++ b/gnu/packages/aux-files/emacs/guix-emacs.el
@@ -1,3 +1,4 @@
+;;; -*- lexical-binding: t; -*-
 ;;; guix-emacs.el --- Emacs packages installed with Guix
 
 ;; Copyright © 2014, 2015, 2016, 2017 Alex Kost 

base-commit: f66fa5f917e76935187935b09ae7ac037b8b35f8
-- 
2.41.0






bug#65575: [PATCH v3 3/4] gnu: emacs: Allow producing verbose messages when loading autoloads.

2023-08-31 Thread Maxim Cournoyer
* gnu/packages/aux-files/emacs/guix-emacs.el: Expound commentary.
(guix-emacs-verbose): New variable.
(guix-emacs--load-file-no-error): New procedure.
(guix-emacs-autoload-packages): Use it.

---

(no changes since v2)

Changes in v2:
- New commit

 gnu/packages/aux-files/emacs/guix-emacs.el | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el 
b/gnu/packages/aux-files/emacs/guix-emacs.el
index 4db7ec28c9..84284dde39 100644
--- a/gnu/packages/aux-files/emacs/guix-emacs.el
+++ b/gnu/packages/aux-files/emacs/guix-emacs.el
@@ -22,8 +22,9 @@
 
 ;;; Commentary:
 
-;; This file provides auxiliary code to autoload Emacs packages
-;; installed with Guix.
+;; This file provides auxiliary code to autoload Emacs packages installed with
+;; Guix.  To produce verbose messages useful while debugging, set the
+;; GUIX-EMACS-VERBOSE variable to true.
 
 ;;; Code:
 (require 'seq)
@@ -41,6 +42,15 @@ The files in the list do not have extensions (.el, .elc)."
(directory-files directory 'full-name
 guix-emacs-autoloads-regexp
 
+(defcustom guix-emacs-verbose nil
+  "Set to true to provide verbose messages, such as when loading packages."
+  :type 'boolean
+  :group 'guix-emacs)
+
+(defun guix-emacs--load-file-no-error (file)
+  "Load FILE, ignoring any errors"
+  (load file 'noerror (not guix-emacs-verbose)))
+
 (defun guix-emacs--non-core-load-path ()
   ;; Filter out core Elisp directories, which are already handled by Emacs.
   (seq-filter (lambda (dir)
@@ -63,9 +73,7 @@ The files in the list do not have extensions (.el, .elc)."
   (interactive)
   (let ((autoloads (mapcan #'guix-emacs-find-autoloads
(guix-emacs--non-core-load-path
-(mapc (lambda (f)
-(load f 'noerror t))
-  autoloads)))
+(mapc #'guix-emacs--load-file-no-error autoloads)))
 
 ;;;###autoload
 (defun guix-emacs-load-package-descriptors ()
-- 
2.41.0






bug#65575: [PATCH v3 4/4] gnu: emacs: Reload subdirs.el files in 'guix-emacs-autoload-packages'.

2023-08-31 Thread Maxim Cournoyer
This fixes a regression introduced with 79cfe30f3 ("build-system: emacs: Use
subdirectories again.") which caused the 'guix-emacs-autoload-packages' to no
longer be able to autoload all packages.

* gnu/packages/aux-files/emacs/guix-emacs.el
(guix-emacs-autoload-packages): Reload subdirs.el files unless NO-RELOAD is
provided.  Update doc.
* doc/guix.texi (Application Setup): Document that
'guix-emacs-autoload-packages' can be invoked interactively to auto-reload
newly installed Emacs packages.
* gnu/packages/emacs.scm (emacs) [arguments] : Call
guix-emacs-autoload-packages with an argument in the site-start.el file.

---

Changes in v3:
- Invert argument logic of guix-emacs-autoload-packages
- Drop the guix-emacs-autoload-packages-called state variable
- Adjust site-start.el file in Emacs package

Changes in v2:
- Safely load subdirs.el files
- Add 'reload' prefix argument as override for guix-emacs-autoload-packages

 doc/guix.texi  | 11 +++
 gnu/packages/aux-files/emacs/guix-emacs.el | 15 ---
 gnu/packages/emacs.scm |  2 +-
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 04e5875925..939e669fee 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2167,12 +2167,15 @@ Application Setup
 Emacs through the @env{EMACSLOADPATH} environment variable, which is
 set when installing Emacs itself.
 
+@cindex guix-emacs-autoload-packages, refreshing Emacs packages
 Additionally, autoload definitions are automatically evaluated at the
 initialization of Emacs, by the Guix-specific
-@code{guix-emacs-autoload-packages} procedure.  If, for some reason, you
-want to avoid auto-loading the Emacs packages installed with Guix, you
-can do so by running Emacs with the @option{--no-site-file} option
-(@pxref{Init File,,, emacs, The GNU Emacs Manual}).
+@code{guix-emacs-autoload-packages} procedure.  This procedure can be
+interactively invoked to have newly installed Emacs packages discovered,
+without having to restart Emacs.  If, for some reason, you want to avoid
+auto-loading the Emacs packages installed with Guix, you can do so by
+running Emacs with the @option{--no-site-file} option (@pxref{Init
+File,,, emacs, The GNU Emacs Manual}).
 
 @quotation Note
 Emacs can now compile packages natively.  Under the default
diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el 
b/gnu/packages/aux-files/emacs/guix-emacs.el
index 84284dde39..c253e64df8 100644
--- a/gnu/packages/aux-files/emacs/guix-emacs.el
+++ b/gnu/packages/aux-files/emacs/guix-emacs.el
@@ -65,12 +65,21 @@ The files in the list do not have extensions (.el, .elc)."
   (guix-emacs--non-core-load-path
 
 ;;;###autoload
-(defun guix-emacs-autoload-packages ()
+(defun guix-emacs-autoload-packages ( no-reload)
   "Autoload Emacs packages found in EMACSLOADPATH.
 
 'Autoload' means to load the 'autoloads' files matching
-`guix-emacs-autoloads-regexp'."
-  (interactive)
+`guix-emacs-autoloads-regexp'.  By default, the subdirs.el files
+found on the load path are reloaded to discover newly installed
+packages, unless NO-RELOAD is provided."
+  (interactive "P")
+  ;; Reload the subdirs.el files such as the one generated by the Guix profile
+  ;; hook, so that newly installed Emacs packages located under
+  ;; sub-directories are put on the load-path without having to restart Emacs.
+  (unless no-reload
+(mapc #'guix-emacs--load-file-no-error (guix-emacs--subdirs-files))
+(setq load-path (delete-dups load-path)))
+
   (let ((autoloads (mapcan #'guix-emacs-find-autoloads
(guix-emacs--non-core-load-path
 (mapc #'guix-emacs--load-file-no-error autoloads)))
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index d3689c2474..d9af6b96a7 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -244,7 +244,7 @@ (define-public emacs
 (display
  (string-append
   "(when (require 'guix-emacs nil t)\n"
-  "  (guix-emacs-autoload-packages)\n"
+  "  (guix-emacs-autoload-packages 'no-reload)\n"
   "  (advice-add 'package-load-all-descriptors"
   " :after #'guix-emacs-load-package-descriptors))"
 ;; Remove the extraneous subdirs.el file, as it causes Emacs to
-- 
2.41.0






bug#65575: [PATCH v3 2/4] gnu: emacs: Factorize a 'guix-emacs--subdirs-files' procedure.

2023-08-31 Thread Maxim Cournoyer
* gnu/packages/aux-files/emacs/guix-emacs.el
(guix-emacs--subdirs-files): New procedure.
(guix-emacs-load-package-descriptors): Use it.

---

(no changes since v2)

Changes in v2:
- Fix unbound 'dir' variable

 gnu/packages/aux-files/emacs/guix-emacs.el | 34 +-
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el 
b/gnu/packages/aux-files/emacs/guix-emacs.el
index c98e7fe369..4db7ec28c9 100644
--- a/gnu/packages/aux-files/emacs/guix-emacs.el
+++ b/gnu/packages/aux-files/emacs/guix-emacs.el
@@ -3,7 +3,7 @@
 
 ;; Copyright © 2014, 2015, 2016, 2017 Alex Kost 
 ;; Copyright © 2017 Kyle Meyer 
-;; Copyright © 2019 Maxim Cournoyer 
+;; Copyright © 2019, 2023 Maxim Cournoyer 
 
 ;; This file is part of GNU Guix.
 
@@ -47,6 +47,13 @@ The files in the list do not have extensions (.el, .elc)."
 (string-match-p "/share/emacs/site-lisp" dir))
   load-path))
 
+(defun guix-emacs--subdirs-files ()
+  "Return the Guix subdirs.el files found on the (non-core) load path."
+  (seq-filter #'file-exists-p
+  (mapcar (lambda (dir)
+(expand-file-name "subdirs.el" dir))
+  (guix-emacs--non-core-load-path
+
 ;;;###autoload
 (defun guix-emacs-autoload-packages ()
   "Autoload Emacs packages found in EMACSLOADPATH.
@@ -63,19 +70,18 @@ The files in the list do not have extensions (.el, .elc)."
 ;;;###autoload
 (defun guix-emacs-load-package-descriptors ()
   "Load descriptors for packages found in EMACSLOADPATH via subdirs.el."
-  (dolist (dir (guix-emacs--non-core-load-path))
-(let ((subdirs-file (expand-file-name "subdirs.el" dir)))
- (when (file-exists-p subdirs-file)
-  (with-temp-buffer
-(insert-file-contents subdirs-file)
-(goto-char (point-min))
-(let ((subdirs (read (current-buffer
-  (and (equal (car-safe subdirs) 'normal-top-level-add-to-load-path)
-   (equal (car-safe (cadr subdirs)) 'list)
-   (dolist (subdir (cdadr subdirs))
- (let ((pkg-dir (expand-file-name subdir dir)))
-   (when (file-directory-p pkg-dir)
- (package-load-descriptor pkg-dir)))
+  (dolist (subdirs-file (guix-emacs--subdirs-files))
+(with-temp-buffer
+  (insert-file-contents subdirs-file)
+  (goto-char (point-min))
+  (let ((subdirs (read (current-buffer
+(and (equal (car-safe subdirs) 'normal-top-level-add-to-load-path)
+ (equal (car-safe (cadr subdirs)) 'list)
+ (dolist (subdir (cdadr subdirs))
+   (let ((pkg-dir (expand-file-name
+   subdir (file-name-directory subdirs-file
+ (when (file-directory-p pkg-dir)
+   (package-load-descriptor pkg-dir)
 
 ;; If emacs built with tree-sitter, read the value of the environment variable
 ;; to make tree-sitter grammars available in emacs out-of-the-box.
-- 
2.41.0






bug#65670: wrap-script allows the guile argument to be #f

2023-08-31 Thread Maxim Cournoyer
Hi,

wrap-script should ensure that there's a Guile provided in the inputs of
the package; currently it can end up using #f without a warning.

It should abort with a clear error.

-- 
Thanks,
Maxim





bug#65184: (modify-services … (delete …)) should delete all matching service types

2023-08-31 Thread Felix Lechner via Bug reports for GNU Guix
Hi Maxim,

On Thu, Aug 31, 2023 at 8:49 PM Maxim Cournoyer
 wrote:
>
> > Fixes: #64106

Thanks for taking action. Can Bug#63921 also be closed?

Kind regards
Felix





bug#65184: (modify-services … (delete …)) should delete all matching service types

2023-08-31 Thread Maxim Cournoyer
Hi Brian!

Brian Cully  writes:

> This patch reverts the behavior introduced in
> 181951207339508789b28ba7cb914f983319920f which caused ‘modify-services’
> clauses to only match a single instance of a service.
>
> We will now match all service instances when doing a deletion or update, while
> still raising an exception when trying to match against a service that does
> not exist in the services list, or which was deleted explicitly by a ‘delete’
> clause (or an update clause that returns ‘#f’ for the service).
>
> Fixes: #64106
>
> * gnu/services.scm (%modify-services): New procedure.
> (modify-services): Use it.
> (apply-clauses): Add DELETED-SERVICES argument, change to modify one service
> at a time.
> * tests/services.scm
> ("modify-services: delete then modify"),
> ("modify-services: modify then delete"),
> ("modify-services: delete multiple services of the same type"),
> ("modify-services: modify multiple services of the same type"): New tests.

[...]

I've applied the following cosmetic changes:

--8<---cut here---start->8---
1 file changed, 20 insertions(+), 18 deletions(-)
gnu/services.scm | 38 --

modified   gnu/services.scm
@@ -325,11 +325,13 @@ (define-syntax clause-alist
  '(
 
 (define (apply-clauses clauses service deleted-services)
+  "Apply CLAUSES, an alist as returned by 'clause-alist', to SERVICE.  An
+exception is raised if a clause attempts to modify a service
+present in DELETED-SERVICES."
   (define (raise-if-deleted kind properties)
-(match (find (lambda (deleted)
-   (match deleted
- ((deleted-kind _)
-  (eq? kind deleted-kind
+(match (find (match-lambda
+   ((deleted-kind _)
+(eq? kind deleted-kind)))
  deleted-services)
   ((_ deleted-properties)
(raise (make-compound-condition
@@ -344,27 +346,27 @@ (define (apply-clauses clauses service deleted-services)
 
   (match clauses
 (((kind proc properties) . rest)
- (begin
-   (raise-if-deleted kind properties)
-   (if (eq? (and service (service-kind service))
-kind)
-   (let ((new-service (proc service)))
- (apply-clauses rest new-service
-(if new-service
-deleted-services
-(cons (list kind properties)
-  deleted-services
-   (apply-clauses rest service deleted-services
+ (raise-if-deleted kind properties)
+ (if (eq? (and service (service-kind service)) kind)
+ (let ((new-service (proc service)))
+   (apply-clauses rest new-service
+  (if new-service
+  deleted-services
+  (cons (list kind properties)
+deleted-services
+ (apply-clauses rest service deleted-services)))
 (()
  service)))
 
 (define (%modify-services services clauses)
+  "Apply CLAUSES, an alist as returned by 'clause-alist', to SERVICES.  An
+exception is raised if a clause attempts to modify a missing service."
   (define (raise-if-not-found clause)
 (match clause
   ((kind _ properties)
-   (when (not (find (lambda (service)
-  (eq? kind (service-kind service)))
-services))
+   (unless (find (lambda (service)
+   (eq? kind (service-kind service)))
+ services)
  (raise (make-compound-condition
  (condition
   (
--8<---cut here---end--->8---

and installed it.  Thanks for contributing to Guix!

-- 
Thanks,
Maxim





bug#65667: Using gexps for snippets is often not possible due to top-level dependency cycles

2023-08-31 Thread Maxim Cournoyer
Hi Guix,

Our documentation mentions that snippets can be a gexp.  Sadly, this is
rarely possible in practice because it seems to be prone to top-level
dependency cycles between the modules.

The solution would be to turn the snippet field into a thunked field,
and measure what is the incurred performance penalty.

-- 
Thanks,
Maxim





bug#65572: Black screen in installer

2023-08-31 Thread pelzflorian (Florian Pelz)
Hi Iku-Tulo, one more thing, could you confirm that `nomodeset` alone
without video=uvesafb really is not enough?

Regards,
Florian





bug#65572: [PATCH v2] doc: Describe black screen issue when booting the installer.

2023-08-31 Thread Florian Pelz
With suggestions by Iku-Tulo Vilutar .
Fixes .

* doc/guix.texi (System Installation): Add suggestion when
booting the installer fails with a black screen.
---
Improved wording:
* added "after waiting for two minutes"

 doc/guix.texi | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 04e5875925..fba9df1cce 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2402,6 +2402,16 @@ BIOS or UEFI boot menu, where you can choose to boot 
from the USB stick.
 In order to boot from Libreboot, switch to the command mode by pressing
 the @kbd{c} key and type @command{search_grub usb}.
 
+Sadly, on some machines, the installation medium cannot be properly
+booted and you only see a black screen after booting even after you
+waited for two minutes.  This may indicate that your machine cannot run
+Guix System; perhaps you instead want to install Guix on a foreign
+distro (@pxref{Binary Installation}).  If you are adventurous, a
+possible workaround is pressing the @kbd{e} key in the GRUB boot menu
+and appending @option{nomodeset video=uvesafb} to the Linux bootline.
+Sometimes the black screen issue can also be resolved by connecting a
+different display.
+
 @xref{Installing Guix in a VM}, if, instead, you would like to install
 Guix System in a virtual machine (VM).
 

base-commit: b51e45d3aaa8a85d39a8a4c3d18e8b57254aeaf2
-- 
2.41.0






bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs

2023-08-31 Thread Ulf Herrman
#:deep? #t currently works by interposing a dummy build system that
lowers the package to a bag using the original build system, then
applies the supplied transformation to all of the bag's inputs, then
returns a new bag with the new inputs.

The problem with this approach is that it doesn't affect the bag
arguments.  This means that packages passed in as arguments may still
end up being used without being transformed.  Worse still, packages
*not* passed in as arguments may end up being used *unless one is
explicitly passed in as an argument*, as is the case with
qt-build-system's #:qtbase argument.

In short, the current approach of having the build-system lower
procedure leave the arguments mostly unchanged and letting the
bag->derivation procedure (the "bag builder") fill in lots of defaults
means that there are implicit inputs that cannot be touched at the
package level without adding special logic for every single build system
that does something like this.

I propose that we have the build system lower procedure (that is, the
one that converts from package to bag) completely fill in the argument
list with all defaults, and we modify build-system-with-package-mapping
to transform all arguments that look like a package or a list of
packages (or maybe even a tree containing packages).

Many large-scale package transformations have their purpose defeated if
even a single package slips through and has to be built or downloaded
separately (e.g. "I wanted to use a more minimal version of P, and now I
have both the original version of P *and* a more minimal version of P
*and* a duplicate copy of a large portion of the package graph...").  In
fact, in some situations, this could cause exponential growth of the
number of packages, e.g. a transformation is applied to qtbase and its
dependencies, but not to the implicit version and its dependencies, so
now all the dependencies of qtbase are duplicated, and if this happens
again at a higher level with something that depends on a package with
qt-build-system, now there are four duplicate subgraphs, and so on.

What do you think?

- Ulf


signature.asc
Description: PGP signature


bug#64569: [bug #64569] Document how GNU Boot deblobs coreboot

2023-08-31 Thread Denis 'GNUtoo' Carikli
Hi,

> It would be good that our documentation explains how GNU Boot deblobs
> coreboot for each board and how users can remove new blobs if they
> found some (it would help people to create patches for us, knowing
> where blobs are identified)
Having blob specific documentation not in the code would probably
increase maintenance cost if we want to keep it in sync with the code.

Another way to do that would be to do like with u-boot-libre which is:
- to document what is being removed directly in the source code 
- to have only one source file that generates various released files
- to make it as easy as possible to reuse the source or various
  released files like the script that does the deblobing, tarballs, etc.
- If time permits to do releases of that in two different ways:
  - One as part of GNU Boot releases: we need to provide the deblobbed
Coreboot source code we use as part of GNU Boot releases.
  - One separate that will look more like linux-libre that will not
patch Coreboot at all, but only deblob it and produce releases
matching Coreboot releases.

As for having multiple outputs:
- I've not looked in details but for instance Guix doesn't seem to
  use linux-libre tarballs and instead it seems to produce its own
  source files by running the deblobing scripts.
- Other distributions use linux-libre tarballs (like Parabola).

So if the goal is to make it easily reusable having multiple outputs
make it way easier.

A way to do it would be to unify the blob list files like that:
$ cat ./resources/coreboot/default/blobs.list \
  ./resources/coreboot/fam15h_rdimm/blobs.list \
  ./resources/coreboot/fam15h_udimm/blobs.list | sort -u

And then at least to add support for comments in this file list, and
find where to put that file (which is not as easy as it seems).

The advantage is that it would then be easy to do and easy to maintain.

As for moving the file, you might need commits like this one which is
in GNUtoo/various-fixes branch:
> d73e45aa build: options: only show executables scripts

I'm not sure if it's sufficient but we can probably hack our way around
somehow by not listing resources/deblob for instance if we move it
there.

Denis.


pgphoEGaKspd0.pgp
Description: OpenPGP digital signature


bug#65572: Black screen in installer

2023-08-31 Thread Iku-Tulo Vilutar
Looks good to me. Thank you.

On Thu, 31 Aug 2023 at 13:52, pelzflorian (Florian Pelz) <
pelzflor...@pelzflorian.de> wrote:

> Hello Iku-Tulo, thank you for the report.
>
> Vilutar  writes:
> > intelfb: Version 0.9.6
> > intelfb: Cannot reserve FB region
>
> An unlikely guess: I have had problems with a black screen when using a
> television as a screen.  However this does not sound like it.
>
> > Then I tried `nomodeset video=uvesafb` Linux parameters and the GUI
> > now rendered. I don't know if these work as a global workaround for
> > other machines,
>
> No, there have been reports that uvesafb does not work on every machine.
>
> > should they be documented in the installation
> > instructions?
>
> Yes, if we can give proper instructions.  Perhaps the attached patch?
>
> Regards,
> Florian
>
>


bug#65572: Black screen in installer

2023-08-31 Thread pelzflorian (Florian Pelz)
Hello Iku-Tulo, thank you for the report.

Vilutar  writes:
> intelfb: Version 0.9.6
> intelfb: Cannot reserve FB region

An unlikely guess: I have had problems with a black screen when using a
television as a screen.  However this does not sound like it.

> Then I tried `nomodeset video=uvesafb` Linux parameters and the GUI
> now rendered. I don't know if these work as a global workaround for
> other machines,

No, there have been reports that uvesafb does not work on every machine.

> should they be documented in the installation
> instructions?

Yes, if we can give proper instructions.  Perhaps the attached patch?

Regards,
Florian

From: Florian Pelz 
Date: Thu, 31 Aug 2023 12:44:55 +0200
Subject: [PATCH] doc: Describe black screen issue when booting the installer.

With suggestions by Iku-Tulo Vilutar .
Fixes .

* doc/guix.texi (System Installation): Add suggestion when
booting the installer fails with a black screen.
---
 doc/guix.texi | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 04e5875925..5aeed7851d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2402,6 +2402,16 @@ BIOS or UEFI boot menu, where you can choose to boot from the USB stick.
 In order to boot from Libreboot, switch to the command mode by pressing
 the @kbd{c} key and type @command{search_grub usb}.
 
+Sadly, on some machines, the installation medium cannot be properly
+booted and you only see a black screen after booting.  This may
+indicate that your machine cannot run Guix System; perhaps you instead
+want to install Guix on a foreign distro (@pxref{Binary
+Installation}).  If you are adventurous, a possible workaround is
+pressing the @kbd{e} key in the GRUB boot menu and appending
+@option{nomodeset video=uvesafb} to the Linux bootline.  Sometimes the
+black screen issue can also be resolved by connecting a different
+display.
+
 @xref{Installing Guix in a VM}, if, instead, you would like to install
 Guix System in a virtual machine (VM).
 

base-commit: 299d0463d54c97b237deb2fe9e464108544344c0
-- 
2.41.0