1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 13:39:46 +01:00
home-manager/docs
Robert Hensing 26e72d85e6
home-manager: set module class to "homeManager"
This enables a module system feature documented here:
https://nixos.org/manual/nixpkgs/stable/index.html#module-system-lib-evalModules-param-class

For example, it allows a mistake to be caught, which is loading a
NixOS module into home-manager. This only works when the offending
module declares what it's for with a `_class` attribute.

It is not expected that users declare the `_type`, because the payoff
is small. It is only expected to be set by generic code, such as
functions or libraries that help with the "publishing" of modules
(e.g. flake-parts, flake-utils).

The class feature has been available in the module system since
https://github.com/NixOS/nixpkgs/pull/197547, merged May 6, 2023. It
has been part of all releases since 23.05-beta. The last NixOS release
that did _not_ support it has been end-of-life for close to a year
now.

Example:

    (lib.homeManagerConfiguration {
      pkgs = nixpkgs.legacyPackages.x86_64-linux;
      modules = [{ _class = "nixos"; imports = [ ./foo.nix ]; }];
    }).activation-script

Corresponding error:

    error: The module <unknown-file> was imported into homeManager instead of nixos.

(`<unknown-file>` can be improved by also setting `_file`, if known; a
much older feature)

PR #5339
2024-04-27 09:28:21 +02:00
..
manual treewide: prefer the official wiki 2024-04-17 23:58:16 +02:00
release-notes treewide: deprecate VERBOSE_ECHO 2024-01-24 13:36:05 +01:00
static docs: add style sheets and scrubDerivations 2024-02-01 01:10:58 +01:00
default.nix home-manager: set module class to "homeManager" 2024-04-27 09:28:21 +02:00
flake.lock docs: add style sheets and scrubDerivations 2024-02-01 01:10:58 +01:00
flake.nix docs: add style sheets and scrubDerivations 2024-02-01 01:10:58 +01:00
home-configuration-nix-footer.5 docs: use nixos-render-docs 2023-12-07 21:28:16 +09:00
home-configuration-nix-header.5 docs: extend home-configuration.nix header 2023-12-07 21:28:18 +09:00
home-manager-manual.nix docs: add style sheets and scrubDerivations 2024-02-01 01:10:58 +01:00
home-manager.1 home-manager: Check VISUAL before EDITOR for editor 2024-02-05 23:22:43 +01:00
html-open-tool.nix docs: apply nixfmt 2023-12-09 09:05:16 +01:00