GNU Guix session logs
Table of Contents
- 1. Participants
- 2. Next session
- 3. Subjects discussed on 13/12/2019, 2:00 to 4:00 PM
- 3.1. TODO Creating custom bootable images of GNU/Guix
- 3.2. Using Spacemacs with GNU/Guix package manager
- 3.3. Defining packages with private sources
- 3.4. Adding a desktop shortcut and icons when installing a package
- 3.5. Modifying GRUB configuration options
- 3.6. Intel C compiler package
- 3.7. Fixing the warning
guile: failed to install locale
- 4. Subjects discussed on 07/02/2020, 2:00 to 4:00 PM
- 4.1. Make manual pages for C functions available in GNU/Guix
- 4.2. Prevent GNU/Guix from upgrading when substitutes are not available
- 4.3. TODO Not working packages in the GNU/Guix repository
- 4.4. TODO Shared
channels.scm
- 4.5. Intel compilers
- 4.6. Creating packages using binaries
- 4.7. Add a package into current environment
- 4.8. Multiple usage of the
--with-source
option - 4.9. Using private repositories for channels/packages
In this document, we give an exhaustive summary of our sessions on GNU/Guix with its main maintainer and contributor Ludovic Courtès at Inria Bordeaux.
For items marked with TODO there is something to be done!
1. Participants
- Ludovic Courtès, researcher, Inria
- Marek Felsoci, PhD student, Inria
- Romain Peressoni, PhD student, Inria
- Emmanuel Agullo, researcher, Inria
- Matthieu Simonin, intern, Inria
- Victor Lederer, intern, Inria
2. Next session
All the information related to the next session can be found on our dedicated pad.
3. Subjects discussed on 13/12/2019, 2:00 to 4:00 PM
3.1. TODO Creating custom bootable images of GNU/Guix
In GNU/Guix, a single Scheme configuration file, /etc/config.scm
, defines
the main elements of system configuration such as the Linux kernel to use,
the list of firmware to load, the disk partitions to create, the locale to
activate, the services to launch, the desktop manager to use, the user accounts
to create and so forth.
3.1.1. System configuration file
So, in order to define a custom operating system configuration, one should start
by writing the configuration file describing the desire state of the system. To
make things simpler, several template files exist. They can be found under the
path $HOME/.config/guix/current/share/guile/site/2.2/gnu/system/examples
. The
most interesting templates in this case are lightweight-desktop.tmpl
and
desktop.tmpl
. The former defines a basic system with core packages and
services. The latter defines a complete system with GNOME user environment.
3.1.2. Custom channels
Our idea is to create a customized GNU/Guix USB bootable key for the members of
the HiePACS team pre-configured with basic packets such as emacs
but also with
unofficial software channels developed, for example, at Inria.
Let us say that we want to use the guix-hpc
channel. For this, we need to add
it to the list of user-defined channels in our user profile. What we want to
achieve is to make such channels available by default immediately after a fresh
installation of the system on a PC. To this end, we discussed several ideas.
- Extend the built-in
%default-channels
list
This approach is not doable in the current implementation of GNU/Guix.
- Provide custom system configuration with
/etc/guix/channels.scm
file
This way, the complementary channels file can be generated and autmatically placed to the above location. The drawback of this method is that, if at some point the end-user adds his own profile-specific channels file to his home directory, it will overwrite the one in
/etc/guix/channels.scm
. For illustration, the latter should contain something like (to be improved):(simple-service 'system-wide-channels etc-service-type `(("guix" ,%etc-guix-directory)))
- Auto-generate profile-specific channel file for every new user account
Here, the idea is to create a
channels.scm
file in$HOME/.config/guix/
containing the Inria (and possibly other) channels automatically whenever a user account is created on the system (e. g. during installation). The file would look like follows. This way, even if the end-user needs to add his own channels, he would simply do it by adding the channels to this list without accidentaly overwriting the channels added automatically.(append %default-channels (list (channel (name 'guix-hpc) (url "https://gitlab.inria.fr/guix-hpc/guix-hpc.git") (branch "master")) (channel (name 'guix-hpc-non-free) (url "https://gitlab.inria.fr/guix-hpc/guix-hpc-non-free.git") (branch "master")) (channel (name 'guix-extra) (url "https://gitlab.inria.fr/mfelsoci/guix-extra.git") (branch "master"))))
The third approach seems to be ideal, although we did not think about how to make it work yet. In the first place, we should decide what do we want our custom system to contain exactly!
3.2. Using Spacemacs with GNU/Guix package manager
Some efforts are being made. See the issue https://issues.guix.gnu.org/issue/38643. Below follow the findings of Emmanuel (unmodified):
spacemacs
- nixos
spacemacs layer (!) et réflexion en cours pour que les dépendances des layers spacemacs soient traduites en expressions nix encoder les dépendances emacs: "The dream is to build a spacemacs2nix tool to encode emacs dependencies from spacemacs layers into nix expressions"
- travail de SaffronNail sur guix/spacemacs:
guix scm, spacemacs fork for guix et la spacemacs pull request correspondante avec suggestion d'installation. packaging emacs: emacs reference, guix build systems (see emacs-build-system)
Paquets emacs
Lorsque vous installez les paquets Emacs avec Guix, les fichiers elisp peuvent
être placés soit dans $HOME/.guix-profile/share/emacs/site-lisp/
soit dans des
sous-répertoires de $HOME/.guix-profile/share/emacs/site-lisp/guix.d/
. Ce
dernier existe car il existe potentiellement des milliers de paquets Emacs et
stocker leurs fichiers dans un seul répertoire peut ne pas ^etre fiable (à cause
de conflits de noms). Donc on pense qu’utiliser un répertoire séparé est une
bonne idée. C’est très similaire à la manière dont le système de paquet d’Emacs
organise la structure de fichiers (voir Section “Package Files” dans The GNU
Emacs Manual).
Par défaut, Emacs (installé avec Guix) « sait » où ces paquets ce trouvent, donc vous n’avez pas besoin de le configurer. Si, pour quelque raison que ce soit, vous souhaitez éviter de charger automatiquement les paquets Emacs installés avec Guix, vous pouvez le faire en lançant Emacs avec l’option –no-site-file (voir Section “Init File” dans The GNU Emacs Manual).
3.3. Defining packages with private sources
When defining packages corresponding to proprietary Airbus software with closed source code, we ran into an important issue. The package definition is not usable as is because the installer ignores the request of git for providing user credentials when fetching a private repository.
Apparently, someone is already working on the problem and in the near future
we should be able to use SSH fetch. For now, we use the options --with-source
and --with-git-url
to make the installer search for sources in a local clone
of the desired repository.
3.4. Adding a desktop shortcut and icons when installing a package
*.desktop
files should reside under
/gnu/store/<my_software_folder>/share/applications
and icon files under
/gnu/store/<my_software_folder>/share/icons/hicolor/<resolution>/apps/<name>
where <resolution>
stands for to 16x16
or 32x32
or any other available
icon image resolution and <name>
corresponds to the icon file name given in
the application's *.desktop
file.
Note that, this should be done automatically. Otherwise, one can extend concerned package definition to copy the aforementioned files automatically to their respective locations. See an example below (QtCreator package definition).
(arguments '(;; other code ... #:phases (modify-phases %standard-phases ;; other code ... (add-after 'install 'create-shortcut (lambda _ ;; Install the '*.desktop' file. (install-file (string-append "../source/dist/" "org.qt-project.qtcreator.desktop") (string-append (assoc-ref %outputs "out") "/share/applications")) ;; Install icons in various resolutions. (for-each (lambda (resolution) (mkdir-p (string-append (assoc-ref %outputs "out") "/share/icons/hicolor/" resolution "/apps")) (copy-file (string-append "../source/src/app/" "qtcreator.xcassets/" "qtcreator.appiconset/icon_" resolution ".png") (string-append (assoc-ref %outputs "out") "/share/icons/hicolor/" resolution "/apps/QtProject-qtcreator.png") )) (list "16x16" "32x32" "128x128" "256x256" "512x512")) #t))) ;; other code... ))
3.5. Modifying GRUB configuration options
See the paragraph kernel-arguments in the section Operating system of the official GNU/Guix reference guide.
3.6. Intel C compiler package
A definition of such package already exists but it needs to be reviewed and cleaned first.
3.7. Fixing the warning guile: failed to install locale
Whenever the package libc is updated, the installed locales become incompatible with the latter. The solution is to update the locales. See the section Application Setup in the official GNU/Guix reference guide.
4. Subjects discussed on 07/02/2020, 2:00 to 4:00 PM
4.1. Make manual pages for C functions available in GNU/Guix
Manual pages for C functions are not available in GNU/Guix by default. The
package man-pages
shall be installed to access them.
4.2. Prevent GNU/Guix from upgrading when substitutes are not available
It often takes some time for substitutes to be available for recently updated
packages in GNU/Guix. Whenever substitutes are missing, the corresponding
sources are downloaded and built from scratch instead. This is O.K. for small
packages but for huge ones, such as ungoogled-chromium
or icecat
, the build
can take up to one hour or more depending on the machine.
Unfortunately, there is no option to prevent the system from upgrading those packages for which there are no substitutes available. Such an option would represent a security risk as the system might remain out of date for a relatively long period.
Nevertheless, a kind of workaround does exist. Before performing an actual
upgrade, one should run the command guix upgrade --dry-run
first in order to
see which packages are getting updated. If there are any huge packages present,
one can decide to not to perform the update immediately.
4.3. TODO Not working packages in the GNU/Guix repository
Some packages fail to compile despite being available through the official GNU/Guix repository.
A manual solution would be to take the last derivation of the system in which the packages concerned are still working. But this should be done automatically.
4.4. TODO Shared channels.scm
The idea is to create and maintain a HiePACS team-wide and shared channels list
available also on PlaFRIM through /etc/guix/channels.scm
, and ideally, without
getting overriden by users' channel lists in their home repositories if any.
4.5. Intel compilers
The corresponding package is now available through the guix-hpc-non-free
channel created and maintained at Inria. The package is called intel-compilers
and the version to be installed on PlaFRIM is 2019.4
as the license is valid
only for the latter. For personal use, students can obtain a free license from
Intel and use even the most recent version on their computers.
4.6. Creating packages using binaries
Especially packages featuring non-free software use binaries directly instead of having access to program's sources.
In this case, the problem is that, the pre-compiled executables may have trouble to locate some libraries on GNU/Guix. The workaround is to modify such executables and update concerned library paths. See a definition of a non-free package such us MKL to see how to achieve this.
4.7. Add a package into current environment
Unfortunately, there is no way to add a supplementary package to an already existing Guix environment.
4.8. Multiple usage of the --with-source
option
This option can only be applied to leaf packages, those which are getting built or installed, but not to their possible dependencies.
For example, there is no way to make the command below work. Here, we try to
build pkgB
which depends on pkgA
while loading their sources from tarballs.
The option --with-source
will only work for pkgB
which is the leaf package
in this case.
guix build pkgB --with-source=pkgB=pkgB.tar.gz --with-source=pkgA=pkgA.tar.gz
4.9. Using private repositories for channels/packages
Since recently, it is possible to declare channels and packages hosted in private repositories as the authentication via SSH has been made available.
Do not forget to use SSH-format links in your channel/package definitions. Also,
channel repositories should contain a proper definition file .guix-channel
.
See an example of a private channel definition below.
... (channel (name 'guix-hpc-airbus) (url "git@gitlab.inria.fr:mfelsoci/guix-hpc-airbus.git") (branch "master") ...