1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-31 04:04:32 +00:00

docs: nixos module declarative installation instructions (#6208)

Added instructions for a different installation method for home manager on NixOS.
This commit is contained in:
Cat 2025-03-20 17:50:36 +01:00 committed by GitHub
parent c36cc49e55
commit fc189507bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,6 +34,31 @@ to your system `configuration.nix` file, which will introduce a new
NixOS option called `home-manager.users` whose type is an attribute set
that maps user names to Home Manager configurations.
Alternatively, home-manager installation can be done declaratively through configuration.nix using the following syntax:
```nix
{ config, pkgs, lib, ... }:
let
home-manager = builtins.fetchTarball https://github.com/nix-community/home-manager/archive/release-24.11.tar.gz;
in
{
imports =
[
(import "${home-manager}/nixos")
];
users.users.eve.isNormalUser = true;
home-manager.users.eve = { pkgs, ... }: {
home.packages = [ pkgs.atool pkgs.httpie ];
programs.bash.enable = true;
# The state version is required and should stay at the version you
# originally installed.
home.stateVersion = "24.11";
};
}
```
For example, a NixOS configuration may include the lines
``` nix
@ -129,3 +154,4 @@ you create. This contains the system's NixOS configuration.
Once installed you can see [Using Home Manager](#ch-usage) for a more detailed
description of Home Manager and how to use it.