An open API service indexing awesome lists of open source software.

https://github.com/aurtzy/guix-config

A modular Guix configuration
https://github.com/aurtzy/guix-config

dotfiles emacs guile guix scheme

Last synced: about 1 year ago
JSON representation

A modular Guix configuration

Awesome Lists containing this project

README

          

#+title: guix-config

# Modular Guix configuration

* Introduction

These are my [[https://guix.gnu.org][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:

- [[file:files]] contains configuration files that are not declared with Guile code.
- [[file:modules]] contains Guile modules, where packages, services, and other
utilities are defined. =GUIX_PACKAGE_PATH= is also set to this directory.
- [[file:systems]] is where the top-level Guix System/Home configuration files for
my systems are located.
- [[file:scripts/setup]] is used for setting up additional things that the installer
does not offer to do.
- [[file: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.

# TODO: Add documentation for record types

# TODO: Add documentation for creating new extension procedures

* 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:

#+begin_src scheme
(service keyboard-center-service-type)
#+end_src

* 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:

#+begin_src scheme
(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"))))
#+end_src

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:

#+begin_src scheme
`((".config/emacs"
,(string-append
(getenv "HOME")
"/dotfiles")
"init.el"
"early-init.el")
(""
,(string-append
(getenv "HOME")
"/dotfiles")
".bash_profile"))
#+end_src

** 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:

#+begin_src scheme
(service home-flatpak-service-type
(home-flatpak-configuration
(remotes
'((flathub
. "https://flathub.org/repo/flathub.flatpakrepo")))))
#+end_src

~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):

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

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.