Change installation instructions to use nix-channel

This avoids the uncontrollable nature of fetching the tarball as part
of the evaluation. Instead the user can decide when to update and also
perform rollbacks, if necessary.

(cherry picked from commit a37b5c9c61)
This commit is contained in:
Robert Helgesson 2018-12-03 00:48:07 +01:00
parent 88c681606b
commit c4a9546831
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 32 additions and 28 deletions

View file

@ -6,8 +6,6 @@ os:
before_script: before_script:
- mkdir -m 0755 -p /nix/var/nix/{profiles,gcroots}/per-user/$USER - mkdir -m 0755 -p /nix/var/nix/{profiles,gcroots}/per-user/$USER
- mkdir -p ~/.config/nixpkgs
- echo "{}" > ~/.config/nixpkgs/home.nix
script: script:
nix-shell . -A install nix-shell . -A install

View file

@ -54,42 +54,32 @@ Currently the easiest way to install Home Manager is as follows:
NixOS you can control this option using the NixOS you can control this option using the
[`nix.allowedUsers`][nixosAllowedUsers] system option. [`nix.allowedUsers`][nixosAllowedUsers] system option.
2. Assign a temporary variable holding the URL to the appropriate 2. Add the appropriate Home Manager channel. Typically this is
archive. Typically this is
```console ```console
$ HM_PATH=https://github.com/rycee/home-manager/archive/master.tar.gz $ nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager
$ nix-channel --update
``` ```
if you are following Nixpkgs master or an unstable channel and if you are following Nixpkgs master or an unstable channel and
```console ```console
$ HM_PATH=https://github.com/rycee/home-manager/archive/release-18.09.tar.gz $ nix-channel --add https://github.com/rycee/home-manager/archive/release-18.09.tar.gz home-manager
$ nix-channel --update
``` ```
if you follow a Nixpkgs version 18.09 channel. if you follow a Nixpkgs version 18.09 channel.
3. Create an initial Home Manager configuration file: 3. Install Home Manager and create the first Home Manager generation:
```console ```console
$ cat > ~/.config/nixpkgs/home.nix <<EOF $ nix-shell '<home-manager>' -A install
{
programs.home-manager.enable = true;
programs.home-manager.path = $HM_PATH;
}
EOF
``` ```
4. Install Home Manager and create the first Home Manager generation: Once finished, Home Manager should be active and available in your
user environment.
```console 3. If you do not plan on having Home Manager manage your shell
$ nix-shell $HM_PATH -A install
```
Home Manager should now be active and available in your user
environment.
5. If you do not plan on having Home Manager manage your shell
configuration then you must source the configuration then you must source the
``` ```
@ -107,11 +97,10 @@ Currently the easiest way to install Home Manager is as follows:
to your `~/.profile` file. to your `~/.profile` file.
Note, because the `HM_PATH` variable above points to the live Home If instead of using channels you want to run Home Manager from a Git
Manager repository you will automatically get updates whenever you checkout of the repository then you can use the
build a new generation. If you dislike automatic updates then perform `programs.home-manager.path` option to specify the absolute path to
a Git clone of the desired branch and instead do the above steps with the repository.
`HM_PATH` set to the _absolute path_ of your clone.
Usage Usage
----- -----

View file

@ -7,6 +7,23 @@ pkgs.runCommand
preferLocalBuild = true; preferLocalBuild = true;
allowSubstitutes = false; allowSubstitutes = false;
shellHook = '' shellHook = ''
confFile="''${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home.nix"
if [[ ! -e $confFile ]]; then
echo
echo "Creating initial Home Manager configuration..."
mkdir -p "$(dirname "$confFile")"
cat > $confFile <<EOF
{ config, pkgs, ... }:
{
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}
EOF
fi
echo echo
echo "Creating initial Home Manager generation..." echo "Creating initial Home Manager generation..."
echo echo
@ -17,7 +34,7 @@ pkgs.runCommand
All done! The home-manager tool should now be installed and you All done! The home-manager tool should now be installed and you
can edit can edit
''${XDG_CONFIG_HOME:-~/.config}/nixpkgs/home.nix $confFile
to configure Home Manager. Run 'man home-configuration.nix' to to configure Home Manager. Run 'man home-configuration.nix' to
see all available options. see all available options.