Taking Your First Steps Towards Guix Home by@rednosehacker
312 reads

Taking Your First Steps Towards Guix Home

tldt arrow
Read on Terminal Reader

Too Long; Didn't Read

In this article, I will show you, step by step, how one can simply install and configure software they use with Guix Home. For the demonstration, I will focus on a single package.

Company Mentioned

Mention Thumbnail
featured image - Taking Your First Steps Towards Guix Home
Jérémy Korwin HackerNoon profile picture


Jérémy Korwin

Hack 4 Good

Learn More
react to story with heart

In this article, I will show you, step by step, how one can simply install and configure software they use with Guix Home. For the demonstration, I will focus on a single package.

Disclaimer: I'm not an experienced Guix Home user. So don't take my words for granted. Read manuals, ask questions.

So far, to install a software, say Emacs, for my user, I could simply : $ guix install emacs

Or, I could write a manifest and use it to populate my default user profile (or a custom one) : $ guix package --manifest=$HOME/manifest.scm

Where manifest.scm contains the following :

(specifications->manifest (list "emacs"))

Then, the configuration for the new software had to be edited separately.

Here is a dummy ~/.config/emacs/init.el :

(setq initial-scratch-message nil)

Now, let's use Guix Home to start managing the whole !

The blank home

Guix Home ask you for two things : a list of packages and a list of home services. So a blank Guix Home configuration file (which installs and configures nothing) would look like this :

(use-modules (gnu home))

 (packages (list))
 (services (list)))

You can save this expressions in a file named home-configuration.scm. So you now can invoke Guix Home to generate a home environment from this blank configuration :

$ guix home container home-configuration.scm

No worries, this won't affect your current environment. Take a few seconds to see how empty this shell is and move on !

Oops, you need to leave the empty shell.

$ exit

Installing the software

To tell Guix Home to add a software package to the generated home environment, you have to edit home-configuration.scm and add its name to the package list :

 (gnu home)
 (gnu packages emacs))

  (list emacs)))

You can now try it out.

$ guix home container home-configuration.scm

In this shell, you can run Emacs, proof that Emacs has been added to the generated home environment.

$ emacs -nw

Then you can quit the shell.

Install the software's configuration

From Guix Home perspective, things are packages or services. It's time to look for services. Especially one that can handle the process to configure Emacs. Simply put, a service capable of installing the init.el file on the right place : home-xdg-configuration-files-service-type.

Edit home-configuration.scm to be like :

 (gnu home)
 (gnu home services)
 (gnu packages emacs)
 (gnu services)
 (guix gexp))

  (list emacs))
  (list (service home-xdg-configuration-files-service-type
		 `(("emacs/init.el" ,(local-file "init.el")))))))

Then, create a init.el file, with your Emacs configuration, next to the home-configuration.scm :

(setq initial-scratch-message nil)

Try it with :

$ guix home container home-configuration.scm

Here you can see there is the init.el file at ~/.config/emacs/init.el !

So the Emacs in this environment will use this configuration file at startup… Ok, maybe not in the container, but trust me, it will when running (careful, it will have an effect to your current environment this time) :

$ guix home reconfigure home-configuration.scm

Warning : because there is no shell configuration in the home-configuration.scm (yet), you will need to manually configure your shell to make it benefits from the generated home environment.

Thank you very much for reading this article!

Don't hesitate to give me your opinion, suggest an idea for improvement, report an error, or ask a question ! I would be so glad to discuss about the topic covered here with you ! You can reach me here.

Don't miss out on the next ones!

And more importantly, share this blog and tell your friends why they should read this post!

Also published here.


. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa