document how to use home-manager as NixOS module

This commit is contained in:
Gabriel Fontes 2023-02-20 17:22:38 -03:00
parent f0e313c886
commit f313c8acec
No known key found for this signature in database
GPG key ID: 2E54EA7BFE630916

View file

@ -105,6 +105,32 @@ the latest and greatest nix3 flake-enabled command UX.
# What next? # 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 ## Adding more hosts or users
You can organize them by hostname and username on `nixos` and `home-manager` You can organize them by hostname and username on `nixos` and `home-manager`