From b8d00b7c98939f5c72d12933a0c7c50c063cbdaf Mon Sep 17 00:00:00 2001 From: DavHau Date: Sun, 17 Mar 2024 13:00:58 +0700 Subject: [PATCH] docs: update module system intro --- modules/flake-parts/website/site/src/SUMMARY.md | 4 ++-- modules/flake-parts/website/site/src/modules.md | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/flake-parts/website/site/src/SUMMARY.md b/modules/flake-parts/website/site/src/SUMMARY.md index dbab603f..83425c14 100644 --- a/modules/flake-parts/website/site/src/SUMMARY.md +++ b/modules/flake-parts/website/site/src/SUMMARY.md @@ -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 diff --git a/modules/flake-parts/website/site/src/modules.md b/modules/flake-parts/website/site/src/modules.md index 0723bf08..e054787e 100644 --- a/modules/flake-parts/website/site/src/modules.md +++ b/modules/flake-parts/website/site/src/modules.md @@ -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.