Skip to content

Documentation for the builders (renamed: build helpers)#262648

Merged
fricklerhandwerk merged 6 commits intoNixOS:masterfrom
ShamrockLee:doc-builder
Nov 7, 2023
Merged

Documentation for the builders (renamed: build helpers)#262648
fricklerhandwerk merged 6 commits intoNixOS:masterfrom
ShamrockLee:doc-builder

Conversation

@ShamrockLee
Copy link
Contributor

@ShamrockLee ShamrockLee commented Oct 22, 2023

Description of changes

In Nixpkgs, we have several functions that helps defining a derivation. Such function is currently called "builders", and are document in the Builders part in the Nixpkgs manual.

This PR aims to

  1. Define and introduce the builders in the Nixpkgs manual.
  2. Properly document the function-based attribute recursion (finalAttrs: { }) to distinguish it from the recursive attribute (rec { }).
  3. Document the new approach to define a builder that supports function-based attribute recursion and add such support to existing builder implementations through lib.extendMkDerivation and lib.extendMkDerivationModified introduced in lib.extendMkDerivation: init #234651. (Split out of this PR)
  4. Discuss if we wouldike to rename the term "builder" to something else. (Previous discussion: lib.extendMkDerivation: init #234651 (comment)) (candidate: build helper)

This PR also

  • Moves Nixpkgs manual section darwin.linux-builder from chapter Special build helper to chapter Packages, and emphasize that it is about remote builder bootstrap instead of build helpers.
  • Moves doc/build-helpers/packages/ -> doc/packages/ to make it parallel to doc/hooks/ and prepare for future migration. (The Packages chapter is mostly not about build helpers.)

Closes #235858

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added the 8.has: documentation This PR adds or changes documentation label Oct 22, 2023
@ShamrockLee ShamrockLee mentioned this pull request Oct 22, 2023
12 tasks
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Oct 22, 2023
@ShamrockLee ShamrockLee changed the title General documentation for the builders Documentation for the builders Oct 22, 2023
Copy link
Contributor

@fricklerhandwerk fricklerhandwerk left a comment

Choose a reason for hiding this comment

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

The new documentation is great and the names are terrible. Let the bikeshedfest begin.

Copy link
Contributor

@fricklerhandwerk fricklerhandwerk Oct 23, 2023

Choose a reason for hiding this comment

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

This should use an :::{example} block, but I wouldn't... block on that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for telling me that!

BTW, this part of documentation seems to be a duplication of the function reference of lib.extendMkDerivation. I originally write it here just because lib.customization was not included in the function reference then.

I think we should either:

  1. Link from here to the function reference, or
  2. Link form the function reference to here.

The first one sounds more sensible to me. It's a pity that we don't have a way to link against the documentation of each function.

Copy link
Contributor Author

@ShamrockLee ShamrockLee Oct 31, 2023

Choose a reason for hiding this comment

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

This should use an :::{example} block, but I wouldn't... block on that.

Addressed.

The example block rendering seems a bit buggy. It randomly affects the style of the next few paragraphs (e.g. showing underline when moving the point er across the paragraphs).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a pity that we don't have a way to link against the documentation of each function.

Update:

We do have a way to link against it. The anchor would be finction-library-lib.customisation.extendMkDerivation. I really hope these automatic generation of anchors could be mentioned somewhere in the documentation.

Copy link
Contributor

@fricklerhandwerk fricklerhandwerk left a comment

Choose a reason for hiding this comment

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

@ShamrockLee if you don't have time I could take over the fixups. If there is no further feedback in the next 1-2 weeks we should merge this.

@ShamrockLee ShamrockLee force-pushed the doc-builder branch 3 times, most recently from 072a09f to 204a135 Compare October 31, 2023 04:53
@ShamrockLee
Copy link
Contributor Author

A big wind just blew:

  • doc/builders/packages -> doc/packages (without document changes, just like "languages and frameworks" and "hooks")
  • doc/builders/spacial/darwin-builder.md -> doc/packages/spacial/darwin-builder.md (with document changes)
  • doc/builders -> doc/build-helpers (with document changes)

@ShamrockLee
Copy link
Contributor Author

Rebase to resolve conflicts with master changes.

Copy link
Contributor

@fricklerhandwerk fricklerhandwerk left a comment

Choose a reason for hiding this comment

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

This has seen quite a bit of work now, and it's a very strong improvement over the previous state of affairs.

@ShamrockLee ShamrockLee marked this pull request as ready for review October 31, 2023 11:34
@ShamrockLee ShamrockLee force-pushed the doc-builder branch 2 times, most recently from b6be6d2 to 178495f Compare October 31, 2023 16:34
@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Oct 31, 2023

Two examples added to the "Build Helper" introduction chapter.

@infinisil infinisil marked this pull request as draft October 31, 2023 16:53
@ShamrockLee ShamrockLee force-pushed the doc-builder branch 2 times, most recently from f46650c to 2fc318d Compare October 31, 2023 18:13
@ShamrockLee ShamrockLee requested a review from infinisil October 31, 2023 18:18
@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Oct 31, 2023

It is only the last commit that depends on #234651. It's possible to split that commit away if we hope to merge this earlier. (Nixpkgs release 23.11 seems on the way.)

@fricklerhandwerk
Copy link
Contributor

Yes, let's split out that last one and merge soon.

@fricklerhandwerk fricklerhandwerk marked this pull request as ready for review November 2, 2023 00:44
@ShamrockLee
Copy link
Contributor Author

Yes, let's split out that last one and merge soon.

Just dropped it from this feature branch.

@ShamrockLee ShamrockLee changed the title Documentation for the builders Documentation for the ~~builders~~ build helpers Nov 2, 2023
@ShamrockLee ShamrockLee changed the title Documentation for the ~~builders~~ build helpers Documentation for the builders (renamed: build helpers) Nov 2, 2023
@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-10-30-documentation-team-meeting-notes-90/34936/1

@ShamrockLee
Copy link
Contributor Author

Rebase to resolve merge conflicts.

@ShamrockLee ShamrockLee requested a review from edolstra as a code owner November 3, 2023 21:43
@github-actions github-actions bot added the 6.topic: policy discussion Discuss policies to work in and around Nixpkgs label Nov 3, 2023
@fricklerhandwerk fricklerhandwerk dismissed infinisil’s stale review November 3, 2023 23:05

Addressed all comments

@fricklerhandwerk
Copy link
Contributor

@infinisil @roberth @RaitoBezarius this needs another approval. I'd like to merge that as is, it's a very strong improvement.

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

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

Needs another rebase, but otherwise looking good!

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Nov 7, 2023

Do we need to add entries in the release note for these changes?

The file hierarchy inside the doc directory seems rather internal. Let's keep it as is.

@fricklerhandwerk fricklerhandwerk merged commit bb6b849 into NixOS:master Nov 7, 2023
@ShamrockLee ShamrockLee deleted the doc-builder branch November 7, 2023 23:37
@tie tie mentioned this pull request Jul 18, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: policy discussion Discuss policies to work in and around Nixpkgs 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Documentation: darwin.builder does not belong to the Builder part

4 participants