Skip to content

beets: make it easier to override builtin plugins#471166

Closed
9999years wants to merge 1 commit intoNixOS:masterfrom
9999years:wiggles/vxuy
Closed

beets: make it easier to override builtin plugins#471166
9999years wants to merge 1 commit intoNixOS:masterfrom
9999years:wiggles/vxuy

Conversation

@9999years
Copy link
Contributor

Previously, it was possible to override builtin plugins. Now it's not. After this commit, it is again :)

You may have a patch (e.g. a not-yet-merged or not-yet-released PR) that adds a new builtin plugin.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. 6.topic: python Python is a high-level, general-purpose programming language. labels Dec 15, 2025
@9999years 9999years requested review from aszlig and doronbehar and removed request for doronbehar December 17, 2025 21:33
@nixpkgs-ci nixpkgs-ci bot removed the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Dec 17, 2025
@doronbehar
Copy link
Contributor

Hey, thanks for the PR! Your approach on first sight seems better then mine:

Could you give an example for an overlay using your change here? Indeed my overlay example seems pretty clumsy so I'd like to compare these overlays' clumsiness :).

@9999years
Copy link
Contributor Author

9999years commented Dec 22, 2025

@doronbehar Thanks for the prompt! I added a couple of new passthru.tests attributes, and found a bug in my implementation! (I needed lib.filterAttrs (_: p: p.builtin or false) to handle missing attributes.)

Here's a usage example:

(beets.override {
  pluginOverrides = {
    my_special_plugin.builtin = true;
  };
}).overridePythonAttrs
  (prev: {
    postPatch = (prev.postPatch or "") + ''
      mkdir -p beetsplug/my_special_plugin
      touch beetsplug/my_special_plugin/__init__.py
    '';
  });

https://github.com/NixOS/nixpkgs/blob/379808b7dcdd0dbdf85b367401c126c11605ab9c/pkgs/development/python-modules/beets/default.nix#L498-L509

I also added an example of building beets with the beetcamp plugin enabled, which annoyingly requires a separate overridePythonAttrs to set dontUsePythonCatchConflicts = true, because beetcamp depends on beets, but the derivation hashes can't match:

https://github.com/9999years/nixpkgs/blob/185e8e16f746a975245c3aa904002d63c944f584/pkgs/development/python-modules/beets/default.nix#L481-L496

Copy link
Contributor

@doronbehar doronbehar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach is great. I have another nit request if you can please: Could you put the passthru.tests in 1 commit, and then fix beets.passthru.tests.beets-with-new-builtin-plugin in a 2nd commit? It'd be easier to see the fix more clearly. Also, in the 1st commit I'd put also a note in the big comment at the beginning of the file pointing out the examples in passthru.tests.

@doronbehar
Copy link
Contributor

BTW On a 2nd thought, I think that my changes in #467091 don't contradict the changes here, and should be useful anyway. @9999years Could you review my changes there and then we can continue here?

@doronbehar
Copy link
Contributor

Oh and I almost forgot: The commit fixing beetcamp should be a separate commit too.

@9999years
Copy link
Contributor Author

9999years commented Dec 23, 2025

Sure, I'm going to split the beetcamp stuff into a separate PR (#473678). This should be easier to approve now. PTAL, thanks!

9999years added a commit to 9999years/nixpkgs that referenced this pull request Dec 23, 2025
This will make it possible to use `beetcamp` without setting
`dontUsePythonCatchConflicts = true` in an override.

See: NixOS#471166 (comment)
Copy link
Contributor

@doronbehar doronbehar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. I think this should be good to go but I'd prefer to only approve it in the meantime so the other PRs could be coordinated.

@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 1 This PR was reviewed and approved by one person. 2.status: merge conflict This PR has merge conflicts with the target branch labels Dec 24, 2025
9999years added a commit to 9999years/nixpkgs that referenced this pull request Dec 24, 2025
This will make it possible to use `beetcamp` without setting
`dontUsePythonCatchConflicts = true` in an override.

