-
-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module system deep dive tutorial #645
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
f24e372
to
47c09d8
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-07-31-documentation-team-meeting-notes-68/31127/1 |
`lib.mkOption` under the `options` attribute. Here we're defining the | ||
option `generate.script`. | ||
|
||
While there are many attributes to customize options, the most |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where I can find those other attributes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afaik the source has the only complete listing: https://github.com/NixOS/nixpkgs/blob/fa1d4611cc2ce41d7b93c4a8e8db0efaaf286475/lib/options.nix#L66-L88
Your PR make content about modules in this site infinitely more comprehensive. ❤️ |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-08-21-documentation-team-meeting-notes-74/32083/1 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-08-23-documentation-team-meeting-notes-75/32142/1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes:
- add an introduction and conclusion section
- reword the prose to flow better and follow the style guide
- remove metadata noise from
diff
blocks
@@ -0,0 +1,1027 @@ | |||
# Module system introduction | |||
|
|||
Note: This tutorial was created from https://github.com/tweag/summer-of-nix-modules, as presented by @infinisil at Summer of Nix 2021, presentation can be seen here (might not work in browser, `mpv` should work): https://infinisil.com/modules.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This tutorial was created from https://github.com/tweag/summer-of-nix-modules, as presented by @infinisil at Summer of Nix 2021, presentation can be seen here (might not work in browser, `mpv` should work): https://infinisil.com/modules.mp4 | |
:::{note} | |
This tutorial follows [@infinisil's presentation](https://infinisil.com/modules.mp4) of the [Summer of Nix Modules](https://github.com/tweag/summer-of-nix-modules), during the 2021 Summer of Nix. | |
::: |
Can this be hosted on Youtube? Then people won't need to use mpv or another tool for viewing the stream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #785 to track that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated section titles
@proofconstruction Please feel free to push to the branch here directly or open a separate PR! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My overall comment on this is that it's actually two separate tutorials in length. I got about half way through before I mentally ran out of gas, and I only lasted that long because I was trying to complete the review. I suspect a new user will not make it that far before losing interest or needing to take a break. I propose that this is broken into two tutorials:
- Module basics (defining a module, evaluating a module, types, etc)
- Good module APIs (using options to define other options, whatever is in the second half of this tutorial, etc).
This thing is a monster and I suspect it's too much work for any of us to break it down into something more palatable. But it IMO should still be out there to have something at all, so we could label it as such and present it as an appendix. We'd still need a briefer introduction to the basics, but that can still be done independently. |
Co-authored-by: Valentin Gagarin <[email protected]>
Co-authored-by: asymmetric <[email protected]>
...hopefully. can't test it without Google API key
yes, this looks scary, and yes, it works.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-make-learning-programming-on-nix-less-painful/34729/4 |
|
||
## Overview | ||
|
||
This tutorial follows [@infinisil](https://github.com/infinisil)'s [presentation on modules](https://infinisil.com/modules.mp4) ([source](https://github.com/tweag/summer-of-nix-modules)) for participants of [Summer of Nix](https://github.com/ngi-nix/summer-of-nix) 2021. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fyi I just updated https://infinisil.com/modules.mp4 to use H.264 instead, so this should now easily play in browsers :)
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nixos-module-decorators/34920/2 |
This comment was marked as outdated.
This comment was marked as outdated.
What do you think of this way of doing highlights? It's quite time-consuming so would like to gather feedback before proceeding much further. The advantage is that we get syntax highlighting, because the block is marked as BeforeAfter |
This comment was marked as outdated.
This comment was marked as outdated.
module-system.md: replace comments with captions
🚀 Deployed on https://655b7d9f43f259267455eff9--nix-dev.netlify.app |
It's not great IMO. It loses the one thing which is the whole point of |
Co-authored-by: Valentin Gagarin <[email protected]>
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-11-09-documentation-team-meeting-notes-93/35244/1 |
* change most headers to be about module features Some headers could not be made about module features, and that's a strong signal that those sections should be removed. * Apply suggestions from code review Co-authored-by: Valentin Gagarin <[email protected]> --------- Co-authored-by: Silvan Mosberger <[email protected]> Co-authored-by: Valentin Gagarin <[email protected]>
Effectively a raw dump of https://github.com/tweag/summer-of-nix-modules
Overall structure seems usable, but needs some work