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 | |
parent | 70acfaebf2b4c60081b74a68363db42a594d0846 (diff) | |
parent | 93224c214eb3340e2c7c9cb9f063c2220cd9ab74 (diff) | |
download | nixpkgs-6124309e748a26489a99ac3c180eb32baddb6297.tar nixpkgs-6124309e748a26489a99ac3c180eb32baddb6297.tar.gz nixpkgs-6124309e748a26489a99ac3c180eb32baddb6297.tar.bz2 nixpkgs-6124309e748a26489a99ac3c180eb32baddb6297.tar.lz nixpkgs-6124309e748a26489a99ac3c180eb32baddb6297.tar.xz nixpkgs-6124309e748a26489a99ac3c180eb32baddb6297.tar.zst nixpkgs-6124309e748a26489a99ac3c180eb32baddb6297.zip |
Merge pull request #207797 from omasanori/iay-module
nixos/iay: add module; iay: add myself as a maintainer
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/programs/iay.nix | 37 | ||||
-rw-r--r-- | pkgs/tools/misc/iay/default.nix | 5 |
3 files changed, 40 insertions, 3 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 41b953dc347..b2e80b10fc2 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -179,6 +179,7 @@ ./programs/haguichi.nix ./programs/hamster.nix ./programs/htop.nix + ./programs/iay.nix ./programs/iftop.nix ./programs/i3lock.nix ./programs/iotop.nix diff --git a/nixos/modules/programs/iay.nix b/nixos/modules/programs/iay.nix new file mode 100644 index 00000000000..1fa00e43795 --- /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; +} diff --git a/pkgs/tools/misc/iay/default.nix b/pkgs/tools/misc/iay/default.nix index 9c8b0a47ab8..88e14f58239 100644 --- a/pkgs/tools/misc/iay/default.nix +++ b/pkgs/tools/misc/iay/default.nix @@ -38,10 +38,9 @@ rustPlatform.buildRustPackage rec { NIX_LDFLAGS = lib.optionals stdenv.isDarwin [ "-framework" "AppKit" ]; meta = with lib; { - description = - "Minimalistic, blazing-fast, and extendable prompt for bash and zsh"; + description = "Minimalistic, blazing-fast, and extendable prompt for bash and zsh"; homepage = "https://github.com/aaqaishtyaq/iay"; license = licenses.mit; - maintainers = with maintainers; [ aaqaishtyaq ]; + maintainers = with maintainers; [ aaqaishtyaq omasanori ]; }; } |