See: NixOS#471166 (comment)
@nixpkgs-ci nixpkgs-ci bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Dec 24, 2025
9999years added a commit to 9999years/nixpkgs that referenced this pull request Dec 24, 2025
This will make it possible to use `beetcamp` without setting
`dontUsePythonCatchConflicts = true` in an override.

See: NixOS#471166 (comment)
@9999years 9999years requested a review from doronbehar December 24, 2025 20:14
@9999years
Copy link
Contributor Author

Fixed merge conflicts.

@doronbehar doronbehar changed the title beets: make it possible to override builtin plugins beets: make it easier to override builtin plugins Dec 25, 2025
@doronbehar
Copy link
Contributor

I forced pushed the same changes but with a different commit message, as now it is easier to override built in plugins - it was possible (but clumsy) thanks to my PR #467091 .

Copy link
Contributor

@doronbehar doronbehar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm the beets.passthru.tests.beets-with-new-builtin-plugin fail..

@doronbehar
Copy link
Contributor

@9999years now since #271387 is now merged, I managed to create a working override test in #477084 , so I wish to close this. Is it OK with you?

@doronbehar doronbehar marked this pull request as draft January 7, 2026 15:27
@doronbehar doronbehar marked this pull request as ready for review January 7, 2026 15:27
@9999years
Copy link
Contributor Author

@doronbehar Once you have a PR which removes the pluginOverrides argument, then sure

@doronbehar
Copy link
Contributor

Thanks for finding the time to comment :). We can discuss removing (or not) pluginOverrides in #477084 .

@doronbehar doronbehar closed this Jan 13, 2026
@9999years
Copy link
Contributor Author

This PR is very small (17 lines) and still applicable; I've looked at this derivation a ton lately and I'm still not sure how to override builtin plugins without it.

I'm not sure I understand the hesitancy to merge it / the rush to close it. The design in #477084 is likely better in the longer term (although there's a ton of passthru attributes that are not super obvious to users looking to edit the set of enabled plugins, e.g. base vs overrides vs enabled), but definitely more complex.

Can we get this merged to fix that issue and then move on to #477084? I've been a little frustrated with you asking for changes and then insisting on merging your own PRs first (and having me rebase), even if they're more complex, and then finally closing my PR without merging it. I feel like I've wasted a lot of effort here and my initial issue (pluginOverrides cannot be used to override builtin plugins) is still not solved.

@9999years 9999years reopened this Jan 14, 2026
@doronbehar
Copy link
Contributor

Can we get this merged to fix that issue and then move on to #477084? I've been a little frustrated with you asking for changes and then insisting on merging your own PRs first (and having me rebase), even if they're more complex, and then finally closing my PR without merging it. I feel like I've wasted a lot of effort here and my initial issue (pluginOverrides cannot be used to override builtin plugins) is still not solved.

I wouldn't have minded at all approving and merging this PR before #271387 got merged and I updated my PR. It's just that beets.passthru.tests.beets-with-new-builtin-plugin fails here... I commented about it earlier. Also, I truly don't see how these 2 PRs will go along together, and finalAttrs pattern is so much better.

@9999years
Copy link
Contributor Author

OK. I think this is something of a "perfect is the enemy of the good" situation, and this PR would help fix a use-case today while we make sure #477084 is good to go, but we will have to agree to disagree.

I do think that #477084 (finalAttrs) is a much better long-term solution, but I know that getting finalAttrs rolled out across Nixpkgs has been a tricky and long process, so I'm a bit nervous about getting it in quickly without any weird breakages.

@9999years 9999years closed this Jan 16, 2026
@9999years 9999years deleted the wiggles/vxuy branch January 16, 2026 18:42
Comment on lines +490 to +506
let
beets-with-new-builtin-plugin =
(beets.override {
beets = beets-with-new-builtin-plugin;

pluginOverrides = {
my_special_plugin.builtin = true;
};
}).overridePythonAttrs
(prev: {
postPatch = (prev.postPatch or "") + ''
mkdir -p beetsplug/my_special_plugin
touch beetsplug/my_special_plugin/__init__.py
'';
});
in
beets-with-new-builtin-plugin;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now how you fixed it! Pretty delicate indeed :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants