aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--default.nix8
-rw-r--r--home-manager/install.nix37
3 files changed, 42 insertions, 7 deletions
diff --git a/README.md b/README.md
index a7e80e16344..2daf42a804f 100644
--- a/README.md
+++ b/README.md
@@ -80,10 +80,10 @@ Currently the easiest way to install Home Manager is as follows:
EOF
```
-4. Create the first Home Manager generation:
+4. Install Home Manager and create the first Home Manager generation:
```console
- $ nix-shell $HM_PATH -A install --run 'home-manager switch'
+ $ nix-shell $HM_PATH -A install
```
Home Manager should now be active and available in your user
diff --git a/default.nix b/default.nix
index 519c6650c06..2988bbbf0d8 100644
--- a/default.nix
+++ b/default.nix
@@ -6,9 +6,7 @@ rec {
path = toString ./.;
};
- install =
- pkgs.runCommand
- "home-manager-install"
- { propagatedBuildInputs = [ home-manager ]; }
- "";
+ install = import ./home-manager/install.nix {
+ inherit home-manager pkgs;
+ };
}
diff --git a/home-manager/install.nix b/home-manager/install.nix
new file mode 100644
index 00000000000..c6d3aa4e4ca
--- /dev/null
+++ b/home-manager/install.nix
@@ -0,0 +1,37 @@
+{ home-manager, pkgs }:
+
+pkgs.runCommand
+ "home-manager-install"
+ {
+ propagatedBuildInputs = [ home-manager ];
+ shellHook = ''
+ echo
+ echo "Creating initial Home Manager generation..."
+ echo
+
+ if home-manager switch; then
+ cat <<EOF
+
+ All done! The home-manager tool should now be installed and you
+ can edit
+
+ ''${XDG_CONFIG_HOME:-~/.config}/nixpkgs/home.nix
+
+ to configure Home Manager. Run 'man home-configuration.nix' to
+ see all available options.
+ EOF
+ exit 0
+ else
+ cat <<EOF
+
+ Uh oh, the installation failed! Please create an issue at
+
+ https://github.com/rycee/home-manager/issues
+
+ if the error seems to be the fault of Home Manager.
+ EOF
+ exit 1
+ fi
+ '';
+ }
+ ""