From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id eEp4GtxqKGSYFAAASxT56A (envelope-from ) for ; Sat, 01 Apr 2023 19:33:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id kJl/GtxqKGSeWAEAauVa8A (envelope-from ) for ; Sat, 01 Apr 2023 19:33:16 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BA655122AA for ; Sat, 1 Apr 2023 19:33:15 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pif68-0001lN-19; Sat, 01 Apr 2023 13:33:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pif66-0001lA-NC for bug-guix@gnu.org; Sat, 01 Apr 2023 13:33:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pif66-000627-7W for bug-guix@gnu.org; Sat, 01 Apr 2023 13:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pif66-0000uM-0Y for bug-guix@gnu.org; Sat, 01 Apr 2023 13:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#62589: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants. References: <87ilefgbza.fsf@ngraves.fr> In-Reply-To: <87ilefgbza.fsf@ngraves.fr> Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 01 Apr 2023 17:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62589 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 62589@debbugs.gnu.org Cc: ngraves@ngraves.fr Received: via spool by 62589-submit@debbugs.gnu.org id=B62589.16803703673469 (code B ref 62589); Sat, 01 Apr 2023 17:33:01 +0000 Received: (at 62589) by debbugs.gnu.org; 1 Apr 2023 17:32:47 +0000 Received: from localhost ([127.0.0.1]:38532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pif5r-0000ts-Aa for submit@debbugs.gnu.org; Sat, 01 Apr 2023 13:32:47 -0400 Received: from 18.mo561.mail-out.ovh.net ([87.98.172.162]:36447) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pif5o-0000th-8C for 62589@debbugs.gnu.org; Sat, 01 Apr 2023 13:32:46 -0400 Received: from director7.ghost.mail-out.ovh.net (unknown [10.109.143.79]) by mo561.mail-out.ovh.net (Postfix) with ESMTP id 27BFE23F3D for <62589@debbugs.gnu.org>; Sat, 1 Apr 2023 17:32:42 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-xbfnr (unknown [10.110.103.92]) by director7.ghost.mail-out.ovh.net (Postfix) with ESMTPS id E19981FDBC; Sat, 1 Apr 2023 17:32:41 +0000 (UTC) Received: from ngraves.fr ([37.59.142.99]) by ghost-submission-6684bf9d7b-xbfnr with ESMTPSA id IpU0NLlqKGTzcAIAd9A77g (envelope-from ); Sat, 01 Apr 2023 17:32:41 +0000 X-OVh-ClientIp: 81.67.140.142 Date: Sat, 1 Apr 2023 19:32:39 +0200 Message-Id: <20230401173239.26588-1-ngraves@ngraves.fr> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 7690459315481731810 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeifedguddugecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvvefufffkofggtgfgsehtkeertdertdejnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepleeuhefgveefvefhffdtteegudegveevheetieelueeujefhgeffteetfffhhfdvnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepuddvjedrtddrtddruddpkedurdeijedrudegtddrudegvddpfeejrdehledrudegvddrleelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqedpnhgspghrtghpthhtohepuddprhgtphhtthhopeeivdehkeelseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehiedupdhmohguvgepshhmthhpohhuth X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Nicolas Graves From: Nicolas Graves via Bug reports for GNU Guix Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1680370396; a=rsa-sha256; cv=none; b=OvlLdq3TB+aWDvcodWaz9JdOksTgyhkpxuDmVI1aAW9/fFoXVVT1nZtB3Cf/Vsoh9ma/wE 1htJmswkwywgvzD5kCFMNNrOo4SIpQISWcFjLv+eHJJ6NhaIiiISvashv8ae/BwAet5xoQ V82lSUmnOaIBJO9H/2AUoVJPCC9RkItyNIHrii8l8C/rgZXOmWRI+NM9/Tys0KQzDM+WzX l56x+MIIYV+iOLaoZ0ECmG5RFrbVTi6lBxgfHlDcmot2IXehyw6dDBRLP1sQ/4K9QHdfgj vsO374MlaGeoZt5k8q02aZFTF5fEf+5uRJXLtWbaHJL3XcNHmc01v8oyzaX5/A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1680370396; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=4//Z3xkrmIXIeRnPVwBJM0mUGdqUHVUvYO5f8OycEqQ=; b=Eb+jwiFKjbKSDYBXKyonvKHX99Cewx1AIp5mCY8srARZJfZVqUNiGM9rDwIRUi7XYU/sIX CHhPCvXBW/xFr4HZxckOWSci2up5LkI1UZMfEFYfmZgAS+NxCgW69qob6/4DTx2GBsPfij Mvvj5OizOUgbNE9sD0kprizSIOzJsEPAMCkBpCoFocdt1ELeuelBY9YPmau9YSOQ+1a+SC +OD4uoaVXYrrssYFayOdLYx8j+Si8pqBQ4s9hfkac+AmRKVuQPNrkXVPm5aI/QWvzICr2y OzllIVZgbsg3t1T/Kj7AaUTe5YEqsnetsz8AdEFS1HmMDdafIyjQn6TzmJCg0w== Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -5.03 X-Spam-Score: -5.03 X-Migadu-Queue-Id: BA655122AA X-TUID: 65DJarAElR5F * gnu/packages/machine-learning.scm (nerd-dictation): Avoid inputs pulseaudio and ydotool when not necessary. Factor out wrapper make-nerd-dictation-package. Add package variants : - nerd-dictation/xdotool - nerd-dictation/sox-xdotool - nerd-dictation/sox-ydotool - nerd-dictation/sox-wtype --- gnu/packages/machine-learning.scm | 97 ++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 28 deletions(-) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 6c78b14fc6..4383f3fef3 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -17,6 +17,7 @@ ;;; Copyright © 2020 Edouard Klein ;;; Copyright © 2020, 2021, 2022, 2023 Vinicius Monego ;;; Copyright © 2020, 2021, 2022, 2023 Maxim Cournoyer +;;; Copyright © 2022, 2023 Nicolas Graves ;;; ;;; This file is part of GNU Guix. ;;; @@ -63,6 +64,7 @@ (define-module (gnu packages machine-learning) #:use-module (gnu packages cran) #:use-module (gnu packages databases) #:use-module (gnu packages dejagnu) + #:use-module (gnu packages freedesktop) #:use-module (gnu packages gcc) #:use-module (gnu packages gettext) #:use-module (gnu packages gl) @@ -3864,7 +3866,6 @@ (define-public nerd-dictation (add-after 'unpack 'chdir (lambda _ (chdir "package/python")))))) (propagated-inputs (list python-vosk)) - (inputs (list pulseaudio xdotool)) (home-page "https://github.com/ideasman42/nerd-dictation") (synopsis "Offline speech-to-text for desktop Linux") (description "\ @@ -3876,38 +3877,78 @@ (define-public nerd-dictation @code{nerd-dictation begin} and @code{nerd-dictation end} commands.") (license license:gpl3+)))) -(define-public nerd-dictation/wayland - (package - (inherit nerd-dictation) - (name "nerd-dictation-wayland") - (inputs (list bash-minimal nerd-dictation)) - (propagated-inputs (list ydotool sox)) - (build-system trivial-build-system) - (arguments - (list - #:modules '((guix build utils)) - #:builder - #~(begin - (use-modules (guix build utils)) - (let* ((exe (string-append #$output "/bin/nerd-dictation")) - (original-exe #$(file-append nerd-dictation - "/bin/nerd-dictation")) - (bash #$(this-package-input "bash-minimal")) - (bash-exe (string-append bash "/bin/bash"))) - (mkdir-p (dirname exe)) - (call-with-output-file exe - (lambda (port) - (format port "#!~a +(define (nerd-dictation-gexp input-name output-name bash nerd-dictation) + #~(begin + (use-modules (guix build utils)) + (let* ((exe (string-append %output "/bin/nerd-dictation")) + (nerd-dictation-exe + #$(file-append nerd-dictation "/bin/nerd-dictation"))) + (mkdir-p (dirname exe)) + (call-with-output-file exe + (lambda (port) + (format port "#!~a if [ \"$1\" = begin ] then - exec ~a $@ --input=SOX --simulate-input-tool=YDOTOOL + exec ~a $@ --input=~a --simulate-input-tool=~a else exec ~a $@ fi" - bash-exe - original-exe - original-exe))) - (chmod exe #o555))))))) + #$(file-append bash "/bin/bash") + nerd-dictation-exe + #$input-name + #$output-name + nerd-dictation-exe))) + (chmod exe #o555)))) + +(define-public nerd-dictation/xdotool + (package + (inherit nerd-dictation) + (name "nerd-dictation-xdotool") + (build-system trivial-build-system) + (arguments (list + #:modules '((guix build utils)) + #:builder + (nerd-dictation-gexp "PAREC" "XDOTOOL" + (this-package-input "bash-minimal") + (this-package-input "nerd-dictation")))) + (inputs (list bash-minimal nerd-dictation)) + (propagated-inputs (list pulseaudio xdotool)))) + +(define-public nerd-dictation/sox-xdotool + (package + (inherit nerd-dictation/xdotool) + (name "nerd-dictation-sox-xdotool") + (arguments (list + #:modules '((guix build utils)) + #:builder + (nerd-dictation-gexp "SOX" "XDOTOOL" + (this-package-input "bash-minimal") + (this-package-input "nerd-dictation")))) + (propagated-inputs (list sox xdotool)))) + +(define-public nerd-dictation/sox-ydotool + (package + (inherit nerd-dictation/xdotool) + (name "nerd-dictation-sox-ydotool") + (arguments (list + #:modules '((guix build utils)) + #:builder + (nerd-dictation-gexp "SOX" "YDOTOOL" + (this-package-input "bash-minimal") + (this-package-input "nerd-dictation")))) + (propagated-inputs (list sox ydotool)))) + +(define-public nerd-dictation/sox-wtype + (package + (inherit nerd-dictation/xdotool) + (name "nerd-dictation-sox-wtype") + (arguments (list + #:modules '((guix build utils)) + #:builder + (nerd-dictation-gexp "SOX" "WTYPE" + (this-package-input "bash-minimal") + (this-package-input "nerd-dictation")))) + (propagated-inputs (list sox wtype)))) (define-public python-brian2 (package -- 2.39.2