1
0
Fork 0
mirror of https://github.com/NixOS/nix.dev.git synced 2024-10-18 14:32:43 -04:00
nix.dev/source/contributing/documentation.md
2023-08-10 07:42:49 -06:00

13 KiB

Contributing Documentation

This is an overview of documentation resources for Nix, Nixpkgs, and NixOS, with suggestions how you can help to improve them. Documentation contributions should follow the style guide.

Feel free to in touch with the Nix documentation team if you want to help out.

If you cannot contribute time, consider donating to the NixOS Foundation's documentation project on Open Collective to fund ongoing maintenance and development of reference documentation and learning materials.

Documentation framework

We aim to build our documentation according to the Diataxis framework, which divides documentation into four categories:

  • Reference
  • How-to
  • Explanation
  • Tutorial

We've found that contributors struggle to understand the differences between these categories, and while we strongly recommend reading up on the Diataxis framework, we can summarize them as follows:

  • Reference
    • Reference material includes technical documentation, API documentation, etc.
    • Reference material should be relatively terse, simply listing which functions/classes/etc exist, but should still clearly define how to use the code and how it relates to the rest of the ecosystem.
    • Reference material should focus on "what's out there", with the text and layout optimized for scanning and random access.
    • Reference material should be supplemented with examples.
  • Tutorial
    • Tutorials walk the user through a particular activity to teach them about common tools and patterns in the ecosystem.
    • While the activity itself is important, the goal is also to connect the dots between other things the reader has learned.
  • How-to (we call these "Recipes")
    • Recipes are a list of steps showing how to achieve a specific goal or solve a specific problem.
    • The goal is to help the reader reach a specific end, not understand the theory or greater context.
    • A recipe assumes that the reader already has the background to understand the topic at hand and therefore doesn't need to explain the introduction of each new concept.
  • Explanation (we call these "Concepts")
    • Concepts describe the internals of a piece of code or how to think about a particular idea or entity in the ecosystem.
    • A concept can also describe the historical context behind why something works the way that it does today.
    • If you find yourself wanting to write about the nitty gritty details of how something works, you most likely want to write an explanation.

Recipe vs. tutorial

We find that contributors primarily struggle with the difference between a How-to/Recipe and a Tutorial.

Here are several explanations to help you understand the difference.

  • A recipe is used in a "working" context where the reader just wants a sequence of instructions to achieve an outcome.
    • In this context the reader may already know or may not care how or why these instructions work, they just want to know what to do in order to achieve the desired result.
  • A tutorial is used in a "learning" context where the reader is following a sequence of instructions to gain practice performing a certain task.
    • Some small bits of motivation or explanation are helpful in this context to help a reader connect the dots with other things they may have already learned, but the focus is not on how or why.

A helpful analogy is landing an airplane in two different contexts.

Let's say the pilot is unconscious and you now have to land the plane to avoid a crash landing. In this context you just want to know how not to die. You don't care about how or why, you just want to be on the ground in one piece. This is the context for a recipe.

A pilot training in a flight simulator wants to practice landing the plane. The pilot-in-training needs practice knowing when to deploy the landing gear, when to adjust flaps, etc. Actually landing the plane during the flight simulation is less important than learning the individual skills that make up a successful landing. This is the context for a tutorial.

Finally, one last way of thinking about the difference between How-to/Recipe and Tutorial is like this:

  • Recipe: "step 1: do this, step 2: do that, etc"
  • Tutorial: "take my hand as I show you how to do this"

Reference manuals

The manuals for Nix (source), Nixpkgs (source), and NixOS (source) are purely reference documentation, specifying interfaces and behavior.

They also show example interactions which demonstrate how to use its components, and explain mechanisms where necessary.

The documentation team watches all pull requests to the manuals and assists contributors to get their changes merged.

