nixos-config/nixos/modules/programs/espeak.nix

51 lines
1 KiB
Nix
Raw Normal View History

2019-10-24 02:20:38 +02:00
{ config, pkgs, lib, ... }:
with lib;
let
espeak = pkgs.unstable.espeak;
2020-03-15 14:49:39 +01:00
2019-10-24 02:20:38 +02:00
# can't use bash aliases because programms will not pic it up
en_espeak = pkgs.writeShellScriptBin "en-speak" ''
2020-03-15 14:49:39 +01:00
exec ${espeak}/bin/espeak \
2019-10-24 02:20:38 +02:00
-v en\
-s 145 \
-p 23 \
2020-03-15 14:49:39 +01:00
"$@"
2019-10-24 02:20:38 +02:00
'';
# 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" ''
2020-03-15 14:49:39 +01:00
exec ${espeak}/bin/espeak \
2019-10-24 02:20:38 +02:00
-v de\
-s 143 \
-p 20 \
2020-03-15 14:49:39 +01:00
"$@"
2019-10-24 02:20:38 +02:00
'';
# 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 {
2019-12-20 05:54:26 +01:00
options.programs.custom.espeak.enable =
mkEnableOption "enable espeak scripts";
2019-10-24 02:20:38 +02:00
config = mkIf cfg.enable {
2020-03-15 15:52:19 +01:00
environment.systemPackages = [ espeak en_espeak en_read de_espeak de_read ];
2019-10-24 02:20:38 +02:00
};
}