1 { config, lib, pkgs, ... }:
4 cfg = config.programs.iay;
5 inherit (lib) mkEnableOption mkIf mkOption mkPackageOption optionalString types;
7 options.programs.iay = {
8 enable = mkEnableOption "iay, a minimalistic shell prompt";
9 package = mkPackageOption pkgs "iay" {};
11 minimalPrompt = mkOption {
14 description = "Use minimal one-liner prompt.";
18 config = mkIf cfg.enable {
19 programs.bash.promptInit = ''
20 if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then
21 PS1='$(iay ${optionalString cfg.minimalPrompt "-m"})'
25 programs.zsh.promptInit = ''
26 if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then
27 autoload -Uz add-zsh-hook
29 PROMPT="$(iay -z ${optionalString cfg.minimalPrompt "-m"})"
31 add-zsh-hook precmd _iay_prompt
36 meta.maintainers = pkgs.iay.meta.maintainers;