doc: Document utility functions.

Julien LepillerTue Jun 11 21:09:36+0200 2019

c3a85ab

doc: Document utility functions.

doc/general.md unknown status 1

1+
Generic Configuration Utilities
2+
===============================
3+
4+
Guix Home Manager provides some generic utility functions. Some of them are
5+
used to create ad-hoc files in the user home, as symbolic links to specific
6+
locations in the file system or to a file-like object. Others are meant to
7+
be used inside the builders of file-like objects.
8+
9+
Creating ad-hoc files
10+
---------------------
11+
12+
The `(home utils)` module provides utility functions useful for creating ad-hoc
13+
files in the user home.
14+
15+
**Scheme Procedure**: (simple-file-home file-gexp location)
16+
17+
Add _file-gexp_, a file-like object, to the user home at _location_. For instance,
18+
if you have a `.gitconfig` file, you can add it to the store as a file-like
19+
object and use this procedure to add it to your home directory:
20+
21+
```scheme
22+
(simple-file-home (local-file "gitconfig") ".gitconfig")
23+
```
24+
25+
**Scheme Procedure**: (symlink-file-home from to)
26+
27+
Create a symlink from the user home at _from_ that points to _to_. For instance,
28+
if you want to create a symlink to a file that can change over time, you can
29+
add it with this procedure. For instance, if you don't care about icecat's
30+
configuration (and profiles, plugins, etc), you can simply make its directory
31+
read-write with this configuration:
32+
33+
```scheme
34+
(symlink-file-home "/data/alice/.mozilla" ".mozilla")
35+
```
36+
37+
Build-side Utilities
38+
--------------------
39+
40+
The `(home build utils)` extends the utilities provided by `(guix build utils)`
41+
with the following procedure:
42+
43+
**Scheme Procedure**: (home-file outputs path ...)
44+
45+
Return the complete path to the output of a package being defined by adding
46+
"/" between each component of _path_. _outputs_ is the content of `%build-output`
47+
in the package definition. This is not very useful for end users.
47<
048<
\ No newline at end of file