mirror of
https://github.com/nickolaj-jepsen/nixos.git
synced 2026-01-22 16:16:50 +01:00
update
This commit is contained in:
parent
2b7b63a18c
commit
638ef7093e
140 changed files with 307 additions and 121 deletions
43
modules/shell/fish/default.nix
Normal file
43
modules/shell/fish/default.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
username,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
config = {
|
||||
programs.fish.enable = true;
|
||||
users.users.${username}.shell = pkgs.fish;
|
||||
|
||||
# Fish enables generateCaches by default, which causes slow builds
|
||||
documentation.man.generateCaches = false;
|
||||
|
||||
fireproof.home-manager.programs.fish = {
|
||||
enable = true;
|
||||
shellInit = ''
|
||||
|
||||
${builtins.readFile ./theme.fish}
|
||||
${builtins.readFile ./k8s.fish}
|
||||
|
||||
'';
|
||||
plugins = [
|
||||
{
|
||||
name = "to-fish";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "joehillen";
|
||||
repo = "to-fish";
|
||||
rev = "52b151cfe67c00cb64d80ccc6dae398f20364938";
|
||||
sha256 = "sha256-DfDsU/qY2XdYlkLISIOv02ggHfKEpb+YompNWWjs5/A=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "theme-bobthefish";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "oh-my-fish";
|
||||
repo = "theme-bobthefish";
|
||||
rev = "e3b4d4eafc23516e35f162686f08a42edf844e40";
|
||||
hash = "sha256-cXOYvdn74H4rkMWSC7G6bT4wa9d3/3vRnKed2ixRnuA=";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
63
modules/shell/fish/k8s.fish
Normal file
63
modules/shell/fish/k8s.fish
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
set __kube_verbs get describe delete edit
|
||||
set __kube_verbs_short g d rm e
|
||||
set __kube_resource pods deployments services ingresses configmaps daemonsets statefulsets namespace namespace
|
||||
set __kube_resource_short p d s i c ds ss n ns
|
||||
|
||||
function __echo_kubeexec;
|
||||
set _flag_namespace (kubectl config view --minify --output 'jsonpath={..namespace}')
|
||||
if test -z "$_flag_namespace"
|
||||
set _flag_namespace default
|
||||
end
|
||||
|
||||
set _flag_pod shop
|
||||
set POD (kubectl get pods --namespace $_flag_namespace 2>/dev/null | grep "^$_flag_pod" | grep Running | head -n1 | awk '{ print $1 }')
|
||||
if test -z "$POD"
|
||||
echo "kubectl exec --namespace $_flag_namespace -it"
|
||||
return
|
||||
end
|
||||
echo "kubectl exec --namespace $_flag_namespace -it $POD --"
|
||||
end
|
||||
|
||||
function __echo_kubemanage;
|
||||
set _flag_namespace (kubectl config view --minify --output 'jsonpath={..namespace}')
|
||||
if test -z "$_flag_namespace"
|
||||
set _flag_namespace default
|
||||
end
|
||||
|
||||
set _flag_pod shop
|
||||
set POD (kubectl get pods --namespace $_flag_namespace 2>/dev/null | grep "^$_flag_pod" | grep Running | head -n1 | awk '{ print $1 }')
|
||||
if test -z "$POD"
|
||||
echo "kubectl exec --namespace $_flag_namespace -it"
|
||||
return
|
||||
end
|
||||
echo "kubectl exec --namespace $_flag_namespace -it $POD -- python3 /src/lib/manage.py"
|
||||
end
|
||||
|
||||
if type -q kubectl
|
||||
for verb_index in (seq (count $__kube_verbs))
|
||||
abbr "k$__kube_verbs_short[$verb_index]" "kubectl $__kube_verbs[$verb_index]"
|
||||
for res_index in (seq (count $__kube_resource))
|
||||
abbr "k$__kube_verbs_short[$verb_index]$__kube_resource_short[$res_index]" "kubectl $__kube_verbs[$verb_index] $__kube_resource[$res_index]"
|
||||
end
|
||||
end
|
||||
|
||||
abbr k kubectl
|
||||
abbr kl kubectl logs -f
|
||||
abbr kgl kubectl logs -f
|
||||
abbr kaf kubectl apply -f
|
||||
abbr kr kubectl rollout
|
||||
abbr krs kubectl rollout status
|
||||
abbr krr kubectl rollout restart
|
||||
abbr kt kubectl top
|
||||
abbr ktp kubectl top pods
|
||||
abbr ktn kubectl top nodes
|
||||
abbr kpf kubectl port-forward
|
||||
abbr kfp kubectl port-forward
|
||||
|
||||
alias kns "kubectl config view --minify --output 'jsonpath={..namespace}'"
|
||||
abbr ksns "kubectl config set-context --current --namespace"
|
||||
abbr ksc "kubectl config set-context"
|
||||
|
||||
abbr kexec --function __echo_kubeexec
|
||||
abbr kmanage --function __echo_kubemanage
|
||||
end
|
||||
45
modules/shell/fish/theme.fish
Normal file
45
modules/shell/fish/theme.fish
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Colorscheme: use terminal colors
|
||||
set -U fish_color_normal normal
|
||||
set -U fish_color_command blue
|
||||
set -U fish_color_quote yellow
|
||||
set -U fish_color_redirection cyan --bold
|
||||
set -U fish_color_end green
|
||||
set -U fish_color_error brred
|
||||
set -U fish_color_param cyan
|
||||
set -U fish_color_comment red
|
||||
set -U fish_color_match --background=brblue
|
||||
set -U fish_color_selection white --bold --background=brblack
|
||||
set -U fish_color_search_match bryellow --background=brblack
|
||||
set -U fish_color_history_current --bold
|
||||
set -U fish_color_operator brcyan
|
||||
set -U fish_color_escape brcyan
|
||||
set -U fish_color_cwd green
|
||||
set -U fish_color_cwd_root red
|
||||
set -U fish_color_valid_path --underline
|
||||
set -U fish_color_autosuggestion brblack
|
||||
set -U fish_color_user brgreen
|
||||
set -U fish_color_host normal
|
||||
set -U fish_color_cancel --reverse
|
||||
set -U fish_pager_color_prefix normal --bold --underline
|
||||
set -U fish_pager_color_progress brwhite --background=cyan
|
||||
set -U fish_pager_color_completion normal
|
||||
set -U fish_pager_color_description yellow --italics
|
||||
set -U fish_pager_color_selected_background --reverse
|
||||
set -U fish_pager_color_selected_description
|
||||
set -U fish_pager_color_selected_completion
|
||||
set -U fish_pager_color_secondary_completion
|
||||
set -U fish_pager_color_secondary_background
|
||||
set -U fish_color_keyword
|
||||
set -U fish_pager_color_selected_prefix
|
||||
set -U fish_pager_color_background
|
||||
set -U fish_pager_color_secondary_prefix
|
||||
set -U fish_pager_color_secondary_description
|
||||
set -U fish_color_host_remote
|
||||
set -U fish_color_option
|
||||
|
||||
# Bobthefish config
|
||||
set -g theme_date_timezone Europe/Copenhagen
|
||||
set -g theme_date_format "+%a %H:%M"
|
||||
set -g theme_nerd_fonts yes
|
||||
set -g theme_color_scheme terminal
|
||||
set -g theme_display_user ssh
|
||||
Loading…
Add table
Add a link
Reference in a new issue