Generic Configuration Utilities
Guix Home Manager provides some generic utility functions. Some of them are used to create ad-hoc files in the user home, as symbolic links to specific locations in the file system or to a file-like object. Others are meant to be used inside the builders of file-like objects.
Creating ad-hoc files
The (home utils)
module provides utility functions useful for creating ad-hoc
files in the user home.
Scheme Procedure: (simple-file-home file-gexp location)
Add file-gexp, a file-like object, to the user home at location. For instance,
if you have a .gitconfig
file, you can add it to the store as a file-like
object and use this procedure to add it to your home directory:
(simple-file-home (local-file "gitconfig") ".gitconfig")
Scheme Procedure: (symlink-file-home from to)
Create a symlink from the user home at from that points to to. For instance, if you want to create a symlink to a file that can change over time, you can add it with this procedure. For instance, if you don't care about icecat's configuration (and profiles, plugins, etc), you can simply make its directory read-write with this configuration:
(symlink-file-home "/data/alice/.mozilla" ".mozilla")
Scheme Procedure: (make-ini-file name config)
Create an ini file with name name and content defined by config. config is an association list between section names and content. The content of a section is an association list between keys and values. Values can be strings, integers or booleans.
For instance, the folowing procedure call:
(make-ini-file "foo.ini" '(("General" (("foo" 1) ("bar" 2)))
("Init" (("baz" "foobar") ("foo" #t)))))
will produce the following ini file:
[General]
foo=1
bar=2
[Init]
baz=foobar
foo=true
Build-side Utilities
The (home build utils)
extends the utilities provided by (guix build utils)
with the following procedure:
Scheme Procedure: (home-file outputs path ...)
Return the complete path to the output of a package being defined by adding
"/" between each component of path. outputs is the content of %build-output
in the package definition. This is not very useful for end users.