aboutsummaryrefslogtreecommitdiff
path: root/FAQ.md
blob: f89a34c5109071d76b73c9e52d6a625b5ac134b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Frequently Asked Questions (FAQ)
================================

Why is there a collision error when switching generation?
---------------------------------------------------------

Home Manager currently installs packages into the user environment,
precisely as if the packages were installed through
`nix-envĀ --install`. This means that you will get a collision error if
your Home Manager configuration attempts to install a package that you
already have installed manually, that is, packages that shows up when
you run `nix-envĀ --query`.

For example, imagine you have the `hello` package installed in your
environment

```console
$ nix-env --query
hello-2.10
```

and your Home Manager configuration contains

    home.packages = [ pkgs.hello ];

Then attempting to switch to this configuration will result in an
error similar to

```console
$ home-manager switch
these derivations will be built:
  /nix/store/xg69wsnd1rp8xgs9qfsjal017nf0ldhm-home-manager-path.drv
[ā€¦]
Activating installPackages
replacing old ā€˜home-manager-pathā€™
installing ā€˜home-manager-pathā€™
building path(s) ā€˜/nix/store/b5c0asjz9f06l52l9812w6k39ifr49jj-user-environmentā€™
Wide character in die at /nix/store/64jc9gd2rkbgdb4yjx3nrgc91bpjj5ky-buildenv.pl line 79.
collision between ā€˜/nix/store/fmwa4axzghz11cnln5absh31nbhs9lq1-home-manager-path/bin/helloā€™ and ā€˜/nix/store/c2wyl8b9p4afivpcz8jplc9kis8rj36d-hello-2.10/bin/helloā€™; use ā€˜nix-env --set-flag priority NUMBER PKGNAMEā€™ to change the priority of one of the conflicting packages
builder for ā€˜/nix/store/b37x3s7pzxbasfqhaca5dqbf3pjjw0ip-user-environment.drvā€™ failed with exit code 2
error: build of ā€˜/nix/store/b37x3s7pzxbasfqhaca5dqbf3pjjw0ip-user-environment.drvā€™ failed
```

The solution is typically to uninstall the package from the
environment using `nix-envĀ --uninstall` and reattempt the Home Manager
generation switch.

Why are the session variables not set?
--------------------------------------

Home Manager is only able to set session variables automatically if it
manages your Bash or Z shell configuration. If you don't want to let
Home Manager manage your shell then you will have to manually source
the

    ~/.nix-profile/etc/profile.d/hm-session-vars.sh

file in an appropriate way. In Bash and Z shell this can be done by
adding

```sh
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
```

to your `.profile` and `.zshrc` files, respectively. The
`hm-session-vars.sh` file should work in most Bourne-like shells.