diff options
author | Anderson Torres <torres.anderson.85@protonmail.com> | 2023-01-05 08:22:16 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-05 08:22:16 -0300 |
commit | 6124309e748a26489a99ac3c180eb32baddb6297 (patch) | |
tree | 5f987ca32a94e9f7e5b5d80be9af95d60388d070 /nixos/modules/programs | |
parent | 70acfaebf2b4c60081b74a68363db42a594d0846 (diff) | |
parent | 93224c214eb3340e2c7c9cb9f063c2220cd9ab74 (diff) |
Merge pull request #207797 from omasanori/iay-module
nixos/iay: add module; iay: add myself as a maintainer
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r-- | nixos/modules/programs/iay.nix | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/nixos/modules/programs/iay.nix b/nixos/modules/programs/iay.nix new file mode 100644 index 0000000000000..1fa00e43795ad --- /dev/null +++ b/nixos/modules/programs/iay.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.programs.iay; + inherit (lib) mkEnableOption mkIf mkOption mkPackageOption optionalString types; +in { + options.programs.iay = { + enable = mkEnableOption (lib.mdDoc "iay"); + package = mkPackageOption 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; +} |