Subject: bug#54631: Unable to determine system origin when configuration stored in guix channel

From: "Collin J. Doering" <[email-masked]>
Date: Tue, 29 Mar 2022 22:03:36 -0400

Hi,

I recently converted my guix configuration to be stored in a channel, primarily to allow me to reference files in the repository but yet still have a self-contained configuration. It also allows me to easily build packages and images from my local guix instance.  I also like how the specification of my system (or home) is precisely defined by a set of channels, and an expression which evaluates to the operating-system (or home-configuration) that I'm deploying.

As per the guix manual:

--8<---------------cut here---------------start------------->8---
If you want configuration.scm to be self-contained, we recommend that modules or files it refers to be part of a channel.
--8<---------------cut here---------------end--------------->8---

This all being said, I noticed an issue in that I'm unable to determine the provenance of a system when my configuration is stored in a guix channel.

Specifically, if I have a guix channel that contains two modules, each of which exports a %system variable of type operating-system, I cannot tell which one was used to instantiate the system. This is due to two issues. The first is because when `-e|--expression` arguments are used, `configuration-file` is set to `#f` in the generations provenance file but the expression itself is not stored in the provenance file, and is not listed in `guix system describe`, `guix system list-generations`, etc.. commands.

--8<---------------cut here---------------start------------->8---
sudo -i guix system reconfigure -e '(@ (my config system-a) %system)'
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
➜ guix system describe        
Generation 30	Mar 28 2022 22:50:55	(current)
  file name: /var/guix/profiles/system-30-link
  canonical file name: /gnu/store/886xwflic0dnf86d460yf7n5wg3jng7w-system
  label: GNU with Linux 5.16.16
  bootloader: grub-efi
  root device: label: "root"
  kernel: /gnu/store/44hi9qg3mrp6c6cb1rqwx47xhg1663d9-linux-5.16.16/bzImage
  channels:
    guix:
      repository URL: https://git.savannah.gnu.org/git/guix.git
      branch: master
      commit: e584a093f943be216fdc93895281fde835836b8d
    my-config-channel:
      repository URL: https://not-yet-on-the-internet.com
      branch: master
      commit: 918a3bf799038a019c7394cda480ee67db8a0009
--8<---------------cut here---------------end--------------->8---

Change the system to 'system-b':

--8<---------------cut here---------------start------------->8---
sudo -i guix system reconfigure -e '(@ (my config system-b) %system)'
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
➜ guix system describe        
Generation 31	Mar 28 2022 23:10:01	(current)
  file name: /var/guix/profiles/system-31-link
  canonical file name: /gnu/store/jpkxxyh6zi3gh8pbml3r9l1iccibw5mk-system
  label: GNU with Linux 5.16.16
  bootloader: grub-efi
  root device: label: "root"
  kernel: /gnu/store/jpkxxyh6zi3gh8pbml3r9l1iccibw5mk-linux-5.16.16/bzImage
  channels:
    guix:
      repository URL: https://git.savannah.gnu.org/git/guix.git
      branch: master
      commit: e584a093f943be216fdc93895281fde835836b8d
    my-config-channel:
      repository URL: https://not-yet-on-the-internet.com
      branch: master
      commit: 918a3bf799038a019c7394cda480ee67db8a0009
--8<---------------cut here---------------end--------------->8---

Notice how there is no way to see which configuration was used to create the system.

The second issue is that when `-L|--load-path` is used along with either a file or expression to specify the operating-system or home-configuration, it essentially 'tarnishes' the provenance of the system, in that the following deployment is not differentiable from the preceding one/s, despite them being different.

--8<---------------cut here---------------start------------->8---
sudo -i guix system reconfigure -L my-local-channel-but-with-changes -e '(@ (my config system-a) %system)'
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
➜ guix system describe        
Generation 32	Mar 28 2022 23:10:01	(current)
  file name: /var/guix/profiles/system-32-link
  canonical file name: /gnu/store/s1f82wy0mj1zv3jvrzzc86h86zrdv336-system
  label: GNU with Linux 5.16.16
  bootloader: grub-efi
  root device: label: "root"
  kernel: /gnu/store/s1f82wy0mj1zv3jvrzzc86h86zrdv336-linux-5.16.16/bzImage
  channels:
    guix:
      repository URL: https://git.savannah.gnu.org/git/guix.git
      branch: master
      commit: e584a093f943be216fdc93895281fde835836b8d
    my-config-channel:
      repository URL: https://not-yet-on-the-internet.com
      branch: master
      commit: 918a3bf799038a019c7394cda480ee67db8a0009
--8<---------------cut here---------------end--------------->8---

Thank you for reading

-- 
Collin J. Doering

http://rekahsoft.ca
http://blog.rekahsoft.ca
http://git.rekahsoft.ca