You can help by

  • picking up documentation-related issues on Nix, Nixpkgs, and NixOS.

  • reviewing documentation-related pull requests on Nix, Nixpkgs, and NixOS.

  • making pull requests which improves existing documentation, such as:

    • add links to definitions, commands, options, etc. where only the name is mentioned
    • correct obvious errors
    • clarify language
    • expanding on sections that appear incomplete
    • identifying sections that are not reference documentation and should be moved to nix.dev

nix.dev

The purpose of nix.dev (source) is to guide newcomers by teaching essential Nix knowledge, show best practices, and help orient users in the Nix ecosystem.

It goes into breadth, not depth.

The documentation team maintains nix.dev as editors.

You can help by

New articles can be based on videos such as:

Since writing a guide or tutorial is a lot of work, please make sure to coordinate with nix.dev maintainers, for example by commenting on or opening an issue to make sure it will be worthwhile.

nixos.org

The Nix project web site is nixos.org (source).

Website contents that concern learning Nix should reference or include material from nix.dev.

The Nix marketing team is responsible for the web site, and the documentation team assists with maintaining contents related to onboarding new users.

Communication channels

Matrix

Use Matrix for casual communication.

The documentation team frequents the Nix* Documentation room.

Old messages are extremely improbable to be read by anyone.

You can help by posting in the appropriate categories on Discourse what you have found valuable.

Discourse

Discourse is the central community hub.

This is the place for your questions, suggestions, and discussion.

The documentation team monitors the Documentation category.

Old threads and especially posts in long threads are improbable to be read by many people.

You can help by

  • asking informed questions, showing what you have done so far
  • answering other people's questions
  • writing down what you have learned by updating or adding a NixOS Wiki article, nix.dev guide or tutorial, or one of the manuals
  • encouraging and helping people to incorporate their insights in the official documentation

Meetings and Events

Check the Discourse community calendar for real-time events.

The documentation team holds regular meetings and posts meeting notes in the Documentation category.

You can help by joining meetings to take notes or clean them up before publishing.

External sources

The Internet is full of helpful resources concerning Nix.

You can help by sharing in the Links category on Discourse what you have found valuable.

Wiki

NixOS Wiki is a collection of interlinked guides to solve common problems which are otherwise not well-documented.

It is collectively edited by the community, covers a broad range of topics. It is only loosely organized, and does not impose quality standards. Its purpose is to quickly and conveniently collect insights and make them readily available for everyone.

We recommend to use it as a dumping ground for more obscure Nix knowledge, and strive to make it smaller over time (see NixCon 2015: Make Nix friendlier for Beginners), by incrementally incorporating its contents into authoritative documentation and curated learning material.

The documentation team does not maintain the Wiki.

You can still help with

  • improving discoverability by adding categorization and relevant links
  • clarifying articles and correcting errors
  • removing redundant information that is already present in curated sources
  • migrating information to other resources.

Where to migrate what:

Nix Pills

Nix Pills is a series of low-level tutorials on building software packages with Nix, showing in detail how Nixpkgs is made from first principles. Work is currently being done to bring the Nix Pills up-to-date with the current state of Nix and current best-practices of Nixpkgs. Furthermore, work is underway to migrate the technical infrastructure of Nix Pills to improve maintainability and make it easier for others to contribute.

You can help by

  • opening issues for any errors or outdated information you find
  • addressing good first issues by opening pull requests
  • Test code examples to ensure correctness and completeness.
  • Add links to reference documentation where needed.

Licensing and attribution

When opening pull requests with your own contributions, you agree to licensing your work under CC-BY-SA 4.0.

When adding material by third parties, make sure it has a license that permits this. In that case, unambiguously state source, authors, and license in the newly added material. Notify the authors before using their work.

Add the original author as co-author to the first commit of your pull request, which should contain the original document verbatim, so we can track authorship and changes through version history.

Using free licenses other than CC-BY-SA 4.0 is possible for individual documents, and by contributing changes to those documents you agree to license your work accordingly.