/guix-config

Modular Guix configuration

Primary LanguageSchemeGNU General Public License v3.0GPL-3.0

guix-config

Introduction

These are my GNU Guix configuration files. This config extends Guix with a custom data type (dubbed “mods”) to modularize my setup.

This repository also includes some additional packages and services that are either being refined for upstreaming or are not suitable for upstream.

Overview

Here is a general overview of notable files in this repository:

  • files contains configuration files that are not declared as Guile modules. This includes the top-level Guix Home/System configuration files for my systems (files/guix).
  • my-guix contains Guile modules, where packages, services, and other utilities are defined.
  • modules is useful for setting additional load paths for Guix without accidentally including other files (e.g. from files). This directory is what GUIX_PACKAGE_PATH is set to.
  • scripts/setup is used for setting up additional things that the installer does not offer to do.
  • scripts/guix is used for bootstrapping the configuration when GUIX_PACKAGE_PATH is not set yet.

The following sections include documentation for various services and interfaces provided by the Guile modules.

Mods

The (my-guix mods) module implements “mods”, an extension to Guix that can be used to modularize system (and home) configurations. Mods are built on top of the composing of procedures that enable extending various fields of a record. Some procedures for extending various fields are provided as part of this module. Note that “fields” refers to any extendable value within record fields as well, not just record fields themselves.

These composable procedures can then be used in conjunction with record types and other procedures also provided by the module to build mod objects that can be combined to construct operating-system or home-environment records.

Services

Hardware Services

The (my-guix services hardware) module provides services relating to hardware.

keyboard-center-service-type

This service adds udev rules necessary for the keyboard-center package to work.

No configuration is available for this service, so the following should suffice:

(service keyboard-center-service-type)

Home Services

Base Services

The (my-guix home services) module provides additional base services.

home-impure-symlinks-service-type

This service is based off of Guix Home’s symlink-manager service, except that it is designed to work with symlinks outside of the store; hence, “impure”.

home-impure-symlinks-service-type can be initialized and extended with a list of symlink specifications. For example, the following extends the service with symlinks at $HOME/.config/emacs/init.el and $HOME/.bash_profile pointing to $HOME/dotfiles/init.el and $HOME/dotfiles/.bash_profile, respectively:

(simple-service 'home-impure-symlinks-dotfiles
                home-impure-symlinks-service-type
                `((".config/emacs/init.el"
                   ,(string-append
                     (getenv "HOME")
                     "/dotfiles/init.el"))
                  (".config/emacs/early-init.el"
                   ,(string-append
                     (getenv "HOME")
                     "/dotfiles/early-init.el"))
                  (".bash_profile"
                   ,(string-append
                     (getenv "HOME")
                     "/dotfiles/.bash_profile"))))

Optionally, file names can be specified after the source path to copy the directory structure of the source path to the destination path (which are implied to be directories in this case). For example, the following value is equivalent to the extension value declared above:

`((".config/emacs"
   ,(string-append
     (getenv "HOME")
     "/dotfiles")
   "init.el"
   "early-init.el")
  (""
   ,(string-append
     (getenv "HOME")
     "/dotfiles")
   ".bash_profile"))

Package Management

The (my-guix home services package-management) module provides additional services for package management.

home-flatpak-service-type

This is the service type for configuring Flatpak. It expects a home-flatpak-configuration record as its value.

Only installation of flatpaks is supported to avoid accidental removals that cause reinstallations. Although this service (mostly) works in its current form, the interface is still experimental and will likely go through changes to improve flexibility and capabilities.

To start using this service, it must be configured with at least one remote. The following example configures Flatpak to use Flathub as a remote:

(service home-flatpak-service-type
         (home-flatpak-configuration
          (remotes
           '((flathub
              . "https://flathub.org/repo/flathub.flatpakrepo")))))

home-flatpak-service-type may itself be extended to add applications to the profile, but it can be fairly cumbersome having to specify home-flatpak-configuration every time. home-flatpak-profile-service-type is included as a shorthand service for specifying lists of application specifications to include in the profile, that being (remote app-id). The following declares the Firefox and Brave Browser flatpaks in the home environment (assuming that Flathub is already configured as shown above):

(simple-service 'home-flatpak-browsers
                home-flatpak-profile-service-type
                '((flathub "org.mozilla.firefox")
                  (flathub "com.brave.Browser")))

Note that on foreign systems, the Guix Flatpak package will fail to properly run if CA certificates cannot be found, which can be a problem for first-time reconfigures where certificates for Guix have not been set up yet (notably SSL_CERT_FILE). However, as long as the relevant variable and package(s) are specified in the configuration, they will still be applied even if Flatpak fails to run, so subsequent reconfigures should work as intended after reloading the environment.

Guix System users should not have this problem since certificates should already be properly set up by the time a home reconfigure takes place.