nixpkgs/nixos/modules/programs/iay.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
1.0 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
let
cfg = config.programs.iay;
2023-01-05 19:01:57 +00:00
inherit (lib) mkEnableOption mkIf mkOption mkPackageOptionMD optionalString types;
in {
options.programs.iay = {
enable = mkEnableOption (lib.mdDoc "iay");
2023-01-05 19:01:57 +00:00
package = mkPackageOptionMD pkgs "iay" {};
minimalPrompt = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc "Use minimal one-liner prompt.";
};
};
config = mkIf cfg.enable {
programs.bash.promptInit = ''
if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then
PS1='$(iay ${optionalString cfg.minimalPrompt "-m"})'
fi
'';
programs.zsh.promptInit = ''
if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then
autoload -Uz add-zsh-hook
_iay_prompt() {
PROMPT="$(iay -z ${optionalString cfg.minimalPrompt "-m"})"
}
add-zsh-hook precmd _iay_prompt
fi
'';
};
meta.maintainers = pkgs.iay.meta.maintainers;
}