Skip to content

:doc comments for attributes loaded into scope #11557

Open
@roberth

Description

Is your feature request related to a problem? Please describe.

(with NixOS/nixpkgs#343235)

$ nix repl
Nix 2.25.0pre20240910_9c0e968
Type :? for help.
nix-repl> :lf .
Added 18 variables.

nix-repl> :doc lib
error: value does not have documentation

nix-repl> :doc outputs.lib
Attribute libdefined at /nix/store/5y3fzyiz80chjxan9qgyrdwvww8n196j-source/flake.nix:27:7

    nixpkgs.lib is a combination of the Nixpkgs library, and other attributes that are not part of the Nixpkgs library, but part of the Nixpkgs flake:

      · lib.nixosSystem for creating a NixOS system configuration
    
      · lib.nixos for other NixOS-provided functionality, such as runTest

Describe the solution you'd like

Either

  • Save the loaded attribute set
  • Eagerly load the docs into an extra map<string, Doc> during :lf, command line installable loading, and :l
  • Make the docs part of StaticEnv or something? If that doesn't degrade performance.

Describe alternatives you've considered

Additional context

The workaround suffers from #8059, as outputs is not available when an installable (CLI argument) is loaded.

Priorities

Add 👍 to issues you find important.

Metadata

Assignees

No one assigned

    Labels

    featureFeature request or proposalreplThe Read Eval Print Loop, "nix repl" command and debugger

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions