nixos-config/modules/programs/espeak.nix
2021-09-25 15:17:07 +02:00

50 lines
1 KiB
Nix

{ config, pkgs, lib, ... }:
with lib;
let
espeak = pkgs.unstable.espeak;
# can't use bash aliases because programms will not pic it up
en_espeak = pkgs.writeShellScriptBin "en-speak" ''
exec ${espeak}/bin/espeak \
-v en\
-s 145 \
-p 23 \
"$@"
'';
# read from copyq
en_read = pkgs.writeShellScriptBin "en-read" ''
exec ${pkgs.copyq}/bin/copyq read 0 | ${en_espeak}/bin/en-speak
'';
# can't use bash aliases because programms will not pic it up
de_espeak = pkgs.writeShellScriptBin "de-speak" ''
exec ${espeak}/bin/espeak \
-v de\
-s 143 \
-p 20 \
"$@"
'';
# read from copyq
de_read = pkgs.writeShellScriptBin "de-read" ''
exec ${pkgs.copyq}/bin/copyq read 0 | ${de_espeak}/bin/de-speak
'';
cfg = config.programs.custom.espeak;
in {
options.programs.custom.espeak.enable =
mkEnableOption "enable espeak scripts";
config = mkIf cfg.enable {
environment.systemPackages = [ espeak en_espeak en_read de_espeak de_read ];
};
}