1{ config, lib, pkgs, ... }:
2
3let
4 cfg = config.programs.bash.undistractMe;
5in
6{
7 options = {
8 programs.bash.undistractMe = {
9 enable = lib.mkEnableOption "notifications when long-running terminal commands complete";
10
11 playSound = lib.mkEnableOption "notification sounds when long-running terminal commands complete";
12
13 timeout = lib.mkOption {
14 default = 10;
15 description = ''
16 Number of seconds it would take for a command to be considered long-running.
17 '';
18 type = lib.types.int;
19 };
20 };
21 };
22
23 config = lib.mkIf cfg.enable {
24 programs.bash.promptPluginInit = ''
25 export LONG_RUNNING_COMMAND_TIMEOUT=${builtins.toString cfg.timeout}
26 export UDM_PLAY_SOUND=${if cfg.playSound then "1" else "0"}
27 . "${pkgs.undistract-me}/etc/profile.d/undistract-me.sh"
28 '';
29 };
30
31 meta = {
32 maintainers = with lib.maintainers; [ kira-bruneau ];
33 };
34}