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
Turns out pulling nmt and nmd from Nixpkgs causes an IFD, even when
the packages are fixed-output derivations.
Thus, since Sourcehut is up and well, we can revert to simply fetching
nmd and nmt directly.
See discussion in <https://github.com/nix-community/home-manager/pull/4884>.
This commit removes the `home-manager-render-docs` package in favor
of upstream `nixos-render-docs` where the manpage generator has been
updated to take a `--header` and a `--footer` flag specifying static
content around the content derived from the options.json file.
This commit extracts the htmlOpenTool from `nmd` into a module
in the home-manager docs directory. This is done to provide feature
parity with the documentation generated using the docbook .xml files.
The `optionsDocBook` function is deprecated in nixpkgs since
nixos-23.11. This commit updates the manual and manpages to
use commonmark formatted documentation instead of the deprecated
docbook format.
Output is mostly unchanged aside from some minor typographical and
formatting changes, along with better source links.
We temporarily export `options.docBookForMigration` to allow
`nix-doc-munge` to check its conversions.
- Fix paragraphs in option field texts containing Markdown.
- Fix generation of documentation for options with Markdown in
multiple fields.
- Support AsciiDoc in module option documentation.
This simplifies the code a bit and avoids using experimental Flake
functionality. If Flakes become stable before NixOS 22.11 then we can
consider having nmd and nmt as Flake inputs. Maybe could then also
avoid the need for flake-compat.
Currently we're maintaining a "mock" module made of sink options,
which requires updating whenever the definitions in the
nixos/nix-darwin modules change.
Instead, set `_module.check` to false so that definitions in those
modules are simply ignored.
* Add flake.lock and clean up flake.nix
Add a lockfile to work around https://github.com/NixOS/nix/issues/6541
(and because it's a good idea anyway).
Also use flake-utils, and restrict ourselves to the five platforms
supported by nixpkgs. Otherwise, the IFD for nmd fails on weird
platforms. This fixes `nix flake check`.
Remove the redundant `apps` output, see https://github.com/nix-community/home-manager/pull/2442#issuecomment-1133670487
* nixos,nix-darwin: factor out into a common module
* nixos,nix-darwin: make `home-managers.users` shallowly visible
Make sure the option is included in the NixOS/nix-darwin manual (but the
HM submodule options aren't).
Also add a static description to the HM submodule type so that we don't need to
evaluate the submodules just to build the option manual. This makes
nixos-search able to index the home-manager flake.
Also clean up some TODOs.
* flake: add nmd and nmt
This avoids having to use `pkgs.fetchFromGitLab` in an IFD, which causes
issues when indexing packages with nixos-search because `pkgs` is
instantiated with every platform.