doc: Add installation documentation.

Julien LepillerWed Jun 12 11:41:50+0200 2019

adb86e5

doc: Add installation documentation.

doc/install.md unknown status 1

1+
Installation Guide
2+
==================
3+
4+
Installing the Channel
5+
----------------------
6+
7+
This is a Guix channel. You will first need to
8+
[install](https://www.gnu.org/software/guix/download/) Guix itself. Then, simply
9+
create a new `~/.config/guix/guix/channels.scm` file with this content:
10+
11+
```scheme
12+
(cons* (channel
13+
        (name 'guix-home-manager)
14+
        (url "https://framagit.org/tyreunom/guix-home-manager.git")
15+
       %default-channels)
16+
```
17+
18+
Then run `guix pull` to pull the new channel.
19+
20+
If the file already exist, simply add the `(channel)` form above to the list
21+
of channels in the file. Make sure you use `(cons*)` (with a star) and not
22+
`(cons)` since the later can only take one channel and %default-channels as
23+
argument, whereas the first can take as many channels as you'd like before
24+
%default-channels.
25+
26+
Usage
27+
-----
28+
29+
### Making some room in your home directory
30+
31+
It is recommended to use this in a new install, when your home directory is
32+
still pretty empty. Since your home directory will be made into a Guix profile,
33+
you first want to create a new directory for your user data, for instance as
34+
root:
35+
36+
```bash
37+
mkdir -p /data/alice
38+
chown alice: /data/alice
39+
```
40+
41+
if your user is named alice. Then, move all your data over to that directory.
42+
Do not transfer your configuration, it will be useless. That transfering of data
43+
is the reason why it's simpler to start with an empty home: there is no data to
44+
transfer ;)
45+
46+
Once that is done, some parts of your home directory will still have to be
47+
read-write. This is mostly `~/.cache`, `~/.local` but also `~/.guix-profile` and
48+
`~/.config/guix`. Inside your new data directory, create them like this, as your
49+
regular user (alice in this example):
50+
51+
```bash
52+
cd /data/alice
53+
mkdir-p .local/share .cache .config
54+
```
55+
56+
### Creating the first home generation
57+
58+
To create your first home configuration, you must create a configuration file.
59+
For instance, create `/data/alice/.config/guix/home.scm`:
60+
61+
```scheme
62+
(use-modules (home))
63+
64+
(home "/data/alice"
65+
  '())
66+
```
67+
68+
This will generate a completely empty home, except for essential configurations,
69+
i. e. writable XDG directories as well as essential guix symlinks.
70+
71+
See the documentation to learn more about the configuration system.
72+
73+
To build your first generation of your home environment, run as your regular
74+
user:
75+
76+
```bash
77+
guix package -p /var/guix/profiles/per-user/alice/home \
78+
  -f /data/alice/.config/guix/home.scm
79+
```
80+
81+
Still as your regular user, copy your `~/.config/guix` to your data directory.
82+
This will ensure you can still use Guix after you switch to the managed home
83+
profile:
84+
85+
```bash
86+
cp -ar ~/.config/guix /data/alice/.config/
87+
```
88+
89+
Finaly, switch to the managed home profile as root:
90+
91+
```bash
92+
mv /home/alice{,.bak} # keep a backup in case something goes wrong
93+
ln -sv /var/guix/profiles/per-user/alice/home /home/alice
94+
```
95+
96+
That's it!
96<
097<
\ No newline at end of file