add kubectl / make 'k' abbr conditional

This commit is contained in:
John Bowdre 2023-08-04 14:20:13 -05:00
parent e67aea353a
commit 67e83165f9
2 changed files with 9 additions and 2 deletions

View file

@ -11,6 +11,7 @@
awscli # AWS CLI awscli # AWS CLI
google-cloud-sdk # GCP CLI google-cloud-sdk # GCP CLI
hugo # Static site generator hugo # Static site generator
kubectl # Container wrangler
nil # Nix LSP nil # Nix LSP
# nix-inspect # See which pkgs are in your Path # nix-inspect # See which pkgs are in your Path
nixfmt # Nix formatter nixfmt # Nix formatter

View file

@ -1,11 +1,17 @@
{ pkgs, lib, config, ... }: { { pkgs, lib, config, ... }:
let
inherit (lib) mkIf;
hasPackage = pname: lib.any (p: p ? pname && p.name == pname) config.home.packages;
hasKubectl = hasPackage "kubectl";
in
{
programs.fish = { programs.fish = {
enable = true; enable = true;
shellAbbrs = rec { shellAbbrs = rec {
ccat = "egrep -v '^\s*(#|$)'"; ccat = "egrep -v '^\s*(#|$)'";
jqless = "jq -C | less -r"; jqless = "jq -C | less -r";
k = "kubectl"; k = mkIf hasKubectl "kubectl";
n = "nix"; n = "nix";
sshpass = "ssh -o PubkeyAuthentication=no"; sshpass = "ssh -o PubkeyAuthentication=no";
tf = "terraform"; tf = "terraform";