Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

top-level: exclude all makeScope attributes from splicedPackagesWithXorg #68525

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nspin
Copy link
Contributor

@nspin nspin commented Sep 11, 2019

The list of attributes passed to builtins.removeAttrs is missing
overrideScope'. Using the packages makeScope attribute to isolate the
scope's packages is robust against further additions to makeScope.

Motivation for this change

To remove the xorg scope's auxiliary attributes from the scope provided by callPackage.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

The list of attributes passed to builtins.removeAttrs is missing
overrideScope'. Using the packages makeScope attribute to isolate the
scope's packages is robust against further additions to makeScope.
@Ericson2314
Copy link
Member

Neat! Where is this packages function defined?

@nspin
Copy link
Contributor Author

nspin commented Sep 12, 2019

Here:

makeScope = newScope: f:
let self = f self // {
newScope = scope: newScope (self // scope);
callPackage = self.newScope {};
overrideScope = g: lib.warn
"`overrideScope` (from `lib.makeScope`) is deprecated. Do `overrideScope' (self: super: { … })` instead of `overrideScope (super: self: { … })`. All other overrides have the parameters in that order, including other definitions of `overrideScope`. This was the only definition violating the pattern."
(makeScope newScope (lib.fixedPoints.extends (lib.flip g) f));
overrideScope' = g: makeScope newScope (lib.fixedPoints.extends g f);
packages = f;
};
in self;

@lheckemann lheckemann added this to the 20.03 milestone Sep 12, 2019
@Ericson2314
Copy link
Member

Ericson2314 commented Sep 13, 2019

Can we do

 makeScope = newScope: f:
   let rawSet = f self; 
       self = rawSet // { 
         newScope = scope: newScope (self // scope); 
         callPackage = self.newScope {}; 
         overrideScope = g: lib.warn 
           "`overrideScope` (from `lib.makeScope`) is deprecated. Do `overrideScope' (self: super: { … })` instead of `overrideScope (super: self: { … })`. All other overrides have the parameters in that order, including other definitions of `overrideScope`. This was the only definition violating the pattern." 
           (makeScope newScope (lib.fixedPoints.extends (lib.flip g) f)); 
         overrideScope' = g: makeScope newScope (lib.fixedPoints.extends g f); 
         packages = f;
         include rawSet;
       }; 
   in self; 

and then do

splicedPackagesWithXorg = splicedPackages // splicedPackages.xorg.rawSet;

Yes, fix f = f (fix f), but I am concerned that if the fixed point doesn't exist, then packages self will lead to more confusing errors than rawSet.

@nspin
Copy link
Contributor Author

nspin commented Sep 16, 2019

Good call. That change could be taken a step further. What do you think about:

{ # ...
         newScope = scope: newScope (rawSet // scope); 
         callPackage = newScope self; 
} # ...

@nspin
Copy link
Contributor Author

nspin commented Sep 16, 2019

Or even further. I'm not suggesting that the following extension is appropriate, but it's a thought worth sharing:

{ # ...
         newScope = scope: newScope (rawScope // rawScope.protected or {} // scope); 
         callPackage = newScope (self // rawScope.protected or {} // rawScope.private or {}); 
} # ...

@nspin nspin mentioned this pull request Sep 17, 2019
@disassembler disassembler modified the milestones: 20.03, 20.09 Feb 5, 2020
@stale
Copy link

stale bot commented Aug 3, 2020

Hello, I'm a bot and I thank you in the name of the community for your contributions.

Nixpkgs is a busy repository, and unfortunately sometimes PRs get left behind for too long. Nevertheless, we'd like to help committers reach the PRs that are still important. This PR has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

If this is still important to you and you'd like to remove the stale label, we ask that you leave a comment. Your comment can be as simple as "still important to me". But there's a bit more you can do:

If you received an approval by an unprivileged maintainer and you are just waiting for a merge, you can @ mention someone with merge permissions and ask them to help. You might be able to find someone relevant by using Git blame on the relevant files, or via GitHub's web interface. You can see if someone's a member of the nixpkgs-committers team, by hovering with the mouse over their username on the web interface, or by searching them directly on the list.

If your PR wasn't reviewed at all, it might help to find someone who's perhaps a user of the package or module you are changing, or alternatively, ask once more for a review by the maintainer of the package/module this is about. If you don't know any, you can use Git blame on the relevant files, or GitHub's web interface to find someone who touched the relevant files in the past.

If your PR has had reviews and nevertheless got stale, make sure you've responded to all of the reviewer's requests / questions. Usually when PR authors show responsibility and dedication, reviewers (privileged or not) show dedication as well. If you've pushed a change, it's possible the reviewer wasn't notified about your push via email, so you can always officially request them for a review, or just @ mention them and say you've addressed their comments.

Lastly, you can always ask for help at our Discourse Forum, or more specifically, at this thread or at #nixos' IRC channel.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 3, 2020
@SuperSandro2000 SuperSandro2000 marked this pull request as draft November 29, 2020 04:43
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 29, 2020
@FRidh FRidh modified the milestones: 20.09, 21.03 Dec 20, 2020
@stale
Copy link

stale bot commented Jun 18, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 18, 2021
@Ericson2314
Copy link
Member

@nspin I am sorry I never replied. some people do have callPackage as one of their parameters of the function being callPackaged, so I am not sure the latter two are what we want, but it was certainly good to think about.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 19, 2021
@stale
Copy link

stale bot commented Jan 8, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 8, 2022
@Artturin Artturin modified the milestones: 21.05, 23.05 Dec 31, 2022
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 31, 2022
@Artturin Artturin removed this from the 23.05 milestone Feb 17, 2023
@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict labels Mar 19, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants