From 52fdf5b7ecab93eaf2a2ee83777b73f8ee126614 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Tue, 26 Feb 2019 22:32:18 +0100 Subject: [PATCH] docs: add NixOS module installation instructions --- doc/installation.xml | 80 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/doc/installation.xml b/doc/installation.xml index 281f5067..b0109398 100644 --- a/doc/installation.xml +++ b/doc/installation.xml @@ -145,8 +145,86 @@ $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh NixOS module - To be done. + Home Manager provides a NixOS module that allows you to prepare user + environments directly from the system configuration file, which often is + more convenient than using the home-manager tool. It also + opens up additional possibilities, for example, to automatically configure + user environments in NixOS declarative containers or on systems deployed + through NixOps. + + + To make the NixOS module available for use you must + it into your system configuration. This is most conveniently done by adding + a Home Manager channel, for example + + + +# 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 + + + +# 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. + + + + It is then possible to add + + + +imports = [ <home-manager/nixos> ]; + + + + to your system configuration.nix file, which will + introduce a new NixOS option called + whose type is an attribute set that maps user names to Home Manager + configurations. + + + + For example, a NixOS configuration may include the lines + + + +users.users.eve.isNormalUser = true; +home-manager.users.eve = { pkgs, ... }: { + home.packages = [ pkgs.atool pkgs.httpie ]; + programs.bash.enable = true; +}; + + + + and after a nixos-rebuild switch the user eve's + environment should include a basic Bash configuration and the packages atool + and httpie. + + + + + By default packages will be installed to + $HOME/.nix-profile but they can be installed to + /etc/profiles if + + +home-manager.useUserPackages = true; + + + is added to the system configuration. This is necessary if, for example, + you wish to use nixos-rebuildĀ build-vm. This option may + become the default value in the future. + +
nix-darwin module