add plover

This commit is contained in:
Charlotte 🦝 Delenk 2022-09-30 10:41:36 +01:00
parent 5b6b22f461
commit 727a03f3ff
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
8 changed files with 1606 additions and 37 deletions

View file

@ -38,4 +38,7 @@
python-mautrix = pkgs.python3Packages.callPackage ./python/mautrix.nix {};
python-tulir-telethon = pkgs.python3Packages.callPackage ./python/tulir-telethon.nix {};
papermc = pkgs.callPackage ./minecraft/papermc {};
python-plover-stroke = pkgs.python3Packages.callPackage ./plover/plover-stroke.nix {};
python-rtf-tokenize = pkgs.python3Packages.callPackage ./plover/rtf-tokenize.nix {};
plover = pkgs.python3Packages.callPackage ./plover/plover {};
}

27
plover/plover-stroke.nix Normal file
View file

@ -0,0 +1,27 @@
{
lib,
buildPythonPackage,
fetchPypi,
pythonOlder,
}:
buildPythonPackage rec {
pname = "plover_stroke";
version = "1.1.0";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-3gOyP0ruZrZfaffU7MQjNoG0NUFQLYa/FP3inqpy0VM=";
};
# No tests available
doCheck = false;
disabled = pythonOlder "3.6";
meta = with lib; {
homepage = "https://github.com/benoit-pierre/plover_stroke";
description = "Helper class for working with steno strokes";
license = licenses.gpl2Plus;
};
passthru.updateScript = [../scripts/update-python-libraries "plover/plover-stroke.nix"];
}

63
plover/plover/default.nix Normal file
View file

@ -0,0 +1,63 @@
{
lib,
callPackage,
buildPythonPackage,
qt5,
pytest,
mock,
babel,
pyqt5,
xlib,
pyserial,
appdirs,
wcwidth,
setuptools,
pywayland,
xkbcommon,
wayland,
pkg-config,
}: let
source = builtins.fromJSON (builtins.readFile ./source.json);
plover-stroke = callPackage ../plover-stroke.nix {};
rtf-tokenize = callPackage ../../python/rtf-tokenize.nix {};
in
qt5.mkDerivationWith buildPythonPackage rec {
pname = "plover";
version = source.date;
src = callPackage ./source.nix {};
# 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
sed -i 's/pywayland==0.4.11/pywayland>=0.4.11/' reqs/constraints.txt
substituteInPlace plover_build_utils/setup.py \
--replace "/usr/share/wayland/wayland.xml" "${wayland}/share/wayland/wayland.xml"
'';
checkInputs = [pytest mock];
propagatedBuildInputs = [babel pyqt5 xlib pyserial appdirs wcwidth setuptools plover-stroke rtf-tokenize pywayland xkbcommon];
nativeBuildInputs = [
wayland
pkg-config
];
installCheckPhase = "true";
dontWrapQtApps = true;
preFixup = ''
makeWrapperArgs+=("''${qtWrapperArgs[@]}")
'';
meta = {
homepage = "http://www.openstenoproject.org/";
description = "Open Source Stenography Software, patched with wayland support";
license = lib.licenses.gpl2Plus;
};
passthru.updateScript = [
../../scripts/update-git.sh
"https://github.com/openstenoproject/plover"
"plover/plover/source.json"
];
}

11
plover/plover/source.json Normal file
View file

@ -0,0 +1,11 @@
{
"url": "https://github.com/openstenoproject/plover",
"rev": "3066a9a47269861ac1d66f8f05cdb26f7251b98d",
"date": "2022-08-09T00:40:56+02:00",
"path": "/nix/store/3jk73wkfcb2xy267c0vnssabdnw91fxq-plover",
"sha256": "0vk6nh2gpn7f7rv2spi2a7n3m0d9kaan6r22mx3vwxprpbvrkbm8",
"fetchLFS": false,
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
}

14
plover/plover/source.nix Normal file
View file

@ -0,0 +1,14 @@
{
fetchFromGitHub,
applyPatches,
}: let
source = builtins.fromJSON (builtins.readFile ./source.json);
in
applyPatches {
patches = [./wayland.patch];
src = fetchFromGitHub {
owner = "openstenoproject";
repo = "plover";
inherit (source) rev sha256;
};
}

1461
plover/plover/wayland.patch Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,37 +0,0 @@
{
inputs,
pkgs,
}:
with pkgs; let
tarballs = import ../python/tarballs.nix {inherit inputs pkgs;};
in {
mautrix = with pkgs.python3Packages;
buildPythonPackage {
inherit (tarballs.mautrix-src.passthru) pname version;
src = tarballs.mautrix-src;
propagatedBuildInputs = [
aiohttp
sqlalchemy
aiosqlite
ruamel-yaml
CommonMark
lxml
];
doCheck = false;
pythonImportsCheck = ["mautrix"];
};
tulir-telethon = with pkgs.python3Packages;
buildPythonPackage {
inherit (tarballs.tulir-telethon-src.passthru) pname version;
src = tarballs.tulir-telethon-src;
patchPhase = ''
substituteInPlace telethon/crypto/libssl.py --replace \
"ctypes.util.find_library('ssl')" "'${lib.getLib openssl}/lib/libssl.so'"
'';
propagatedBuildInputs = [
rsa
pyaes
];
doCheck = false;
};
}

27
python/rtf-tokenize.nix Normal file
View file

@ -0,0 +1,27 @@
{
lib,
buildPythonPackage,
fetchPypi,
pythonOlder,
}:
buildPythonPackage rec {
pname = "rtf_tokenize";
version = "1.0.0";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-XD3zkNAEeb12N8gjv81v37Id3RuWroFUY95+HtOS1gg=";
};
# No tests available
doCheck = false;
disabled = pythonOlder "3.6";
meta = with lib; {
homepage = "https://github.com/benoit-pierre/rtf_tokenize";
description = "Simple RTF tokenizer";
license = licenses.gpl2Plus;
};
passthru.updateScript = [../scripts/update-python-libraries "python/rtf-tokenize.nix"];
}