Skip to content

Automatically load extra attributes into flake repl #13264

Open
@roberth

Description

@roberth

Is your feature request related to a problem?

  • nix repl usage can be repetitive.
  • People tend to use the same repetitive / verbose commands and attributes.
  • Those attributes do not align with what flake outputs are, so they should not, and often can not be added to the flake outputs.
  • The ecosystem needs to be conservative about outputs, but less so about repl conveniences.
  • Some attributes are intended for debugging and such, and other code should not depend on their structure, which will change without notice.

Proposed solution

Add a flake output which is automatically loaded into the repl scope, on top of the flake outputs (//).

  # nixpkgs/flake.nix
  {
    outputs = { self, ... }: {
      legacyPackages = ...;

      # (extraReplScope?)
      # This is merged into the repl scope, not the flake
      replScope = info: {
        pkgs = self.legacyPackages.${info.currentSystem};
      };
    }
  }

When loading the flake, it should be clear in the output which attributes are flake outputs, and which ones are the extra ones.

Alternative solutions

  • Add repl-overlays setting #10203

    Configuration is a double edged sword. It lets "power users" be more comfortable, most of the time, but it requires everyone to invest time into that sort of thing, or accept an unpleasant product.

Additional context

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    Status

    ⚖ To discuss

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions