Guix + StumpWM Setup

Hey System Crafters,

I just joined as I will be taking the beginners course on Guile Scheme and thought I would post a link to my Guix system/home config for others to see:

This repo contains all of my Lisp configurations: Emacs, Nyxt, and StumpWM with Guix (a lot is influenced by System Crafter concepts). I have to say this definitely wasn’t an easy journey. I followed David’s prescription (GUI) for installing Guix and then StumpWM which had a lot of hickups along the way (contrib loading issues etc), not to mention configuring Xorg which was quite difficult. I still don’t really understand much about Guix yet, but at least my config is functional/useable at this point. Even currently using Nyxt to access this forum - which looks great by the way!

I am hoping others who want a similar system setup can learn from my mistakes and many many hours looking through gnu bug emails, nongnu Guix bug logs (Xorg lag issue) etc.

Also, not sure if I am doing the Guix System/Home right - still not sure how to incorporate manifests… and well the Guix manual hasn’t been of much help.

Cheers!

3 Likes

Congratulations for making it this far :smiley: We now share a very similar setup.

Wondering what problems you faced with the regular stumpwm setup, but oh well, if it is now working for you.

1 Like

Regarding %system-services, it has

(set-xorg-configuration
 (xorg-configuration
   (keyboard-layout keyboard-layout)))

which refers to keyboard-layout field of operating-system record that cannot be accessed in this way outside of that record.

You should write either

(set-xorg-configuration
 (xorg-configuration
   (keyboard-layout (keyboard-layout "us"))))

or

(define my-os
  (operating-system
    (keyboard-layout
     (keyboard-layout "us"))
    (services %system-services)
    ...))

(define %system-services
  ...
  (set-xorg-configuration
   (keyboard-layout
    (operating-system-keyboard-layout my-os))
  ...))

my-os

Possible reason for confusion is that we have three different keyboard-layouts here:
→ one from xorg-configuration record;
→ one from operating-system record;
→ and a procedure that we can pass on to others two above.

1 Like

One possible futher improvement is to move more things into .scm files. Your configuration can be written entirely in scheme if you find it convenient.

I also recommend you the rde channel which contains a lot of useful stuff, such as home-emacs-service-type, home-xresources-service-type, home-nyxt-service-type and so on.

1 Like

Thanks mrok - appreciate the feedback. the stuff defined in %system-services is not used as I am not passing it to (services …) currently.

I thought the same, and what’s odd is that those two instances of keyboard-layout is what my initial setup from the installer put there! (why? shouldn’t it know better?). After consulting the manual is seems that I needs both instances (?), which is confusing or rather the manual is still highly confusing for me…

Thanks for the reference, I did stumble across andrew tropin’s rde channel, but it’s a bit more advanced than my current understanding of guix and in the manual it seemed positioned for sway.

That’s my goal to nest as much of my “base” configuration in scheme, then keep optional modules as files in their corresponding directories, then also tell guix to put copy/link them in those locations.

Thanks sls! Hopefully we can chat more as we figure things out!

The main issues I faced with StumpWM and Guix was figuring out a way to use common lisp contrib modules, since on other distros they are installed with quicklisp but on guix you want to use guix :slight_smile: to install them. When starting the default guix built stumpwm executable from .xsession, it would try to compile the common lisp contrib stuff and then error out with a read only error. I then found this was a known issue - here on the gnu bug mail archives. I applied the workaround in that email and all is well :slight_smile: at least for now.

Also found out that the Guix Cookbook was misleading in how to setup StumpWM - it outright doesn’t work (at all). Also, in order for the workaround mentioned above to work, you have to install StumpWM in your guix home and not at the system-wide level.

The installer did everything right.

(set-xorg-configuration
 (xorg-configuration
   (keyboard-layout keyboard-layout)))

won’t work only if you put it outside of operating-system. The installer puts it inside.

One more thing you can do:

(define my-keyboard-layout
  (keyboard-layout "us"))

(define %system-services
  (cons* (set-xorg-configuration
          (xorg-configuration
            (keyboard-layout my-keyboard-layout)))
         %desktop-services))

(operating-system
  (keyboard-layout my-keyboard-layout)
  (service %system-services))

And, in fact, the keyboard-layouts from operating-system and xorg-configuration default to US English, so you probably don’t need to write anything at all.

1 Like

The Stumpwm section in the Cookbook is likely out of date and was written before Guix Home was created.

This worked, thank you!

It’s still a bit unclear as to why this works, is it because when (keyboard-layout "us") is defined outside in %system-services, it is considered a different object than the expression that is specified in operating-system, hence you need to define a variable for it to pass to both instances for it to be recognized as the same?

I suggested this option because I thought it might be convenient. You don’t have to create a separate variable for (keyboard-layout "us") if you don’t want to. All you have to do is access (operating-system (keyboard-layout)) correctly from outside (operating-system) or not access it at all. So the first two options I suggested will work too.

(define my-keyboard-layout
  (keyboard-layout "us"))

(define %system-services
  (cons* (set-xorg-configuration
          (xorg-configuration
            (keyboard-layout my-keyboard-layout)))
         %desktop-services))

(operating-system
  (keyboard-layout my-keyboard-layout)
  (service %system-services))

I find this solution most aesthitically pleasing - really appreciate your feedback and committed that solution to my repo! :wink:

PS - edited this post, your previous post finally made sense regarding the three different keyboard-layouts (xorg-configuration, operating-system, and a procedure…). I get it now - when defining it outside of (operating-system) we need to use the procedure, which in tern can be pass to to the previous two as you stated.

1 Like