Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion pkgs/by-name/pl/plover/package.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,40 @@
{
lib,
config,
# For wrapper
callPackage,
python3Packages,
# For aliases
plover_4,
}:
python3Packages.toPythonApplication python3Packages.plover

(python3Packages.toPythonApplication python3Packages.plover).overrideAttrs (
finalAttrs: previousAttrs: {
passthru = previousAttrs.passthru or { } // {
/**
Shorthand of
```nix
python3.plover.wrapPloverExes python3.withPlugins (ps: [ ps.plover ] ++ selectPackages ps)
```
::: {.note}
The result package is unrelated to the main package,
and is not affected by overriding applying to the main package.
Its `<pkg>.override` interface consists of only the `python3` argument,
whose `packageOverrides` can be overridden.
:::
*/
withPlugins = callPackage ./with-plugins.nix { };
tests = {
plover-with-lapwing = finalAttrs.passthru.withPlugins (
ps: with ps; [
plover-lapwing-aio
]
);
}
// previousAttrs.passthru.tests or { };
};
}
)
# Aliases to now-dropped plover.stable and plover.dev
# Added 2026-04-22
# TODO(@ShamrockLee): remove after Nixpkgs 25.11 EOL
Expand Down
4 changes: 4 additions & 0 deletions pkgs/by-name/pl/plover/with-plugins.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ python3 }:

selectPackages:
python3.pkgs.plover.wrapPloverExes (python3.withPackages (ps: [ ps.plover ] ++ selectPackages ps))
Comment on lines +1 to +4

This comment was marked as outdated.

7 changes: 7 additions & 0 deletions pkgs/development/python-modules/plover/4.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
lib,
stdenv,
buildPythonPackage,
callPackage,
fetchFromGitHub,
versionCheckHook,
appdirs,
Expand Down Expand Up @@ -87,6 +88,12 @@ buildPythonPackage (finalAttrs: {

pythonImportsCheck = [ "plover" ];

passthru = {
wrapPloverExes = callPackage ./wrap-plover-exes.nix {
plover = finalAttrs.finalPackage;
};
};

meta = {
description = "OpenSteno Plover stenography software";
homepage = "https://www.openstenoproject.org/plover/";
Expand Down
33 changes: 33 additions & 0 deletions pkgs/development/python-modules/plover/5.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
stdenv,
buildPackages,
buildPythonPackage,
callPackage,
fetchFromGitHub,
versionCheckHook,
appdirs,
Expand Down Expand Up @@ -153,6 +154,38 @@ buildPythonPackage (finalAttrs: {

pythonImportsCheck = [ "plover" ];

passthru = {
/**
Take a `python3.withPackage`-constructed derivation containing Plover
and return a new derivation containing only the plover executables,
avoiding collisions while installing Plover with plugins.

Use as
```nix
{ python3 }:
let
python3Overridden = python3.override {
packageOverrides =
final: previous:
{
plover = final.plover_5;
plover-lapwing-aio = previous.plover-lapwing-aio.overrideAttrs { };
};
};
in
python3Overridden.pkgs.plover.wrapPloverExes (
python3Overridden.withPackages (ps: with ps; [
plover
plover-lapwing-aio
])
)
```
*/
wrapPloverExes = callPackage ./wrap-plover-exes.nix {
plover = finalAttrs.finalPackage;
};
};

meta = {
description = "OpenSteno Plover stenography software";
homepage = "https://www.openstenoproject.org/plover/";
Expand Down
38 changes: 38 additions & 0 deletions pkgs/development/python-modules/plover/wrap-plover-exes.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
lib,
stdenvNoCC,
makeWrapper,
versionCheckHook,
plover,
}:
pythonEnv:
stdenvNoCC.mkDerivation (finalAttrs: {
inherit pythonEnv;
pname = "plover-wrapper-with-plugins";
inherit (plover) version;
nativeBuildInputs = [
makeWrapper
];
dontUnpack = true;
Comment thread
ShamrockLee marked this conversation as resolved.
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p "''${!outputBin}/bin"
for _pathFromPlover in ${lib.getBin plover}/bin/*; do
_nameFromPlover=$(basename "$_pathFromPlover")
makeWrapper "$pythonEnv/bin/$_nameFromPlover" "''${!outputBin}/bin/$_nameFromPlover"
done
runHook postInstall
'';
doInstallCheck = true;
nativeInstallCheckInputs = [
versionCheckHook
];
meta = removeAttrs plover.meta [
"attrs"
"position"
"references"
"validity"
];
})
Comment on lines +1 to +38

This comment was marked as outdated.

Loading