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