Skip to content
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

Merged
merged 40 commits into from
Nov 20, 2023
Merged

Conversation

infinisil
Copy link
Member

@infinisil infinisil commented Jul 13, 2023

Effectively a raw dump of https://github.com/tweag/summer-of-nix-modules

Overall structure seems usable, but needs some work

@cloudflare-workers-and-pages

This comment was marked as outdated.

@nixos-discourse
Copy link

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

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hugosenari
Copy link

Your PR make content about modules in this site infinitely more comprehensive. ❤️
Thanks

@nixos-discourse
Copy link

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

@nixos-discourse
Copy link

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

Copy link
Contributor

@proofconstruction proofconstruction left a 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

source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
@@ -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
Copy link
Contributor

@proofconstruction proofconstruction Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor

@asymmetric asymmetric Nov 3, 2023

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.

Copy link
Contributor

@proofconstruction proofconstruction left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated section titles

source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
@infinisil
Copy link
Member Author

@proofconstruction Please feel free to push to the branch here directly or open a separate PR!

Copy link
Contributor

@zmitchell zmitchell left a 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).

source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
source/tutorials/module-system/module-system.md Outdated Show resolved Hide resolved
@fricklerhandwerk
Copy link
Collaborator

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.

@nixos-discourse
Copy link

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.
Copy link
Member Author

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 :)

@nixos-discourse
Copy link

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.

@infinisil infinisil marked this pull request as ready for review November 3, 2023 09:10
@asymmetric
Copy link
Contributor

asymmetric commented Nov 3, 2023

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 nix, instead of diff. The downside is we loose the diff -- we don't show what was removed, just the new snippet with highlight. The color can be changed, of course.

Before

modules-before

After

modules

This comment was marked as outdated.

Copy link
Contributor

github-actions bot commented Nov 4, 2023

@github-actions github-actions bot temporarily deployed to pull request November 4, 2023 20:45 Inactive
@github-actions github-actions bot temporarily deployed to pull request November 4, 2023 20:56 Inactive
@fricklerhandwerk
Copy link
Collaborator

What do you think of this way of doing highlights?

It's not great IMO. It loses the one thing which is the whole point of diff.

Co-authored-by: Valentin Gagarin <[email protected]>
@github-actions github-actions bot temporarily deployed to pull request November 9, 2023 15:25 Inactive
@nixos-discourse
Copy link

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]>
@github-actions github-actions bot temporarily deployed to pull request November 18, 2023 21:43 Inactive
@github-actions github-actions bot temporarily deployed to pull request November 20, 2023 15:39 Inactive
@infinisil infinisil dismissed asymmetric’s stale review November 20, 2023 15:40

Agreed to merge it as is

@infinisil infinisil merged commit 3792248 into master Nov 20, 2023
9 checks passed
@infinisil infinisil deleted the module-system-introduction branch November 20, 2023 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants