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

treewide: remove global with lib; statements in pkgs #211241

Closed
wants to merge 1 commit into from

Conversation

Shawn8901
Copy link
Contributor

@Shawn8901 Shawn8901 commented Jan 17, 2023

Description of changes

I read on some PRs the Feedback that the global with lib; statement should be avoided. As people often start by looking on other code when doing their first packages i thought its quite counter effective, that we have a lot of that usage in existing packages and new contributer later on then get told to remove that, which can get quite frustrating.

Thus i spend some time in editing most of the trivial usages out of pkgs/**.

I am not 100% sure about the large change, so i would like to gather feedback it can be merged in a this large single commit, or if this should be more splitted.

I tried to follow the rule to replace all with lib; with lib. but if its for the meta attr. For meta i replaced it with meta = with lib; { if there was no other scoping before that. It there was other scoping i tried to follow that.

There are still about 20 occurrences of global with lib;, if the scope does not resolve super trivial.

split prs:

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@Shawn8901
Copy link
Contributor Author

My vscode setup seems to fail on eval a lot of bigger files, and as i dont want to continuously force push that branch i have to figure out before how to properly check on that, when the editor is lying to me.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 labels Jan 17, 2023
@roberth
Copy link
Member

roberth commented Jan 17, 2023

This is great, but I would recommend to split this up into a couple of smaller PRs so that a maintainer doesn't have to commit to reviewing the whole thing to make progress.

@Shawn8901
Copy link
Contributor Author

Shawn8901 commented Jan 17, 2023

Is splitting it into the pkgs subfolders "enough" or more like per package? (i am okay with doing both, just asking 😄 )

@AndersonTorres
Copy link
Member

Per package would be better - it will be easier to find in the Git history tree.

But it can be harder if you don't use some form of scripted automation.

Usually I do a coarse batch modification as a first pass, then I refine until it doesn't explode my computer :), list all modified files using git status, and use the output to feed a quick script written directly in Emacs shell emulator.

My suggestion would be something like

  1. open multiple PRs for each directory or bunch of , say, 200 files;
  2. each PR should have commits individuated per physical file, or in the case of Nixpkgs, individual expressions.

@Shawn8901
Copy link
Contributor Author

okay. i mean i can switch the method of doing that. Currently the split (and already merged) cover about 50% of this PR. I will work on some automation, but this will then take some more time to figure that out

@Shawn8901
Copy link
Contributor Author

closing that, as i dont have time for writing the suggested script at the moment and keeping the old state open does not make a lot sense, so i will cease on that overall topic for the moment.

@Shawn8901 Shawn8901 closed this Feb 10, 2023
@Shawn8901 Shawn8901 deleted the remove_with_lib branch February 10, 2023 21:22
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.

3 participants