From f313c8acec862ada5aa73161c98589ecd5927554 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Mon, 20 Feb 2023 17:22:38 -0300 Subject: [PATCH] document how to use home-manager as NixOS module --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 9c8537f..c0e3598 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,32 @@ the latest and greatest nix3 flake-enabled command UX. # What next? +## Use home-manager as a NixOS module + +If you prefer to build your home configuration together with your NixOS one, +it's pretty simple. + +Simply remove the `homeConfigurations` block from the `flake.nix` file; then +add this to your NixOS configuration (either directly on +`nixos/configuration.nix` or on a separate file and import it): + +```nix +{ inputs, ... }: { + imports = [ + # Import home-manager's NixOS module + inputs.home-manager.nixosModules.home-manager + ]; + + home-manager = { + extraSpecialArgs = { inherit inputs; }; + users = { + # Import your home-manager configuration + your-username = import ../home-manager; + }; + }; +} +``` + ## Adding more hosts or users You can organize them by hostname and username on `nixos` and `home-manager`