plover: provide wrapPloverExes and withPlugins - #518828
Conversation
Follow the approach of NixOS/nixpkgs#518828: - Define plover and ploverPlugins in a pythonPackagesExtensions overlay, so they are built against the same fixed point as the rest of the Python package set (including the Darwin qt6/pyside6 lld fixes). - Implement withPlugins as a wrapper around python3.withPackages that exposes only Plover's executables (plus the desktop entry, icons and the macOS app bundle), so adding or removing plugins composes an environment instead of rebuilding Plover with extra dependencies. Issue: opensteno#298 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Follow the approach of NixOS/nixpkgs#518828: - Define plover and ploverPlugins in a pythonPackagesExtensions overlay, so they are built against the same fixed point as the rest of the Python package set (including the Darwin qt6/pyside6 lld fixes). - Implement withPlugins as a wrapper around python3.withPackages that exposes only Plover's executables (plus the desktop entry, icons and the macOS app bundle), so adding or removing plugins composes an environment instead of rebuilding Plover with extra dependencies. Issue: opensteno#298 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2967076 to
ef9ddb9
Compare
ef9ddb9 to
afd0a48
Compare
wrapPloverExes and withPlugins
afd0a48 to
66d63f1
Compare
This comment was marked as outdated.
This comment was marked as outdated.
66d63f1 to
9446572
Compare
✅
|
|
Cc: @Twey @lambdadog |
| { | ||
| lib, | ||
| stdenvNoCC, | ||
| makeWrapper, | ||
| versionCheckHook, | ||
| plover, | ||
| }: | ||
| python-env: | ||
| stdenvNoCC.mkDerivation (finalAttrs: { | ||
| pname = "plover-wrapper-with-plugins"; | ||
| inherit (plover) version; | ||
| nativeBuildInputs = [ | ||
| makeWrapper | ||
| ]; | ||
| dontUnpack = true; | ||
| installPhase = '' | ||
| runHook preInstall | ||
| mkdir -p "''${!outputBin}/bin" | ||
| for _pathFromPlover in ${lib.getBin plover}/bin/*; do | ||
| _nameFromPlover=$(basename "$_pathFromPlover") | ||
| makeWrapper "${lib.getBin finalAttrs.passthru.python-env}/bin/$_nameFromPlover" "''${!outputBin}/bin/$_nameFromPlover" | ||
| done | ||
| runHook postInstall | ||
| ''; | ||
| doInstallCheck = true; | ||
| nativeInstallCheckInputs = [ | ||
| versionCheckHook | ||
| ]; | ||
| passthru = { | ||
| inherit python-env; | ||
| }; | ||
| meta = | ||
| removeAttrs plover.meta [ | ||
| "attrs" | ||
| "position" | ||
| "references" | ||
| "validity" | ||
| ] | ||
| // { | ||
| mainProgram = "plover"; | ||
| }; | ||
| }) |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| { python3 }: | ||
|
|
||
| selectPackages: | ||
| python3.pkgs.plover.wrapPloverExes (python3.withPackages (ps: [ ps.plover ] ++ selectPackages ps)) |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
|
Never mind just checked and those do NOT work |
|
Aha, I did figure out that we can avoid wrapping by doing which gives a |
33fb3aa to
4092ce9
Compare
Allow wrapping around the Python environment to avoid installation collisions. Co-authored-by: Gavin John <gavinnjohn@gmail.com>
4092ce9 to
2534dc8
Compare
|
@Pandapip1 That's interesting! Still, does it make sense to avoid wrapping by rebuilding? |
It doesn't seem to take significant time to build on my machine. If it was even 20-30 seconds it might give me some pause, but it seems that the build is pretty darn fast. I think it makes sense to avoid the wrapper because it means we don't have to maintain a custom one-off wrapper which takes significantly more code than the alternative. |
toyboot4e
left a comment
There was a problem hiding this comment.
Awesome improvements! Looks like the right direction.
Let me note some early review.
This is an existing issue, but qtsvg would be necessary, because it's lacking icons on macOS:
Here's some quick review by Claude Code (I'm sorry, but expect hallucinations):
Claude Code review
pkgs/development/python-modules/plover/wrap-plover-exes.nix
1. The desktop entry is lost. 5.nix installs share/applications/plover.desktop, and switching from plover to plover.withPlugins (…) silently drops the app launcher entry.
2. removeAttrs plover.meta [...] doesn't do what it looks like. plover.meta isn't just the block written in 5.nix — stdenv adds computed fields to it, so the wrapper inherits two it shouldn't:
name— the wrapper reportspython3.14-plover-5.4.0tonix search/nix-env -q/nix profile, instead of its own name.isBuildPythonPackage— read bypkgs/top-level/release-python.nixto pick Hydra's Python jobset, and this isn't a Python package.
Listing what you want is both shorter and immune to meta gaining new computed fields later:
meta = {
inherit (plover.meta)
broken # plover_4 marks this on darwin
description
homepage
license
maintainers
platforms
;
mainProgram = "plover";
};3. Nits. pname = "plover-with-plugins" reads better and matches withPlugins.
makeWrapper with zero arguments generates a script that only execs the target:
exec "/nix/store/…-python3-env/bin/plover" "$@"Symlinking does the same thing — drop makeWrapper.
c.f. certbot/default.nix:
nixpkgs/pkgs/development/python-modules/certbot/default.nix
Lines 82 to 98 in dd022b6
pkgs/by-name/pl/plover/package.nix
4. withPlugins ignores python3Packages. callPackage ./with-plugins.nix { } fills python3 from the top level, not from the package set plover was built against. So:
(plover.override { python3Packages = python312Packages; }).withPlugins (ps: [ ps.plover-lapwing-aio ])gives a 3.12 plover but a 3.14 withPlugins — two Plovers in the closure, with the plugins on the one you didn't ask for. Fix:
withPlugins = callPackage ./with-plugins.nix { python3 = python3Packages.python; };5. The doc comment isn't valid Nix. python3.plover → python3.pkgs.plover, withPlugins → withPackages, and the missing parens make it a two-argument application:
python3.pkgs.plover.wrapPloverExes (python3.withPackages (ps: [ ps.plover ] ++ selectPackages ps))5.nix also says python3.withPackage (singular).
6. tests merge order is inverted. { plover-with-lapwing = …; } // previousAttrs.passthru.tests or { } lets pre-existing tests shadow the new one — the usual order is previousAttrs.passthru.tests or { } // { … }.
|
It's also lacking icons on Linux FWIW, but that's not caused by this PR and is a pre-existing issue. |

This PR provides a build helper
python3Packages.plover.wrapPloverExeswhich exposes only Plover executables from a Python environment package containing Plover and plugins.This allows clean installation of Plover with plugins while preserving the flexibility of
python3'spackageOverridespackage set extensibility.This PR also provides
plover.withPluginsfor users who don't need custom overriding:Note
The
plover.withPluginsis independent to the mainploverpackage and depends only onpython3injected via a separatecallPackagecall.Overriding applied to the main package won't get propagated to the
withPlugins-constructed package.In case downstream users need custom overriding, override the
python3argument of<plover-with-plugins>.override.Closes #89341
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.