diff --git a/index.html b/index.html index 5ef3fd59..080d6ed1 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ -Home Manager Manual

Home Manager Manual


Preface
1. Installing Home Manager
1.1. Standalone installation
1.2. NixOS module
1.3. nix-darwin module
2. Using Home Manager
2.1. Configuration Example
2.2. Rollbacks
2.3. Keeping your ~ safe from harm
2.4. Graphical services
2.5. Updating
3. Nix Flakes
3.1. Prerequisites
3.2. Standalone setup
3.3. NixOS module
3.4. nix-darwin module
4. Writing Home Manager Modules
4.1. Option Types
5. Contributing
5.1. Getting started
5.2. Guidelines
5.2.1. Maintain backward compatibility
5.2.2. Keep forward compatibility in mind
5.2.3. Add only valuable options
5.2.4. Add relevant tests
5.2.5. Add relevant documentation
5.2.6. Add yourself as a module maintainer
5.2.7. Format your code
5.2.8. Format your commit messages
5.2.9. Format your news entries
5.2.10. Use conditional modules and news
5.2.11. Mind the license
5.3. Commits
5.4. Code Style
5.5. News
5.6. Tests
6. Third-Party Tools and Extensions
6.1. Module Collections
7. Frequently Asked Questions (FAQ)
7.1. Why is there a collision error when switching generation?
7.2. Why are the session variables not set?
7.3. How to set up a configuration for multiple users/machines?
7.4. Why do I get an error message about ca.desrt.dconf or dconf.service?
7.5. How do I install packages from Nixpkgs unstable?
7.6. How do I override the package used by a module?
A. Configuration Options
B. NixOS Module Options
C. nix-darwin Module Options
D. Tools
home-manager +Home Manager Manual

Home Manager Manual


Preface
1. Installing Home Manager
1.1. Standalone installation
1.2. NixOS module
1.3. nix-darwin module
2. Using Home Manager
2.1. Configuration Example
2.2. Rollbacks
2.3. Keeping your ~ safe from harm
2.4. Graphical services
2.5. Updating
3. Nix Flakes
3.1. Prerequisites
3.2. Standalone setup
3.2.1. Unstable Version
3.2.2. Version 22.11
3.3. NixOS module
3.4. nix-darwin module
4. Writing Home Manager Modules
4.1. Option Types
5. Contributing
5.1. Getting started
5.2. Guidelines
5.2.1. Maintain backward compatibility
5.2.2. Keep forward compatibility in mind
5.2.3. Add only valuable options
5.2.4. Add relevant tests
5.2.5. Add relevant documentation
5.2.6. Add yourself as a module maintainer
5.2.7. Format your code
5.2.8. Format your commit messages
5.2.9. Format your news entries
5.2.10. Use conditional modules and news
5.2.11. Mind the license
5.3. Commits
5.4. Code Style
5.5. News
5.6. Tests
6. Third-Party Tools and Extensions
6.1. Module Collections
7. Frequently Asked Questions (FAQ)
7.1. Why is there a collision error when switching generation?
7.2. Why are the session variables not set?
7.3. How to set up a configuration for multiple users/machines?
7.4. Why do I get an error message about ca.desrt.dconf or dconf.service?
7.5. How do I install packages from Nixpkgs unstable?
7.6. How do I override the package used by a module?
A. Configuration Options
B. NixOS Module Options
C. nix-darwin Module Options
D. Tools
home-manager — reconfigure a user environment
E. Release Notes
E.1. Release 23.05
E.1.1. Highlights
E.1.2. State Version Changes
E.2. Release 22.11
E.2.1. Highlights
E.2.2. State Version Changes
E.3. Release 22.05
E.3.1. Highlights
E.3.2. State Version Changes
E.4. Release 21.11
E.4.1. Highlights
E.4.2. State Version Changes
E.5. Release 21.05
E.5.1. Highlights
E.5.2. State Version Changes
E.6. Release 20.09
E.6.1. Highlights
E.6.2. State Version Changes
E.7. Release 20.03
E.7.1. Highlights
E.7.2. State Version Changes
E.8. Release 19.09
E.8.1. Highlights
E.8.2. State Version Changes
E.9. Release 19.03
E.9.1. Highlights
E.9.2. State Version Changes
E.10. Release 18.09

Preface

This manual will eventually describe how to install, use, and extend Home Manager. @@ -289,16 +289,36 @@ Prepare your Home Manager configuration (home.nix). home.nix will be evaluated when the flake is built, so it must be present before bootstrap of Home Manager from the flake. See Section 2.1, “Configuration Example” for introduction about -writing a Home Manager configuration.

3.2. Standalone setup

  1. +writing a Home Manager configuration.

3.2. Standalone setup

The installation procedure for the standalone version of Home Manager +is currently different for the unstable and stable branch. +Therefore, if you are tracking the Nixpkgs or NixOS unstable please go to +Section 3.2.1, “Unstable Version”, +and if you track Nixpkgs or NixOS version 22.11 please go to +Section 3.2.2, “Version 22.11”.

3.2.1. Unstable Version

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, to generate and activate a basic configuration run the command

$ nix run home-manager/master -- 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.

$ nix run home-manager/master -- init
+$ # Edit files in ~/.config/home-manager
+$ nix run home-manager/master -- init --switch

After the initial activation has completed successfully then building +and activating your flake-based configuration is as simple as

$ home-manager switch

It is possible to override the default configuration directory, if you want. +For example,

$ nix run home-manager/master -- 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 for details.

3.2.2. Version 22.11

  1. Set up a flake with a flake.nix as follows:

    {
       description = "Home Manager configuration of Jane Doe";
     
       inputs = {
         # Specify the source of Home Manager and Nixpkgs.
    -    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    +    nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
         home-manager = {
    -      url = "github:nix-community/home-manager";
    +      url = "github:nix-community/home-manager/release-22.11";
           inputs.nixpkgs.follows = "nixpkgs";
         };
       };
    @@ -322,17 +342,10 @@ Set up a flake with a flake.nix as follows:
           };
         };
     }

    Note

    • -The above example tracks the master branch of Home Manager -and nixos-unstable branch of Nixpkgs. -If you would like to use the release-22.11 branch, -change the home-manager input url to github:nix-community/home-manager/release-22.11 -and nixpkgs url to github:NixOS/nixpkgs/nixos-22.11. -
    • -The Home Manager library is exported by the flake under -lib.hm. -
    • +The Home Manager library is exported by the flake under lib.hm. +
    • You can use the above flake.nix as a template in ~/.config/home-manager by -

    $ nix flake new ~/.config/home-manager -t github:nix-community/home-manager
  2. +

    $ nix flake new ~/.config/home-manager -t github:nix-community/home-manager
  • Install Home Manager and apply the configuration by

    $ nix run <flake-uri>#homeConfigurations.jdoe.activationPackage

    Substitute <flake-uri> with the flake URI of the configuration flake. If flake.nix resides in ~/.config/home-manager, @@ -349,7 +362,7 @@ the command nix flake lock --update-input <input-na such as --recreate-lock-file or --update-input [input] to home-manager when building/switching, and these options will be forwarded to nix build. -See the NixOS Wiki page for detail.

  • 3.3. NixOS module

    To use Home Manager as a NixOS module, +See the NixOS Wiki page for detail.

    3.3. NixOS module

    To use Home Manager as a NixOS module, a bare-minimum flake.nix would be as follows:

    {
       description = "NixOS configuration";
     
    diff --git a/release-notes.html b/release-notes.html
    index 6880df16..a9d467e3 100644
    --- a/release-notes.html
    +++ b/release-notes.html
    @@ -9,7 +9,15 @@ The default configuration location has been changed from
     then the default flake file location has changed from
     ~/.config/nixpkgs/flake.nix to ~/.config/home-manager/flake.nix.

    The old location will continue to work but using it will trigger a warning message. We changed the default configuration location to avoid confusion about -which files belong to Home Manager and which belong to Nixpkgs.

    E.1.2. State Version Changes

    The state version in this release includes the changes below. +which files belong to Home Manager and which belong to Nixpkgs.

  • +The home-manager tool now offers an init command. +This command can be used to generate an initial Home Manager configuration, +and optionally also activate it. +The recommended installation method for a standalone Home Manager setup +with Nix flakes uses this new command. +The standard installation method remains the same but uses the new command internally. +See Section 3.2.1, “Unstable Version” for more. +
  • E.1.2. State Version Changes

    The state version in this release includes the changes below. These changes are only active if the home.stateVersion option is set to "23.05" or later.

    E.2. Release 22.11

    This is the current unstable branch and the information in this section is therefore not final.

    E.2.1. Highlights

    This release has the following notable changes:

    • +

    now default to true which is consistent with the default values for +those options used by i3 and sway.

    E.2. Release 22.11

    This is the current unstable branch and the information in this section is therefore not final.

    E.2.1. Highlights

    This release has the following notable changes:

    • The home.stateVersion option no longer has a default value. It used to default to “18.09”, which was the Home Manager version that introduced the option. If your configuration does not explicitly diff --git a/tools.html b/tools.html index 44f81f85..a5791ba1 100644 --- a/tools.html +++ b/tools.html @@ -4,6 +4,8 @@ — reconfigure a user environment

    Synopsis

    home-manager { build | + init [--switch] [dir] + | instantiate | edit @@ -105,6 +107,26 @@

    Build configuration into a result directory.

    + init [--switch] [dir] +

    + Generates an initial home.nix file for the + current user. If Nix flakes are enabled, then this command also + generates a flake.nix file. +

    + If a path dir is given then the + configuration will be generated in that directory. Otherwise, the + configuration will be generated in + ~/.config/home-manager. The output directory will + be created if it does not exist. +

    + If the --switch option is given, then the generated + configuration is activated. +

    + Note, this command will not overwrite any existing files. It is + therefore safe to initialize a configuration, edit it, and then re-run + the init command with --switch + enabled to activate the configuration. +

    instantiate

    Instantiate the configuration and print the resulting derivation.