‘The half minute which we daily devote to the winding-up of our watches is an exertion of labour almost insensible; yet, by the aid of a few wheels, its effect is spread over the whole twenty-four hours.’

Guix, Nix: You are in a maze of twisty little $PATHs, some undefined

Benjamin Slade

Some notes on interactive fiction/text adventure games and PATHs in Guix, and StumpWM.

Maze no. 1 #

There may (likely is) some way of programmatically setting the X Windows PATH variable in Guix System (née GuixSD) via the base configuration (e.g. config.scm), but I haven’t been able to uncover anything that works. This is relevant for being able to use locally installed static binaries or local shell scripts via the window manager.

As a window-manager-specific workaround, in StumpWM, one can programmatically set PATH variables via (setf (getenv "VARIABLE_NAME") "variable-value"). Thus, if you store local static binaries and shell scripts in ~/bin, the following (which you could include in StumpWM’s init.lisp) will add that to your PATH variable:

(setf (getenv "PATH") (concat "/home/YOURUSERNAME/bin:" (getenv "PATH")))

I use this with a static Haskell binary greenclip, which adds clipboard functionality to rofi, and with shell scripts that give “pretty names” to Flatpak run commands.

For example, the literate/natural-language-based programming interactive fiction design language Inform7 (which is due to be open-sourced sometime this year) is now conveniently available as a Flatpak. But the run command after installing is flatpak run com.inform7.IDE, which is non-ideal. So I made a simple shell script named inform7 placed in ~/bin:

#!/bin/sh
flatpak run com.inform7.IDE

Maze no. 2 #

Nix can be installed as a standalone package manage on top of other distros, including Guix System, which is useful for be able to obtain software currently lacking in Guix System (including, ironically, Hugo, used by this blog, which is present in Nix). Packages available in Nix but not in Guix include Gargoyle, a very nice interactive fiction front-end client that supports a number of different backends, including Frotz and Glulxe. One of the benefits of Gargoyle is that it “cares about typography”. However, Nix applications by default seem to have trouble finding/seeing fonts, including system fonts, local fonts, and even fonts installed via Nix.

This can be fixed by (1) setting the FONTCONFIG_PATH and FONTCONFIG_FILE, e.g. in StumpWM this can be done with:

(setf (getenv "FONTCONFIG_PATH") "/home/YOURUSERNAME/.config/fontconfig/")
(setf (getenv "FONTCONFIG_FILE") "fonts.conf")

And (2) forcing Nix to look in the right places by manual specification in ~/.config/fontconfig/fonts.conf, adding right before the final </fontconfig> (as appropriate):

<cachedir prefix="xdg">fontconfig</cachedir>
<dir>/home/YOURUSERNAME/.local/share/fonts/</dir>
<dir>/home/YOURUSERNAME/.nix-profile/share/fonts/</dir>
<dir>/home/YOURUSERNAME/.guix-profile/share/fonts/</dir>
<dir>/usr/share/fonts</dir>

And regenerating the font cache (via fc-cache -fv) [possibly you may need to install Nix’s fontconfig package].