Skip to content

Recommend pkgs.newScope over lib.callPackageWith #1183

Open

Description

@eclairevoyant

Observations
lib.callPackageWith doesn't bring pkgs.xorg the way regular pkgs.callPackage does.

https://github.com/NixOS/nixpkgs/blob/42cd7da40a9c88dd0ec2ea4f2682093f54c6c41a/lib/customisation.nix#L259-L324

https://github.com/NixOS/nixpkgs/blob/42cd7da40a9c88dd0ec2ea4f2682093f54c6c41a/pkgs/top-level/splice.nix#L142-L160

Since pkgs.callPackage is just pkgs.newScope { }:

https://github.com/NixOS/nixpkgs/blob/42cd7da40a9c88dd0ec2ea4f2682093f54c6c41a/pkgs/top-level/splice.nix#L170

we should be recommending pkgs.newScope as a less unwieldy method that properly preserves the pkgs.callPackage behavior.

Problem

Approaches

Willing to help?

Priorities

Add 👍 to issues you find important.

Activity

  1. added
    siteImprovements to the site infrastructure or content presentation
    on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    siteImprovements to the site infrastructure or content presentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions