Skip to content

Commit

Permalink
flake.nix: Add modules.generic.nixpkgs
Browse files Browse the repository at this point in the history
A helper for module system applications.

Naming compatible with NixOS/nix#6257
To be supported by nix flake check in NixOS/nix#8332
Concept is in the spirit of a proposed module based solution to [RFC 0078 System-agnostic configuration file generators](NixOS/rfcs#78).
  • Loading branch information
roberth committed Jul 6, 2023
1 parent 4aac481 commit bfe8fd2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/using/configuration.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ list-id: configuration-variable-list
source: ../config-options.json
```

## Calling Nixpkgs from the Module System {#sec-invoke-nixpkgs-by-module}

For [module system](#module-system) application authors, Nixpkgs provides a reusable module for the purpose of invoking Nixpkgs. Most users should not have to be aware of this. The documentation for its options is meant to be re-exposed in the application's documentation and is therefore not repeated here.

Applications can import the implementation file [`"${nixpkgs}/pkgs/top-level/module/module.nix"`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/module/module.nix).

The flake attribute (experimental) for this module is `.modules.generic.nixpkgs`.

## Declarative Package Management {#sec-declarative-package-management}

Expand Down
7 changes: 7 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,12 @@
*/
readOnlyPkgs = ./nixos/modules/misc/nixpkgs/read-only.nix;
};

modules = {
/* Modules that are not specific to any application of the module system. */
generic = {
nixpkgs = ./pkgs/top-level/module/module.nix;
};
};
};
}

0 comments on commit bfe8fd2

Please sign in to comment.