docs: update module system intro

This commit is contained in:
DavHau 2024-03-17 13:00:58 +07:00 committed by mergify[bot]
parent 6edfbb2c0b
commit b8d00b7c98
2 changed files with 8 additions and 8 deletions

View File

@ -4,9 +4,9 @@
- [Contact](./contact.md)
# Examples
- [dream2nix examples](./examples.md)
- [examples](./examples.md)
# Concepts
- [dream2nix modules](./modules.md)
- [modules](./modules.md)
# Modules Reference

View File

@ -1,8 +1,10 @@
# Why Modules?
Declaring derivations as modules solves a number of issues.
For more details on the problems, visit [DavHau/pkgs-modules](https://github.com/DavHau/pkgs-modules).
Also I recommend watching @edolstra 's [talk about this topic](https://www.youtube.com/watch?v=dTd499Y31ig).
For some more background information, check out the initial exploration of this idea at [DavHau/pkgs-modules](https://github.com/DavHau/pkgs-modules).
@edolstra 's [talk about this topic](https://www.youtube.com/watch?v=dTd499Y31ig) is also worth watching.
# Benefits
@ -35,7 +37,7 @@ Changing options of packages in nixpkgs can require chaining different override
}
```
See htop module definition [here](https://github.com/nix-community/dream2nix/blob/main/examples/dream2nix-packages-simple/htop-with-flags/default.nix).
See htop module definition [here](https://github.com/nix-community/dream2nix/blob/main/examples/packages/basics/htop-with-flags/default.nix).
## Type safety
@ -91,7 +93,7 @@ Instead it has to be defined under `env.`:
}
```
## Documentaiton / Discoverability
## Documentation / Discoverability
No more digging the source code to find possible options to override.
@ -103,8 +105,6 @@ Every package built with `dream2nix` has a `.docs` attribute that builds an html
With `dream2nix`, packages don't need to be fully declared. Options can be left without defaults, requiring the consumer to complete the definition.
For example, this can be useful for lang2nix tools, where `src` and `version` are dynamically provided by a lock file parser.
## Flexibility
The nixos module system gives maintainers more freedom over how packages are split into modules. Separation of concerns can be implemented more easily.