Skip to content

Commit

Permalink
nerd-dictation: init at unstable-2023-04-19
Browse files Browse the repository at this point in the history
Co-Authored-By: Reuben Steenekamp <[email protected]>
  • Loading branch information
jtojnar and badly-drawn-wizards committed Jun 6, 2023
1 parent 809e888 commit 9367ac0
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
56 changes: 56 additions & 0 deletions pkgs/applications/accessibility/nerd-dictation/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{ fetchFromGitHub
, substituteAll
, lib
, stdenv
, python3
, pulseaudio
, xdotool
, ydotool
, unstableGitUpdater
}:

python3.pkgs.buildPythonApplication rec {
pname = "nerd-dictation";
version = "unstable-2023-04-19";

src = fetchFromGitHub {
owner = "ideasman42";
repo = "nerd-dictation";
rev = "96ef5ce64d37c7ebe9a704315665096ac4a697d4";
hash = "sha256-w8EG6x0ieb9PwetNHkRHDE1FjVEH7QvjxPasaQwOAkg=";
};

patches = [
(substituteAll {
src = ./fix-paths.patch;
parec = "${pulseaudio}/bin/parec";
xdotool = "${xdotool}/bin/xdotool";
ydotool = "${ydotool}/bin/ydotool";
})
];

propagatedBuildInputs = with python3.pkgs; [
vosk-python
];

postPatch = ''
cd package/python
'';

# No tests.
doCheck = false;

# Broken for some reason.
dontUsePythonCatchConflicts = true;

passthru = {
updateScript = unstableGitUpdater { };
};

meta = with lib; {
description = "Simple, hackable offline speech to text";
homepage = "https://github.com/ideasman42/nerd-dictation";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ ];
};
}
31 changes: 31 additions & 0 deletions pkgs/applications/accessibility/nerd-dictation/fix-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/nerd-dictation b/nerd-dictation
index 9f4d1ad..f972c4f 100755
--- a/nerd-dictation
+++ b/nerd-dictation
@@ -138,7 +138,7 @@ def execfile(filepath: str, mod: Optional[ModuleType] = None) -> Optional[Module
# Simulate Input: XDOTOOL
#
def simulate_typing_with_xdotool(delete_prev_chars: int, text: str) -> None:
- cmd = "xdotool"
+ cmd = "@xdotool@"

# No setup/tear-down.
if delete_prev_chars == SIMULATE_INPUT_CODE_COMMAND:
@@ -169,7 +169,7 @@ def simulate_typing_with_xdotool(delete_prev_chars: int, text: str) -> None:
# Simulate Input: YDOTOOL
#
def simulate_typing_with_ydotool(delete_prev_chars: int, text: str) -> None:
- cmd = "ydotool"
+ cmd = "@ydotool@"

# No setup/tear-down.
if delete_prev_chars == SIMULATE_INPUT_CODE_COMMAND:
@@ -873,7 +873,7 @@ def recording_proc_with_non_blocking_stdout(
) -> "Tuple[subprocess.Popen[bytes], IO[bytes]]":
if input_method == "PAREC":
cmd = (
- "parec",
+ "@parec@",
"--record",
"--rate=%d" % sample_rate,
"--channels=1",
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10365,6 +10365,8 @@ with pkgs;

nerdfonts = callPackage ../data/fonts/nerdfonts { };

nerd-dictation = callPackage ../applications/accessibility/nerd-dictation { };

netatalk = callPackage ../tools/filesystems/netatalk { };

netavark = callPackage ../tools/networking/netavark { };
Expand Down

0 comments on commit 9367ac0

Please sign in to comment.