Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ It's used by default for flakes that do not have a `schemas` output.
It supports the following flake output types:

* [`apps`][apps]
* [`aspects`][aspects]
* [`checks`][checks]
* [`darwinConfigurations`][darwin]
* [`darwinModules`][darwin]
* [`devShells`][develop]
* [`dockerImages`][docker]
* [`flakeModules`][flake-parts]
* [`formatter`][formatter]
* [`homeConfigurations`][home]
* [`homeModules`][home]
Expand Down Expand Up @@ -67,13 +69,15 @@ nix run github:DeterminateSystems/nix-src/flake-schemas -- \
- [Flake schemas][video] — [Eelco Dolstra][eelco]'s talk on flake schemas at [NixCon 2023][nixcon-2023].

[apps]: https://nix.dev/manual/nix/latest/command-ref/new-cli/nix3-run#apps
[aspects]: https://github.com/vic/flake-aspects
[blog]: https://determinate.systems/posts/flake-schemas
[branch]: https://github.com/DeterminateSystems/nix-src/tree/flake-schemas
[checks]: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake-check.html
[darwin]: https://github.com/LnL7/nix-darwin
[docker]: https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-dockerTools
[develop]: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html
[eelco]: https://determinate.systems/people/eelco-dolstra
[flake-parts]: https://flake.parts
[flakes]: https://zero-to-nix.com/concepts/flakes
[formatter]: https://nix.dev/manual/nix/latest/command-ref/new-cli/nix3-fmt
[home]: https://github.com/nix-community/home-manager
Expand Down
38 changes: 38 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,42 @@
}) output
);
};

flakeModulesSchema = {
version = 1;
doc = ''
The `flakeModules` flake output defines [flake-parts](https://flake.parts) modules for use by other flakes.
These modules can be imported to extend flake functionality and share configuration patterns.
'';
inventory =
output:
self.lib.mkChildren (
builtins.mapAttrs (moduleName: module: {
what = "flake-parts module";
evalChecks.isFunctionOrAttrs = checkModule module;
}) output
);
};

aspectsSchema = {
version = 1;
doc = ''
The `aspects` flake output defines aspect-oriented modules organized by cross-cutting concerns.
Each aspect contains modules for multiple configuration classes (nixos, darwin, homeManager, etc.).
This is typically used with [flake-aspects](https://github.com/vic/flake-aspects) which transposes the structure to `modules.<class>.<aspect>`.
'';
inventory =
output:
self.lib.mkChildren (
builtins.mapAttrs (aspectName: classes: {
what = "aspect";
children = builtins.mapAttrs (className: module: {
what = "${className} module";
evalChecks.isFunctionOrAttrs = checkModule module;
}) classes;
}) output
);
};
in

{
Expand Down Expand Up @@ -384,5 +420,7 @@
schemas.darwinConfigurations = darwinConfigurationsSchema;
schemas.darwinModules = darwinModulesSchema;
schemas.dockerImages = dockerImagesSchema;
schemas.flakeModules = flakeModulesSchema;
schemas.aspects = aspectsSchema;
};
}