Nix RFC Process

repository·master·Indexed 20 days ago

https://github.com/nixos/rfcs

Documentation for the Request For Comments (RFC) process used for substantial changes to the Nix ecosystem. This includes guidelines for proposing semantic or syntactic language changes, Nixpkgs restructurings, and new interfaces, as well as details on the submission workflow, roles of the Steering Committee and Shepherd Team, and the Final Comment Period (FCP).

Tokens
40.6K
Snippets
70
Records
166
Agent score
66%

What's inside nixos-rfcs

  1. Understand the NixOS Container rewrite (RFC 0108)

    master

    RFC 0108 proposes replacing the legacy nixos-container subsystem with a new implementation based on systemd-nspawn(5) and systemd-networkd(8).

    Key improvements include:

    • Reliable Networking: Uses systemd-networkd to ensure network uplinks are available immediately during container boot, preventing services (like nextcloud-setup.service or clamav) from hanging due to missing connectivity.
    • Standardized Configuration: Moves away from ad-hoc CLI flags in favor of using native .nspawn units defined via Nix expressions. This allows for easier overrides and support for advanced features like IPVLAN.
    • Improved Tooling: Replaces the custom Perl-based nixos-container.pl with a Python implementation and leverages machinectl(1) for standard operations like starting, stopping, and logging into containers.
  2. Migrate Nixpkgs and NixOS documentation to CommonMark

    master

    The Nixpkgs and NixOS documentation is transitioning from Docbook to CommonMark (a flavor of Markdown). This change aims to make documentation easier to write, maintain, and contribute to by using a widely recognized format.

    Key requirements for the new documentation website include:

    • An easy-to-find "Edit on GitHub" button.
    • A high-quality search engine.
    • Syntax highlighting for all code blocks.
    • A separate page per chapter (moving away from monolithic pages).
    • A sidebar table of contents for each chapter.
    • Distinctive styling for warning and info boxes.
    • Customizable HTML and CSS templates.
  3. What is the Final Comment Period (FCP)?

    master

    The Final Comment Period (FCP) is a formal 10-calendar-day window (ensuring at least 5 business days) used to finalize an RFC decision.

    • Trigger: It is called by the Shepherd Team after ample discussion has occurred and tradeoffs have been addressed.
    • Motion: Before entering FCP, the Shepherd Team must propose a motion (accept or reject) and all Shepherd Team members must sign off on the motion.
    • Purpose: To allow stakeholders to lodge final objections or push back if they believe the FCP was called prematurely.
    • Outcome: If substantial new arguments are raised during FCP, the period can be canceled and the RFC returned to development. Otherwise, the Steering Committee will either merge the RFC into accepted or close the PR.
  4. What is Bootspec and how is it used?

    master

    Bootspec is a machine-parsable intermediate representation (IR) that defines a NixOS Generation as a set of memoized facts about a system's closure.

    It acts as a stable bridge between the NixOS system definition and bootloader management tools. Instead of bootloader backends (like systemd-boot or grub) having to manually inspect the filesystem or profile directories to discover boot information, they consume the Bootspec definition to generate bootloader entries (e.g., files in /boot/loader/entries/ or grub.cfg).

    This approach allows for:

    • Uniform feature support: Making it easier to implement features like Initrd Secrets, Multiple Profiles, and Specialisations across different bootloaders.
    • Externalized management: Enabling users to implement custom bootloader tools or enterprise-grade policies (like centralized SecureBoot signing) without patching Nixpkgs or NixOS.
  5. Nix Function Application Formatting

    master

    In a function application chain, the first element is the function and the rest are arguments.

    • Single Line: As many arguments as possible are fitted onto the first line.
    • Expansion: If the line length limit is reached, the first argument not fitting on the first line starts a new line with indentation, and all subsequent arguments also start on their own lines.
    • Parentheses: If the last argument is parenthesized, the parentheses are typically absorbed while the body is put on a new line with indentation (unless the body is a simple, absorbable term).
    # All arguments fit onto the first line
    function arg1 arg2
    
    # Line length limit reached
    function arg1 arg2 arg3
      arg4
      arg5
    
    # Last argument is a multiline expression
    function arg1 {
      more = "things";
    }
  6. Guidelines for choosing CommonMark extensions

    master

    While the specific toolchain is at the discretion of implementers, the following guidelines apply to the use of CommonMark extensions to ensure interoperability and ease of switching between toolchains:

    • Keep extensions minimal: The goal is to remain close to standard CommonMark to facilitate switching generators.
    • Acceptable extensions:
      • Tables (as they are infrequent and easy to convert manually).
      • YAML frontmatter for metadata (widely supported by most toolchains).
    • Required extensions: Support for defining references between sections is essential for navigation.
    • Avoid HTML elements: Do not use HTML <span> or block elements directly in the documentation source, as this complicates generating non-HTML formats like man pages or epub.
  7. Compare RFC 0062 and RFC 0017

    master

    Both RFC 0062 and RFC 0017 aim to implement content-addressed paths, but they differ in scope:

    • RFC 0017: Proposes a fundamental change to the base model of Nix.
    • RFC 0062: Proposes minimal changes to allow a content-addressed model to live in parallel with the current model. This is intended as an incremental approach that will eventually be subsumed by RFC 0017.
  8. How RFC Steering Committee (RFCSC) membership rotation works

    master

    The RFC Steering Committee (RFCSC) maintains a constant membership of five people. Rotation occurs annually through a process where the current committee unanimously elects its successors.

    Annual Election Cycle

    1. Nomination Period: Starts at the beginning of November and lasts at least four weeks. Nominations are announced on discourse.nixos.org, IRC (#nixos and #nixos-dev), and NixOS Weekly. Anyone can nominate themselves or others (provided the nominee accepts).
    2. Election: Occurs at the first RFCSC meeting in December. The committee attempts to reach a unanimous decision on the next members.
    3. Tie-breaking: If unanimity fails, members vote on nominees and rank them. If there is a tie for the 5th and 6th spots, run-off votes are held.
    4. Handover: The new RFCSC takes over in the first week of January.

    Mid-term Vacancies

    If membership drops below five members (e.g., due to resignation), a new member is elected after a nomination period of at least two weeks. A member filling a mid-term vacancy only serves for the remainder of the current term.

    Note: If membership drops below 4 people, the committee cannot proceed with shepherd team selections until new members are elected.

  9. Differentiate doc-comments from implementation comments

    master

    The RFC defines two distinct types of comments to improve code clarity and tooling support:

    1. doc-comment: A structured comment (using the /** */ syntax) intended to document the code's interface (functions, types, modules). These are designed to be parsed by tools for rendering API documentation.
    2. implementation comment: A free-form comment (using standard # or /* */ syntax) used to explain internal design concerns or implementation details that are not part of the public interface.
  10. Understand the drawbacks of the simple-package-paths design

    master

    The pkgs/by-name directory structure introduces several trade-offs that developers should be aware of:

    • Scope Limitation: This structure is only applicable to top-level packages using callPackage. It cannot be used for nested packages like python3Packages.requests or those defined via haskellPackages.callPackage.
    • Code Ownership: It is no longer possible to use GitHub CODEOWNERS for category-based directories.
    • Loss of Categorization: The existing categorization of packages is lost, though proponents argue that categorization was often incomplete or inconvenient.
    • Broken Builtins: The use of this structure breaks builtins.unsafeGetAttrPos "name" pkgs. The project has decided that attribute position information is not part of the stable public interface and is inherently unreliable.
  11. Replace Unicode quotes with ASCII in Nix output

    master

    Nix is transitioning from using Unicode glyphs for quoting strings and paths in its output to using standard ASCII " and ' characters. This change applies to strings intended for build logs or console output.

    Motivation for the change

    • Correctness: Unicode quotes interact poorly with shell variable interpolation. For example, in bash, the first UTF-8 byte of a Unicode quote like can be misinterpreted as part of a variable name, leading to unexpected empty strings or errors.
    • Compatibility: Many terminal emulators (like rxvt-unicode or st) do not recognize Unicode quotes as delimiters, making copy-pasting strings from the terminal difficult. Some terminals (like Eterm) may fail to render them correctly.
    • Consistency: Replacing specific quotes for compatibility created a mix of styles; moving to ASCII ensures a uniform output format.

    Implementation Scope

    • Target: Strings printed in the console or part of build logs.
    • Exclusions: The change should not alter comments, documentation (except for code snippets within documentation), or derivation outputs by changing input variables.
    • Affected Components: Primarily the Nix core, with nixpkgs following for consistency (e.g., updating module descriptions).
  12. Understand musl-libc support in Nixpkgs

    master

    Nixpkgs provides experimental support for musl as an alternative to the standard glibc implementation when targeting Linux platforms. This support is treated similarly to adding a new architecture (like Aarch64 or RISC-V).

    Key Characteristics

    • Experimental: The support is considered experimental and may have limited compatibility compared to x86_64-unknown-linux-gnu.
    • Scope: Currently focuses primarily on non-GUI packages due to dependencies like systemd that are not fully portable to musl environments.
    • Linking: While musl is often used for static linking, current Nixpkgs support prefers dynamic linking and shared libraries.
    • Implementation: Includes musl-based bootstrap, a native musl building stdenv, and a cross-musl stdenv.