diff --git a/pkgs/applications/misc/plover/default.nix b/pkgs/applications/misc/plover/default.nix deleted file mode 100644 index fc0ff2a6b9f9..000000000000 --- a/pkgs/applications/misc/plover/default.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ - lib, - config, - fetchFromGitHub, - python3Packages, - wmctrl, - qtbase, - mkDerivationWith, -}: - -{ - dev = - with python3Packages; - mkDerivationWith buildPythonPackage rec { - pname = "plover"; - version = "4.0.2"; - format = "setuptools"; - - meta = { - broken = stdenv.hostPlatform.isDarwin; - description = "OpenSteno Plover stenography software"; - maintainers = with lib.maintainers; [ - twey - kovirobi - ]; - license = lib.licenses.gpl2; - }; - - src = fetchFromGitHub { - owner = "openstenoproject"; - repo = "plover"; - tag = "v${version}"; - sha256 = "sha256-VpQT25bl8yPG4J9IwLkhSkBt31Y8BgPJdwa88WlreA8="; - }; - - # I'm not sure why we don't find PyQt5 here but there's a similar - # sed on many of the platforms Plover builds for - postPatch = "sed -i /PyQt5/d setup.cfg"; - - nativeCheckInputs = [ - pytest - mock - ]; - propagatedBuildInputs = [ - babel - pyqt5 - xlib - pyserial - appdirs - wcwidth - setuptools - ]; - - dontWrapQtApps = true; - - preFixup = '' - makeWrapperArgs+=("''${qtWrapperArgs[@]}") - ''; - }; -} -// lib.optionalAttrs config.allowAliases { - stable = throw "plover.stable was removed because it used Python 2. Use plover.dev instead."; # added 2022-06-05 -} diff --git a/pkgs/by-name/pl/plover/package.nix b/pkgs/by-name/pl/plover/package.nix new file mode 100644 index 000000000000..8753ebb0316c --- /dev/null +++ b/pkgs/by-name/pl/plover/package.nix @@ -0,0 +1,17 @@ +{ + lib, + config, + python3Packages, + # For aliases + plover, +}: +python3Packages.toPythonApplication python3Packages.plover +# Aliases to now-dropped plover.stable and plover.dev +# Added 2026-04-22 +# TODO(@ShamrockLee): remove after Nixpkgs 25.11 EOL +// lib.optionalAttrs (config.allowAliases && !(lib.oldestSupportedReleaseIsAtLeast 2605)) { + dev = + lib.throwIf (lib.oldestSupportedReleaseIsAtLeast 2511) "plover.dev was renamed. Use plover instead." + plover; # Added 2026-04-26 + stable = throw "plover.stable was renamed. Use plover instead."; # Added 2022-06-05; updated 2026-04-26 +} diff --git a/pkgs/by-name/pl/plover_4/package.nix b/pkgs/by-name/pl/plover_4/package.nix new file mode 100644 index 000000000000..eed2b2361775 --- /dev/null +++ b/pkgs/by-name/pl/plover_4/package.nix @@ -0,0 +1,3 @@ +{ python3Packages }: + +python3Packages.toPythonApplication python3Packages.plover_4 diff --git a/pkgs/by-name/pl/plover_5/package.nix b/pkgs/by-name/pl/plover_5/package.nix new file mode 100644 index 000000000000..20ecfa171780 --- /dev/null +++ b/pkgs/by-name/pl/plover_5/package.nix @@ -0,0 +1,3 @@ +{ python3Packages }: + +python3Packages.toPythonApplication python3Packages.plover_5 diff --git a/pkgs/development/python-modules/plover-stroke/default.nix b/pkgs/development/python-modules/plover-stroke/default.nix new file mode 100644 index 000000000000..a97dfa33f5bd --- /dev/null +++ b/pkgs/development/python-modules/plover-stroke/default.nix @@ -0,0 +1,57 @@ +{ + lib, + python, + buildPythonPackage, + fetchFromGitHub, + setuptools, + pytestCheckHook, + pytest-qt, + pyside6, + versionCheckHook, + which, +}: + +buildPythonPackage (finalAttrs: { + __structuredAttrs = true; + + pname = "plover-stroke"; + version = "1.1.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "openstenoproject"; + repo = "plover_stroke"; + tag = finalAttrs.version; + hash = "sha256-A75OMzmEn0VmDAvmQCp6/7uptxzwWJTwsih3kWlYioA="; + }; + + build-system = [ setuptools ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-qt + pyside6 + ]; + + doInstallCheck = true; + + nativeInstallCheckInputs = [ + versionCheckHook + which + ]; + + versionCheckProgramArg = "${placeholder "out"}/${python.sitePackages}"; + + preInstallCheck = '' + versionCheckProgram="$(which ls)" + ''; + + pythonImportsCheck = [ "plover_stroke" ]; + + meta = { + description = "Helper class for working with steno strokes"; + homepage = "https://github.com/openstenoproject/plover_stroke"; + license = lib.licenses.gpl2Plus; # https://github.com/openstenoproject/plover_stroke/issues/4 + maintainers = with lib.maintainers; [ pandapip1 ]; + }; +}) diff --git a/pkgs/development/python-modules/plover/4.nix b/pkgs/development/python-modules/plover/4.nix new file mode 100644 index 000000000000..bda985cb0122 --- /dev/null +++ b/pkgs/development/python-modules/plover/4.nix @@ -0,0 +1,95 @@ +{ + lib, + stdenv, + buildPythonPackage, + fetchFromGitHub, + versionCheckHook, + appdirs, + babel, + evdev, + mock, + pyqt5, + pyserial, + pytestCheckHook, + pytest-qt, + plover-stroke, + rtf-tokenize, + setuptools, + wcwidth, + wheel, + xlib, + wrapQtAppsHook, +}: + +buildPythonPackage (finalAttrs: { + __structuredAttrs = true; + + pname = "plover"; + version = "4.0.2"; + pyproject = true; + + src = fetchFromGitHub { + owner = "openstenoproject"; + repo = "plover"; + tag = "v${finalAttrs.version}"; + hash = "sha256-VpQT25bl8yPG4J9IwLkhSkBt31Y8BgPJdwa88WlreA8="; + }; + + postPatch = '' + sed -i 's/,<77//g' pyproject.toml # pythonRelaxDepsHook doesn't work for this for some reason + ''; + + build-system = [ + babel + setuptools + pyqt5 + wheel + ]; + dependencies = [ + appdirs + evdev + pyqt5 + pyserial + plover-stroke + rtf-tokenize + setuptools + wcwidth + xlib + ]; + nativeBuildInputs = [ + wrapQtAppsHook + ]; + + nativeCheckInputs = [ + pytestCheckHook + versionCheckHook + pytest-qt + mock + ]; + + # Segfaults?! + disabledTestPaths = [ "test/gui_qt/test_dictionaries_widget.py" ]; + + preFixup = '' + makeWrapperArgs+=("''${qtWrapperArgs[@]}") + ''; + + dontWrapQtApps = true; + + pythonImportsCheck = [ "plover" ]; + + meta = { + description = "OpenSteno Plover stenography software"; + homepage = "https://www.openstenoproject.org/plover/"; + mainProgram = "plover"; + maintainers = with lib.maintainers; [ + twey + kovirobi + pandapip1 + ShamrockLee + ]; + license = lib.licenses.gpl2Plus; + platforms = lib.platforms.unix; + broken = stdenv.hostPlatform.isDarwin; + }; +}) diff --git a/pkgs/development/python-modules/plover/5.nix b/pkgs/development/python-modules/plover/5.nix new file mode 100644 index 000000000000..45899b201b7a --- /dev/null +++ b/pkgs/development/python-modules/plover/5.nix @@ -0,0 +1,128 @@ +{ + lib, + stdenv, + buildPackages, + buildPythonPackage, + fetchFromGitHub, + versionCheckHook, + appdirs, + babel, + evdev, + mock, + packaging, + pkginfo, + psutil, + pygments, + pyserial, + pyside6, + pytestCheckHook, + pytest-qt, + plover-stroke, + readme-renderer, + requests-cache, + requests-futures, + rtf-tokenize, + setuptools, + wcwidth, + wheel, + xlib, + qtbase, + wrapQtAppsHook, +}: + +buildPythonPackage (finalAttrs: { + __structuredAttrs = true; + + pname = "plover"; + version = "5.0.0.dev2"; + pyproject = true; + + src = fetchFromGitHub { + owner = "openstenoproject"; + repo = "plover"; + tag = "v${finalAttrs.version}"; + hash = "sha256-PZwxVrdQPhgbj+YmWZIUETngeJGs6IQty0hY43tLQO0="; + }; + + # pythonRelaxDeps seemingly doesn't work here + postPatch = '' + sed -i 's/,<77//g' pyproject.toml + sed -i /PySide6-Essentials/d pyproject.toml + ''; + + build-system = [ + babel + setuptools + pyside6 + wheel + + # Replacement for missing pyside6-essentials tools, + # workaround for https://github.com/NixOS/nixpkgs/issues/277849. + # Ideally this would be solved in pyside6 itself but I spent four + # hours trying to untangle its build system before giving up. If + # anyone wants to spend the time fixing it feel free to request + # me (@Pandapip1) as a reviewer. + (buildPackages.writeShellScriptBin "pyside6-uic" '' + exec ${qtbase}/libexec/uic -g python "$@" + '') + (buildPackages.writeShellScriptBin "pyside6-rcc" '' + exec ${qtbase}/libexec/rcc -g python "$@" + '') + ]; + dependencies = [ + appdirs + evdev + packaging + pkginfo + psutil + pygments + pyserial + pyside6 + plover-stroke + qtbase + readme-renderer + requests-cache + requests-futures + rtf-tokenize + setuptools + wcwidth + xlib + ] + ++ readme-renderer.optional-dependencies.md; + nativeBuildInputs = [ + wrapQtAppsHook + ]; + + nativeCheckInputs = [ + pytestCheckHook + versionCheckHook + pytest-qt + mock + ]; + + # Segfaults?! + disabledTestPaths = [ "test/gui_qt/test_dictionaries_widget.py" ]; + + preFixup = '' + makeWrapperArgs+=("''${qtWrapperArgs[@]}") + ''; + + dontWrapQtApps = true; + + pythonImportsCheck = [ "plover" ]; + + meta = { + description = "OpenSteno Plover stenography software"; + homepage = "https://www.openstenoproject.org/plover/"; + mainProgram = "plover"; + maintainers = with lib.maintainers; [ + twey + kovirobi + pandapip1 + ShamrockLee + ]; + license = lib.licenses.gpl2Plus; + platforms = lib.platforms.unix; + broken = stdenv.hostPlatform.isDarwin; + }; +}) diff --git a/pkgs/development/python-modules/rtf-tokenize/default.nix b/pkgs/development/python-modules/rtf-tokenize/default.nix new file mode 100644 index 000000000000..f6701180dabc --- /dev/null +++ b/pkgs/development/python-modules/rtf-tokenize/default.nix @@ -0,0 +1,51 @@ +{ + lib, + python, + buildPythonPackage, + fetchFromGitHub, + setuptools, + pytestCheckHook, + versionCheckHook, + which, +}: + +buildPythonPackage (finalAttrs: { + __structuredAttrs = true; + + pname = "rtf-tokenize"; + version = "1.0.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "openstenoproject"; + repo = "rtf_tokenize"; + tag = finalAttrs.version; + hash = "sha256-zwD2sRYTY1Kmm/Ag2hps9VRdUyQoi4zKtDPR+F52t9A="; + }; + + build-system = [ setuptools ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + doInstallCheck = true; + + nativeInstallCheckInputs = [ + versionCheckHook + which + ]; + + versionCheckProgramArg = "${placeholder "out"}/${python.sitePackages}"; + + preInstallCheck = '' + versionCheckProgram="$(which ls)" + ''; + + pythonImportsCheck = [ "rtf_tokenize" ]; + + meta = { + description = "Simple RTF tokenizer package for Python"; + homepage = "https://github.com/openstenoproject/rtf_tokenize"; + license = lib.licenses.gpl2Plus; # https://github.com/openstenoproject/rtf_tokenize/issues/1 + maintainers = with lib.maintainers; [ pandapip1 ]; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1a32a61868b8..ef8e6ac79012 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10123,8 +10123,6 @@ with pkgs; plex-mpv-shim = python3Packages.callPackage ../applications/video/plex-mpv-shim { }; - plover = recurseIntoAttrs (libsForQt5.callPackage ../applications/misc/plover { }); - # perhaps there are better apps for this task? It's how I had configured my previous system. # And I don't want to rewrite all rules profanity = callPackage ../applications/networking/instant-messengers/profanity ( diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d66783552dc8..debe4b242966 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -12664,6 +12664,24 @@ self: super: with self; { plotpy = callPackage ../development/python-modules/plotpy { }; + # Plover 5 moves from PyQt5 to PySide6, + # which is a backward-incompatible change to praphical plugins. + # Use Plover 4 for now (2026-04-26), + # as the upstream still warns about this in every Plover 5 release, + # List of unsupported plugins: + # https://github.com/opensteno/plover_plugins_registry/blob/master/unsupported.json + plover = plover_4; + + plover-stroke = callPackage ../development/python-modules/plover-stroke { }; + + plover_4 = callPackage ../development/python-modules/plover/4.nix { + inherit (pkgs.libsForQt5) wrapQtAppsHook; + }; + + plover_5 = callPackage ../development/python-modules/plover/5.nix { + inherit (pkgs.qt6) qtbase wrapQtAppsHook; + }; + pluggy = callPackage ../development/python-modules/pluggy { }; pluginbase = callPackage ../development/python-modules/pluginbase { }; @@ -17157,6 +17175,8 @@ self: super: with self; { rtb-data = callPackage ../development/python-modules/rtb-data { }; + rtf-tokenize = callPackage ../development/python-modules/rtf-tokenize { }; + rtfde = callPackage ../development/python-modules/rtfde { }; rtfunicode = callPackage ../development/python-modules/rtfunicode { };