Guix: Manifest Functions

A technically unnecessary but hopefully interesting introduction: One cool thing about Gnu Guix is the ability to use manifests, which are a declarative definition of the package outputs of a profile. In other words, instead of running the commands

guix install emacs
guix install frozen-bubble
guix install git

You can just have a manifest file like

(specifications->manifest
  '("emacs"
    "frozen-bubble"
    "git"))

saved in a file, say, “christopher-home.scm”, and then feed it into the package manager to define your whole package profile at once:

guix package -m /home/christopher/Manifests/christopher-home.scm

That is nice, because then you can just edit that file to change your package set. Also, you can backup that file, copy it to another computer, or put it under version control.

Another great feature of Guix is the ability to have multiple profiles. A profile is basically a set of package outputs that are exposed in the same place with accompanying environment information. My default profile is programs, libraries, etc. that I want to have easy access to most of the time (not including their dependencies, which is another matter taken care of “behind the scene”). But I can create another profile that just exposes a few programs and libraries that I need for some special purpose.

Probably the most likely example would be certain libraries or programs needed for building or for running some piece of downloaded software. My real life example is trying to run the downloaded (pre-built) version of the Arduino IDE, which is not yet packaged in Guix. To do this I needed some particular system libraries, as well as Java, leading to this specification:

(use-modules (gnu packages gcc))

(concatenate-manifests
 (list
  (specifications->manifest
   '("avr-toolchain"
     "dfu-programmer"
     "gcc-toolchain"
     "glibc"
     "icedtea"
     "libx11"
     "libxrandr"
     "libxtst"))
  (packages->manifest
   `((,gcc "lib")))))

In my case, I install this profile with

guix package -m /home/christopher/Manifests/arduino.scm -p /home/christopher/.guix-extra-profiles/arduino/arduino

And so we come to the ostensible purpose of this post, to describe two features useful in constructing manifests, not really covered well in the Guix reference manual:

First, there is the concatenate-manifests procedure from the (guix profiles) module. This allows you to combine together a manifest constructed by specifications->manifest, along with one constructed by packages->manifest. For most packages you want to use specifications->manifest, because that convenient procedure saves you the bother of having to explicitly import the required package definitions. But, sometimes you need packages->manifest, which leads to the second thing I wanted to mention:

When using packages->manifest, you can specify your manifest entries as tuples containing the package object followed by a string describing the specific package output you need. In my case, this is critical, as I need to use the “hidden” package gcc (in order, if you must know, to get the libstdc++ library exposed) as well as the specific package output lib, since the default output did not expose the required library.

Further reading:

Gnu Hurd on Guix

It is a simple process to build a Hurd vm from Guix:


christopher@nightshade ~/Scratch$ guix build -S guix
/gnu/store/f8qhkr6lzzmw7a5v44nqvbi1gg8cyh85-guix-1.1.0-4.bdc801e-checkout
christopher@nightshade ~/Scratch$ guix build -f /gnu/store/f8qhkr6lzzmw7a5v44nqvbi1gg8cyh85-guix-1.1.0-4.bdc801e-checkout/gnu/system/hurd.scm
/gnu/store/4l65yggpi0v6y9pi8q7aij17zx28wyzp-qemu-image
christopher@nightshade ~/Scratch$ cp /gnu/store/4l65yggpi0v6y9pi8q7aij17zx28wyzp-qemu-image ~/Scratch/
christopher@nightshade ~/Scratch$ sudo qemu-system-i386 -enable-kvm -m 512 -snapshot -hda 4l65yggpi0v6y9pi8q7aij17zx28wyzp-qemu-image

The VM from this config does not have guix (package manager) installed, so it is somewhat limited what you could do with it. (I think there is a fancier version in a Guix development branch somewhere.) But guile scheme is installed already!

From what I understand, before Guix, Debian was the only distro that had made a Gnu Hurd system practical. But Guix is making rapid progress. I believe the benefits of Guix development investment in Hurd will be more enduring also, due to the functional nature of the Guix package management system.

For the “official” Guix plans to deprecate Linux kernel support, see the following link:

http://guix.gnu.org/blog/2020/deprecating-support-for-the-linux-kernel/

Updated Guix package for HackRF

Am attempting to upload the revised package definition at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38650, but haven’t seen it show up yet. So here is the package definition (added to gnu/packages/radio.scm):

(define-public hackrf
  ;; Using a git commit because there have been many many commits
  ;; since the relase two years ago, but no sign of a promised
  ;; release for many months now.
  (let ((commit "43e6f99fe8543094d18ff3a6550ed2066c398862")
        (revision "0"))
    (package
     (name "hackrf")
     (version (git-version "2018.01.1" revision commit))
     (source
      (origin (method git-fetch)
	      (uri (git-reference
		    (url "https://github.com/mossmann/hackrf.git")
		    (commit commit)))
	      (file-name (git-file-name name version))
	      (sha256
	       (base32 "0avnv693xi0zsnrvkbfn0ln1r3s1iyj0bz7sc3gxay909av0pvbc"))))
     (build-system cmake-build-system)
     (arguments
      '(#:configure-flags
        (list "-DUDEV_RULES_GROUP=dialout"
	      (string-append "-DUDEV_RULES_PATH="
                             (assoc-ref %outputs "out")
			     "/lib/udev/rules.d"))
        #:phases
	(modify-phases %standard-phases
	  (add-before 'configure 'enter-source-directory
		      (lambda _ (chdir "host") #t))
	  (add-before 'install-license-files 'leave-source-directory
		      (lambda _ (chdir "..") #t)))
        #:tests? #f))                  ; no test suite
     (native-inputs
      `(("pkg-config" ,pkg-config)))
     (inputs
      `(("fftw" ,fftw)
        ("fftwf" ,fftwf)
	("libusb" ,libusb)))
     (home-page "https://greatscottgadgets.com/hackrf/")
     (synopsis "User-space library and utilities for HackRF SDR")
     (description
      "Command line utilities and a C library for controlling the HackRF
Software Defined Radio (SDR) over USB.  Installing this package installs
the userspace hackrf utilities and C library.  To install the hackrf
udev rules, you must add this package as a system service via
modify-services.  E.g.:

@lisp
(services
 (modify-services
  %desktop-services
  (udev-service-type config =>
   (udev-configuration (inherit config)
    (rules (cons hackrf
            (udev-configuration-rules config)))))))
@end lisp")
     (license license:gpl2))))

TiEmu Guix Package Definition

I submitted a package definition for TiEmu, a Ti calculator emulator:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40709#8

My build mysteriously is not able to load the ROMs that ship with it, but I was able to load pedrom fine from the original pedrom archive.

zs program running on pedrom on emulated TI-92

It should be fun to explorer different programs that can be run on pedrom. Mathematical programs will in principle be of the greatest interest, but I must say it is fun to be able to run pacman on a TI-89 :)

P.S. If any of my friends want to give me any TI calculators they aren’t using, I might be able to have some fun with those. I’m thinking TI-84 or fancier.