Guix (Debian) Server

This org-babel session uses TRAMP to manage a freshly installed remote Debian server (named guixvm) over SSH. For more infomration about this style of administration see Howard Abrams’ Literate DevOps.

Configure SSH access

First of all, you need the guixvm host configured in your workstation’s ~/.ssh/config:

## In ~/.ssh/config
Host guixvm
     Hostname 10.10.1.2
     User ryan
     ControlMaster auto
     ControlPersist yes
     ControlPath /tmp/ssh-%u-%r@%h:%p
     UserKnownHostsFile ~/.ssh/known_hosts

Install Guix

On the remote host, install guix and have it pull updates. The next block will run asynchronously and will take quite a long while to complete (guix pull is super slow):

sudo apt update
sudo apt install -y guix colorized-logs
time guix pull 2>&1 | ansi2txt

Configure the bourne shell profile for guix:

cat <<'EOF' >> ~/.profile

export GUIX_PROFILE=~/.guix-profile
. ${GUIX_PROFILE}/etc/profile

EOF

Install Emacs

Install some packages:

# ansi2txt filters out fancy text so it doesnt give org-babel grief:
guix package -i emacs | ansi2txt

Emacs is now installed in the user guix-profile, and it is a shell script that points to the Emacs binary in the root guix store (/gnu/store/..../bin/.emacs-28.2-real):

1
cat ~/.guix-profile/bin/emacs
(stdout)
#!/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash
export XDG_DATA_DIRS="/gnu/store/jkngmzz91vzd47d9lw777d9ihcw8aqpf-shared-mime-info-1.15/share:/gnu/store/2jj2mxn6wfrcw7i85nywk71mmqbnhzps-glib-2.70.2/share:/gnu/store/y21hxgpcl7q2nvr8p7blhvx64xaw3rs8-gtk+-3.24.30/share:/gnu/store/rfggqmqzcpz4wwjhj2y0bcfmqx8c8i93-emacs-28.2/share${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"
export GTK_PATH="/gnu/store/y21hxgpcl7q2nvr8p7blhvx64xaw3rs8-gtk+-3.24.30/lib/gtk-3.0${GTK_PATH:+:}$GTK_PATH"
export PATH="$PATH${PATH:+:}/gnu/store/0c1yfbxyv877mlgychfgvmk5ha2jqh52-gzip-1.10/bin:/gnu/store/8fpk2cja3f07xls48jfnpgrzrljpqivr-coreutils-8.32/bin"
export EMACSLOADPATH="$EMACSLOADPATH${EMACSLOADPATH:+:}/gnu/store/rfggqmqzcpz4wwjhj2y0bcfmqx8c8i93-emacs-28.2/share/emacs/28.2/lisp"
exec -a "$0" "/gnu/store/rfggqmqzcpz4wwjhj2y0bcfmqx8c8i93-emacs-28.2/bin/.emacs-28.2-real" "$@"
1
2
source ~/.profile
emacs --version 2>&1
(stdout)
/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash: warning: setlocale: LC_ALL: cannot change locale (C.utf8)
GNU Emacs 28.2
Copyright (C) 2022 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

List installed packages

1
guix package --list-installed
(stdout)
emacs	28.2	out	/gnu/store/rfggqmqzcpz4wwjhj2y0bcfmqx8c8i93-emacs-28.2

Rollback changes

You can see the transaction that introduced the changeset for the Emacs package:

1
guix package --list-generations | ansi2txt
(stdout)
Generation 1	Jan 09 2025 21:59:32	(current)
  emacs	28.2	out	/gnu/store/rfggqmqzcpz4wwjhj2y0bcfmqx8c8i93-emacs-28.2

You could remove the package, going forward, but you can also just rollback the change, going backward:

guix package --roll-back
(stdout)
switched from generation 1 to 0

This step returns very quickly, and now Emacs is no longer installed.

The generation (id 1) is still there though, so you can switch back again:

guix package -S 1
(stdout)
switched from generation 0 to 1

Now we have quickly switched back to the generation that installed Emacs again.

Read the manual

Read the guix manual for more information. Start with the Getting Started guide.