mirror of
https://github.com/nix-community/home-manager
synced 2024-11-08 20:29:43 +01:00
63 lines
1.9 KiB
Markdown
63 lines
1.9 KiB
Markdown
|
# Standalone setup {#sec-flakes-standalone}
|
||
|
|
||
|
To prepare an initial Home Manager configuration for your logged in
|
||
|
user, you can run the Home Manager `init` command directly from its
|
||
|
flake.
|
||
|
|
||
|
For example, if you are using the unstable version of Nixpkgs or NixOS,
|
||
|
then to generate and activate a basic configuration run the command
|
||
|
|
||
|
``` console
|
||
|
$ nix run home-manager/master -- init --switch
|
||
|
```
|
||
|
|
||
|
For Nixpkgs or NixOS version 23.05 run
|
||
|
|
||
|
``` console
|
||
|
$ nix run home-manager/release-23.05 -- init --switch
|
||
|
```
|
||
|
|
||
|
This will generate a `flake.nix` and a `home.nix` file in
|
||
|
`~/.config/home-manager`, creating the directory if it does not exist.
|
||
|
|
||
|
If you omit the `--switch` option then the activation will not happen.
|
||
|
This is useful if you want to inspect and edit the configuration before
|
||
|
activating it.
|
||
|
|
||
|
``` console
|
||
|
$ nix run home-manager/$branch -- init
|
||
|
$ # Edit files in ~/.config/home-manager
|
||
|
$ nix run home-manager/$branch -- init --switch
|
||
|
```
|
||
|
|
||
|
Where `$branch` is one of `master` or `release-23.05`.
|
||
|
|
||
|
After the initial activation has completed successfully then building
|
||
|
and activating your flake-based configuration is as simple as
|
||
|
|
||
|
``` console
|
||
|
$ home-manager switch
|
||
|
```
|
||
|
|
||
|
It is possible to override the default configuration directory, if you
|
||
|
want. For example,
|
||
|
|
||
|
``` console
|
||
|
$ nix run home-manager/$branch -- init --switch ~/hmconf
|
||
|
$ # And after the initial activation.
|
||
|
$ home-manager switch --flake ~/hmconf
|
||
|
```
|
||
|
|
||
|
::: note
|
||
|
The flake inputs are not automatically updated by Home Manager. You need
|
||
|
to use the standard `nix flake update` command for that.
|
||
|
|
||
|
If you only want to update a single flake input, then the command
|
||
|
`nix flake lock --update-input <input>` can be used.
|
||
|
|
||
|
You can also pass flake-related options such as `--recreate-lock-file`
|
||
|
or `--update-input <input>` to `home-manager` when building or
|
||
|
switching, and these options will be forwarded to `nix build`. See the
|
||
|
[NixOS Wiki page](https://nixos.wiki/wiki/Flakes) for details.
|
||
|
:::
|