From db3af3c76afaecc821b1c8d0f42cc2c5292c4ac0 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 24 Feb 2023 17:56:17 +0100 Subject: [PATCH 01/46] bash: disable ble.sh history share complete on first TAB if there's a single matching filename with show-all-if-ambiguous on enable history search with arrow up after starting to type a command --- modules/terminal-life/bash/default.nix | 38 ++++++++++++++++++++------ 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index c35763cc..b66cce35 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -27,33 +27,53 @@ in { eval "$(${pkgs.direnv}/bin/direnv hook bash)" + bind 'set show-all-if-ambiguous on' + # Syntax highlighting, auto suggestions, vim modes, etc. # https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs source "$(blesh-share)" --attach=none # ctrl + space to accept autocomplete suggestion ble-bind -m 'auto_complete' -f 'C-@' 'auto_complete/insert-on-end' # Meta (Alt) + Backspace to delete a word - ble-bind -m 'emacs' -f 'M-C-?' 'kill-backward-cword' + ble-bind -m 'vi_imap' -f 'M-C-?' 'kill-backward-cword' # Meta (Alt) + p to jump one word backwards - ble-bind -m 'emacs' -f M-p '@nomarked backward-cword' + ble-bind -m 'vi_imap' -f M-p '@nomarked backward-cword' # Meta (Alt) + n to jump one word forwards - ble-bind -m 'emacs' -f M-n '@nomarked forward-cword' + ble-bind -m 'vi_imap' -f M-n '@nomarked forward-cword' # Arrow up and Ctrl + p searches history for entered input - ble-bind -f up 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' - ble-bind -f C-p 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' + ble-bind -m 'vi_imap' -f up 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' + ble-bind -m 'vi_imap' -f C-p 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' # Arrow down and Ctrl + n searches history for entered input - ble-bind -f down 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' - ble-bind -f C-n 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' + ble-bind -m 'vi_imap' -f down 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' + ble-bind -m 'vi_imap' -f C-n 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' function my/complete-load-hook { - bleopt complete_auto_delay=300 + bleopt complete_auto_delay=500 } blehook/eval-after-load complete my/complete-load-hook bleopt exec_errexit_mark= - bleopt history_share=1 bleopt filename_ls_colors="$LS_COLORS" + bleopt complete_menu_style=desc-raw + + # Bash vim mode keybindings + if [[ $- == *i* ]]; then # in interactive session + set -o vi + + ble-bind -m vi_imap -f 'ENTER' 'vi_imap/complete' + ble-bind -m vi_imap -f 'TAB' 'vi_imap/complete' + + ble-bind -m vi_imap -f 'j j' 'vi_imap/normal-mode' + ble-bind -m vi_imap -f 'ESC' 'vi_imap/normal-mode' + + ble-bind -m vi_nmap -f 'h' 'vi_nmap/insert-mode' + ble-bind -m vi_nmap -f 'i' 'vi-command/backward-line' + ble-bind -m vi_nmap -f 'j' 'vi-command/backward-char' + ble-bind -m vi_nmap -f 'k' 'vi-command/forward-line' + ble-bind -m vi_nmap -f 'l' 'vi-command/forward-char' + fi + # end of .bashrc [[ ''${BLE_VERSION-} ]] && ble-attach ''; From 3f7f1f00384824bcf49f965f791c0df6cb7c61c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Fri, 24 Feb 2023 18:33:13 +0100 Subject: [PATCH 02/46] Fix blesh hash --- overlays/blesh.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlays/blesh.nix b/overlays/blesh.nix index 72fd6bcc..d31cbb3e 100644 --- a/overlays/blesh.nix +++ b/overlays/blesh.nix @@ -5,7 +5,7 @@ final: prev: { owner = "akinomyoga"; repo = "ble.sh"; rev = "0ceb0cb38157c2c37650ffb069098783338eb02c"; - hash = "sha256-f3w3gHKysRafBGcZbCPUvy9e/fOrQc9TBZAjb0ioxpo="; + hash = "sha256-e/CetIdKuc8fhZp1v+SzOBwkZn8o1g5SjaF74Ir1daI="; fetchSubmodules = true; leaveDotGit = true; }; From 9a3a7c7d008901797ab743d2e952a2d49998002e Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 24 Feb 2023 18:23:36 +0100 Subject: [PATCH 03/46] bash: ble.sh use desc menu style for completion --- modules/terminal-life/bash/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index b66cce35..a9b9d0da 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -55,7 +55,7 @@ in { bleopt exec_errexit_mark= bleopt filename_ls_colors="$LS_COLORS" - bleopt complete_menu_style=desc-raw + bleopt complete_menu_style=desc # Bash vim mode keybindings if [[ $- == *i* ]]; then # in interactive session From 5fd4ffeb5df38f65c74d165ecfd09b244fa87ad5 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 24 Feb 2023 18:35:06 +0100 Subject: [PATCH 04/46] bash: fix starship color in prompt --- modules/terminal-life/starship.toml.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/terminal-life/starship.toml.nix b/modules/terminal-life/starship.toml.nix index 0fd21ad0..da8b2b7c 100644 --- a/modules/terminal-life/starship.toml.nix +++ b/modules/terminal-life/starship.toml.nix @@ -1,5 +1,5 @@ { - format = "$directory($git_branch$git_commit$git_state$git_status)($c$deno$golang$haskell$nodejs$php$python$ruby$rust$terraform[](fg:#86BBD8 bg:#06969A))($docker_context[](fg:#06969A))($container)$fill(\${custom.triton})$nix_shell$status[ |](fg:#F85E84)$line_break$character"; + format = "$directory($git_branch$git_commit$git_state$git_status)($c$deno$golang$haskell$nodejs$php$python$ruby$rust$terraform[](fg:#F85E84 bg:black))($docker_context[](fg:#06969A))($container)$fill(\${custom.triton})$nix_shell$status[ |](fg:#F85E84)$line_break$character"; # Disable the blank line at the start of the prompt add_newline = false; From 9e6c7c140b8933c62c2093c46121749d1a5cbe71 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 24 Feb 2023 20:15:45 +0100 Subject: [PATCH 05/46] bash: use nvfetcher for ble.sh sources --- overlays/blesh.nix | 10 +--------- pkgs/_sources/generated.nix | 25 +++++++++++++++++++------ pkgs/sources.toml | 6 ++++++ 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/overlays/blesh.nix b/overlays/blesh.nix index d31cbb3e..f3c93d73 100644 --- a/overlays/blesh.nix +++ b/overlays/blesh.nix @@ -1,13 +1,5 @@ final: prev: { blesh = prev.blesh.overrideAttrs (oldAttrs: rec { - version = "unstable-2023-02-01"; - src = prev.fetchFromGitHub { - owner = "akinomyoga"; - repo = "ble.sh"; - rev = "0ceb0cb38157c2c37650ffb069098783338eb02c"; - hash = "sha256-e/CetIdKuc8fhZp1v+SzOBwkZn8o1g5SjaF74Ir1daI="; - fetchSubmodules = true; - leaveDotGit = true; - }; + inherit (prev.sources.blesh-nvfetcher) version src; }); } diff --git a/pkgs/_sources/generated.nix b/pkgs/_sources/generated.nix index fb4a336e..b28f7715 100644 --- a/pkgs/_sources/generated.nix +++ b/pkgs/_sources/generated.nix @@ -15,6 +15,19 @@ sha256 = "sha256-448OlDnrDkUjvaSLDhXsa9bkgYXzj1Ju8CTpJVjH8LM="; }; }; + blesh-nvfetcher = { + pname = "blesh-nvfetcher"; + version = "10aa9b4fe47fc07ccdc9d5ba35f1417fdb614d41"; + src = fetchFromGitHub { + owner = "akinomyoga"; + repo = "ble.sh"; + rev = "10aa9b4fe47fc07ccdc9d5ba35f1417fdb614d41"; + fetchSubmodules = true; + deepClone = false; + leaveDotGit = true; + sha256 = "sha256-5H6kBwHOOF5p+4htTEhTDVoseynTXcFBFfH6d3dYvks="; + }; + }; instant-nvim-nvfetcher = { pname = "instant-nvim-nvfetcher"; version = "294b6d08143b3db8f9db7f606829270149e1a786"; @@ -39,13 +52,13 @@ }; ohmyzsh = { pname = "ohmyzsh"; - version = "65a1e4edbe678cdac37ad96ca4bc4f6d77e27adf"; + version = "5cb943eea46d322542c5c2a9f54b201eddc2aa67"; src = fetchFromGitHub { owner = "ohmyzsh"; repo = "ohmyzsh"; - rev = "65a1e4edbe678cdac37ad96ca4bc4f6d77e27adf"; + rev = "5cb943eea46d322542c5c2a9f54b201eddc2aa67"; fetchSubmodules = false; - sha256 = "sha256-qyI7CU0vKhhADZfQtD73GsyAbqdMPhDQ1uA03h4erpw="; + sha256 = "sha256-Edxhyogl5evjmzyWvImnIpNo91ksvUgQtcuuY50L6c8="; }; }; powerlevel10k = { @@ -72,13 +85,13 @@ }; vim-apprentice-nvfetcher = { pname = "vim-apprentice-nvfetcher"; - version = "9942d0bb0a5d82f7a24450b00051c1f2cc008659"; + version = "59ad13661fa15edaf72c62218903c7817b5a3691"; src = fetchFromGitHub { owner = "romainl"; repo = "Apprentice"; - rev = "9942d0bb0a5d82f7a24450b00051c1f2cc008659"; + rev = "59ad13661fa15edaf72c62218903c7817b5a3691"; fetchSubmodules = false; - sha256 = "sha256-Xs+vTdnihNbBFPOKsW+NB40pqN9eaadqzc0DIeNoOFo="; + sha256 = "sha256-03B9tmU9+6t2hxhOgZxBqJr9r41CAqhHLUkHYvFdcks="; }; }; vim-beautify-nvfetcher = { diff --git a/pkgs/sources.toml b/pkgs/sources.toml index 5ec5e936..da43c60a 100644 --- a/pkgs/sources.toml +++ b/pkgs/sources.toml @@ -46,3 +46,9 @@ fetch.github = "zeekay/vim-beautify" [vim-apprentice-nvfetcher] src.git = "https://github.com/romainl/Apprentice" fetch.github = "romainl/Apprentice" + +[blesh-nvfetcher] +src.git = "https://github.com/akinomyoga/ble.sh" +fetch.github = "akinomyoga/ble.sh" +git.fetchSubmodules = true +git.leaveDotGit = true From 879a657f8cb846cc43c34f0e933e56ccebf85a57 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 28 Mar 2023 14:20:58 +0200 Subject: [PATCH 06/46] Init CONTRIBUTING.md Explain how to get changes into the existing branches of this repo and what the branches are for --- CONTRIBUTING.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..5fe680a4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,27 @@ +# Quick branch overview +We work with several branches in this repo. This document aims to explain how +to contribute changes to the existing branches. + +### `main` branch +- Changes to `modules` and `profiles` should go [the main branch](https://git.pub.solar/pub-solar/os/src/branch/main) +- Changes can get accepted via: Pull Request +- Branch protected from direct `git push` + +### `infra` branch +- Changes to the [pub.solar](https://pub.solar) infrastructure should be merged [into this branch](https://git.pub.solar/pub-solar/os/src/branch/infra) +- Changes can get accepted via: Pull Request +- Branch protected from direct `git push` + +### `momo/main` branch +- Changes to the [Momo](https://momo.koeln) infrastructure should be merged [into this branch](https://git.pub.solar/pub-solar/os/src/branch/momo/main) +- Changes can get accepted via: Pull Request +- Branch protected from direct `git push` + +### `$USER` branches +- User's custom hosts and changes can be worked on in these branches +- Direct `git push` possible +- Examples: + - [hensoko](https://git.pub.solar/pub-solar/os/src/branch/hensoko) + - [b12f](https://git.pub.solar/pub-solar/os/src/branch/b12f) + - [axeman](https://git.pub.solar/pub-solar/os/src/branch/axeman) + - [teutat3s](https://git.pub.solar/pub-solar/os/src/branch/teutat3s) From 864f38920f8ea23717a4d5615ef01096f5284341 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 28 Mar 2023 14:31:48 +0200 Subject: [PATCH 07/46] docs: mention ci deployment for momo/main branch --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5fe680a4..8283019b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,6 +15,7 @@ to contribute changes to the existing branches. ### `momo/main` branch - Changes to the [Momo](https://momo.koeln) infrastructure should be merged [into this branch](https://git.pub.solar/pub-solar/os/src/branch/momo/main) - Changes can get accepted via: Pull Request +- Deployment of changes is [automatic via CI pipeline](https://git.pub.solar/pub-solar/os/src/commit/43bd7421509f7cc9ba06d7c740f3f536a4a2af76/.drone.yml#L20-L38) - Branch protected from direct `git push` ### `$USER` branches From fcd65dc34a68d27bd3b31c3175a2e8c0b37a6b23 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 15 Apr 2023 12:44:45 +0200 Subject: [PATCH 08/46] bash: want CTRL+c to cancel and discard current line when in ble.sh vim insert mode --- modules/terminal-life/bash/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index a9b9d0da..ad4247f1 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -72,6 +72,8 @@ in { ble-bind -m vi_nmap -f 'j' 'vi-command/backward-char' ble-bind -m vi_nmap -f 'k' 'vi-command/forward-line' ble-bind -m vi_nmap -f 'l' 'vi-command/forward-char' + + ble-bind -m vi_imap -f 'C-c' discard-line fi # end of .bashrc From 9930808f7739beb7e9b2493049fd164dd64439c3 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 5 May 2023 18:11:04 +0200 Subject: [PATCH 09/46] starship: prepare username@hostname prompt Remove old toml file --- modules/terminal-life/starship.toml.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/modules/terminal-life/starship.toml.nix b/modules/terminal-life/starship.toml.nix index da8b2b7c..ed10ae61 100644 --- a/modules/terminal-life/starship.toml.nix +++ b/modules/terminal-life/starship.toml.nix @@ -5,12 +5,18 @@ add_newline = false; # You can also replace your username with a neat symbol like  to save some space - #username = { - # show_always = true; - # style_user = "bg:#9A348E"; - # style_root = "bg:#9A348E"; - # format = ''[$user ]($style)''; - #}; + username = { + show_always = true; + style_user = "bg:#9A348E"; + style_root = "bg:#9A348E"; + format = ''[$user]($style)''; + }; + hostname = { + ssh_only = false; + format = "@[$ssh_symbol$hostname]($style)"; + disabled = false; + }; + character = { success_symbol = "[❯](bold purple)"; error_symbol = "[✗](#FF4B00)"; From 438be193e8a3d3a325a1f0988f13151d10cbd77a Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 5 May 2023 18:37:18 +0200 Subject: [PATCH 10/46] ble.sh decrease completion timeout a bit more --- modules/terminal-life/bash/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index ad4247f1..1370f04a 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -48,7 +48,7 @@ in { ble-bind -m 'vi_imap' -f C-n 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' function my/complete-load-hook { - bleopt complete_auto_delay=500 + bleopt complete_auto_delay=250 } blehook/eval-after-load complete my/complete-load-hook From 70045c28eab502859c34f07162d6945471af6a1f Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 6 May 2023 15:19:08 +0200 Subject: [PATCH 11/46] zsh: remove leftover files and traces of zsh usage Move base16.zsh into XDG_DATA_HOME, rename to base16.sh --- modules/terminal-life/nvim/ui.vim | 2 +- modules/terminal-life/zsh/default.nix | 123 --- modules/terminal-life/zsh/fzf.zsh | 58 -- modules/terminal-life/zsh/p10k.zsh | 943 ------------------ pkgs/_sources/generated.nix | 44 - pkgs/sources.toml | 16 - .../base-user/.local/share/scripts/base16.sh | 64 +- profiles/base-user/home.nix | 2 + tests/first-test.nix | 2 +- 9 files changed, 36 insertions(+), 1218 deletions(-) delete mode 100644 modules/terminal-life/zsh/default.nix delete mode 100644 modules/terminal-life/zsh/fzf.zsh delete mode 100644 modules/terminal-life/zsh/p10k.zsh rename modules/terminal-life/zsh/base16.zsh => profiles/base-user/.local/share/scripts/base16.sh (69%) diff --git a/modules/terminal-life/nvim/ui.vim b/modules/terminal-life/nvim/ui.vim index 3131188f..017b413e 100644 --- a/modules/terminal-life/nvim/ui.vim +++ b/modules/terminal-life/nvim/ui.vim @@ -1,4 +1,4 @@ -let g:base16_shell_path = $XDG_CONFIG_HOME . "/zsh/base16.sh" +let g:base16_shell_path = $XDG_DATA_HOME . "/scripts/base16.sh" let base16colorspace = 256 set termguicolors let g:sonokai_style = 'shusia' diff --git a/modules/terminal-life/zsh/default.nix b/modules/terminal-life/zsh/default.nix deleted file mode 100644 index a9f0b97c..00000000 --- a/modules/terminal-life/zsh/default.nix +++ /dev/null @@ -1,123 +0,0 @@ -{ - config, - pkgs, - self, - ... -}: let - psCfg = config.pub-solar; - xdg = config.home-manager.users."${psCfg.user.name}".xdg; -in { - enable = true; - enableAutosuggestions = true; - enableCompletion = true; - dotDir = ".config/zsh"; - - history = { - ignoreDups = true; - expireDuplicatesFirst = true; - ignoreSpace = true; - path = "$HOME/.local/share/zsh/zsh_history"; - save = 10000; - size = 10000; - }; - - loginExtra = '' - [ "$(tty)" = "/dev/tty1" ] && exec ${pkgs.sway-service}/bin/sway-service - ''; - - shellAliases = { - nano = "nvim"; - vi = "nvim"; - vim = "nvim"; - mutt = "neomutt"; - ls = "exa"; - la = "exa --group-directories-first -lag"; - fm = "vifm ."; - vifm = "vifm ."; - wget = "wget --hsts-file=$XDG_CACHE_HOME/wget-hsts"; - irssi = "irssi --config=$XDG_CONFIG_HOME/irssi/config --home=$XDG_DATA_HOME/irssi"; - drone = "DRONE_TOKEN=$(secret-tool lookup drone token) drone"; - no = "manix \"\" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview=\"manix '{}'\" | xargs manix"; - # fix nixos-option - nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat"; - myip = "dig +short myip.opendns.com @208.67.222.222 2>&1"; - }; - plugins = [ - # src gets fetched by nvfetcher, see: ./pkgs/sources.toml - { - # will source ohmyzsh/plugins/z/ - name = "zsh-plugins-z"; - file = "plugins/z/z.plugin.zsh"; - src = pkgs.sources.ohmyzsh.src; - } - { - name = "zsh-powerlevel10k"; - file = "powerlevel10k.zsh-theme"; - src = pkgs.sources.powerlevel10k.src; - } - { - name = "zsh-fast-syntax-highlighting"; - file = "F-Sy-H.plugin.zsh"; - src = pkgs.sources.F-Sy-H.src; - } - { - name = "zsh-nix-shell"; - file = "nix-shell.plugin.zsh"; - src = pkgs.sources.zsh-nix-shell.src; - } - ]; - - initExtra = - '' - bindkey -v - bindkey -v 'jj' vi-cmd-mode - bindkey -a 'i' up-line - bindkey -a 'k' down-line - bindkey -a 'j' backward-char - bindkey -a 'h' vi-insert - bindkey '^[[H' beginning-of-line - bindkey '^[[F' end-of-line - bindkey '^R' history-incremental-pattern-search-backward - bindkey '^ ' autosuggest-accept - bindkey '^q' push-line-or-edit - - bindkey '^R' fzf-history-widget - - # ArrowUp/Down start searching history with current input - autoload -U up-line-or-beginning-search - autoload -U down-line-or-beginning-search - zle -N up-line-or-beginning-search - zle -N down-line-or-beginning-search - bindkey "^[[A" up-line-or-beginning-search - bindkey "^[[B" down-line-or-beginning-search - bindkey "^P" up-line-or-beginning-search - bindkey "^N" down-line-or-beginning-search - - # MAKE CTRL+S WORK IN VIM - stty -ixon - stty erase '^?' - - precmd () { - DIR_NAME=$(pwd | sed "s|^$HOME|~|g") - echo -e -n "\e]2;$DIR_NAME\e\\" - - if [ $(date +%d%m) = '0104' ]; then - if [ $? -eq 0 ]; then - echo "Success! That was a great command! I can't wait to see what amazing stuff you'll be up to next." - fi - fi - } - - # If a command is not found, show me where it is - source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh - '' - + builtins.readFile ./base16.zsh - + builtins.readFile ./p10k.zsh - + '' - source ${pkgs.fzf}/share/fzf/key-bindings.zsh - source ${pkgs.fzf}/share/fzf/completion.zsh - source ${pkgs.git-bug}/share/zsh/site-functions/git-bug - eval "$(direnv hook zsh)" - '' - + builtins.readFile ./fzf.zsh; -} diff --git a/modules/terminal-life/zsh/fzf.zsh b/modules/terminal-life/zsh/fzf.zsh deleted file mode 100644 index 78b0fb86..00000000 --- a/modules/terminal-life/zsh/fzf.zsh +++ /dev/null @@ -1,58 +0,0 @@ -# Use ~~ as the trigger sequence instead of the default ** -export FZF_COMPLETION_TRIGGER='~~' - -# Options to fzf command -export FZF_COMPLETION_OPTS='--border --info=inline' - -__fzfcmd() { - echo "fzf" -} - -# ctrl+r - Paste the selected command from history into the command line -fzf-history-widget() { - local selected num - setopt localoptions noglobsubst noposixbuiltins pipefail HIST_FIND_NO_DUPS 2> /dev/null - - selected=( $(fc -rl 1 | - FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS --query=${(qqq)LBUFFER} +m" $(__fzfcmd)) ) - local ret=$? - if [ -n "$selected" ]; then - num=$selected[1] - if [ -n "$num" ]; then - zle vi-fetch-history -n $num - fi - fi - zle redisplay - typeset -f zle-line-init >/dev/null && zle zle-line-init - return $ret -} -zle -N fzf-history-widget -bindkey '^R' fzf-history-widget - -# Use fd (https://github.com/sharkdp/fd) instead of the default find -# command for listing path candidates. -# - The first argument to the function ($1) is the base path to start traversal -# - See the source code (completion.{bash,zsh}) for the details. -_fzf_compgen_path() { - fd --hidden --follow --exclude ".git" . "$1" -} - -# Use fd to generate the list for directory completion -_fzf_compgen_dir() { - fd --type d --hidden --follow --exclude ".git" . "$1" -} - -# (EXPERIMENTAL) Advanced customization of fzf options via _fzf_comprun function -# - The first argument to the function is the name of the command. -# - You should make sure to pass the rest of the arguments to fzf. -_fzf_comprun() { - local command=$1 - shift - - case "$command" in - cd) fzf "$@" --preview 'tree -C {} | head -200' ;; - export|unset) fzf "$@" --preview "eval 'echo \$'{}" ;; - ssh) fzf "$@" --preview 'dig {}' ;; - *) fzf "$@" ;; - esac -} diff --git a/modules/terminal-life/zsh/p10k.zsh b/modules/terminal-life/zsh/p10k.zsh deleted file mode 100644 index 90734313..00000000 --- a/modules/terminal-life/zsh/p10k.zsh +++ /dev/null @@ -1,943 +0,0 @@ -# Generated by Powerlevel10k configuration wizard on 2020-04-18 at 01:15 CEST. -# Based on romkatv/powerlevel10k/config/p10k-classic.zsh, checksum 30399. -# Wizard options: powerline, classic, unicode, darkest, 24h time, angled separators, -# sharp heads, sharp tails, 1 line, compact, concise, transient_prompt, -# instant_prompt=verbose. -# Type `p10k configure` to generate another config. -# -# Config for Powerlevel10k with classic powerline prompt style. Type `p10k configure` to generate -# your own config based on it. -# -# Tip: Looking for a nice color? Here's a one-liner to print colormap. -# -# for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done - -# Temporarily change options. -'builtin' 'local' '-a' 'p10k_config_opts' -[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases') -[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob') -[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand') -'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' - -() { - emulate -L zsh -o extended_glob - - # Unset all configuration options. This allows you to apply configuration changes without - # restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`. - unset -m 'POWERLEVEL9K_*' - - # Zsh >= 5.1 is required. - autoload -Uz is-at-least && is-at-least 5.1 || return - - # The list of segments shown on the left. Fill it with the most important segments. - typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( - ssh - context - dir # current directory - vcs # git status - # prompt_char # prompt symbol - ) - - # The list of segments shown on the right. Fill it with less important segments. - # Right prompt on the last prompt line (where you are typing your commands) gets - # automatically hidden when the input line reaches it. Right prompt above the - # last prompt line gets hidden if it would overlap with left prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( - vi_mode # vi mode (you don't need this if you've enabled prompt_char) - status # exit code of the last command - command_execution_time # duration of the last command - background_jobs # presence of background jobs - direnv # direnv status (https://direnv.net/) - vim_shell # vim shell indicator (:sh) - triton # show the current triton profile - nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) - watson - # kubecontext # current kubernetes context (https://kubernetes.io/) - # terraform # terraform workspace (https://www.terraform.io) - # aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) - # aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) - # azure # azure account name (https://docs.microsoft.com/en-us/cli/azure) - # gcloud # google cloud cli account and project (https://cloud.google.com/) - # google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production) - # context # user@hostname - # ranger # ranger shell (https://github.com/ranger/ranger) - # nnn # nnn shell (https://github.com/jarun/nnn) - # midnight_commander # midnight commander shell (https://midnight-commander.org/) - # vpn_ip # virtual private network indicator - # load # CPU load - # disk_usage # disk usage - # ram # free RAM - # swap # used swap - # todo # todo items (https://github.com/todotxt/todo.txt-cli) - # timewarrior # timewarrior tracking status (https://timewarrior.net/) - # taskwarrior # taskwarrior task count (https://taskwarrior.org/) - # time # current time - # ip # ip address and bandwidth usage for a specified network interface - # public_ip # public IP address - # proxy # system-wide http/https/ftp proxy - # battery # internal battery - # wifi # wifi speed - # example # example user-defined segment (see prompt_example function below) - ) - - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND="black" - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND="yellow" - typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING="" - typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING="CMD" - - # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you. - typeset -g POWERLEVEL9K_MODE=powerline - # When set to `moderate`, some icons will have an extra space after them. This is meant to avoid - # icon overlap when using non-monospace fonts. When set to `none`, spaces are not added. - typeset -g POWERLEVEL9K_ICON_PADDING=none - - # When set to true, icons appear before content on both sides of the prompt. When set - # to false, icons go after content. If empty or not set, icons go before content in the left - # prompt and after content in the right prompt. - # - # You can also override it for a specific segment: - # - # POWERLEVEL9K_STATUS_ICON_BEFORE_CONTENT=false - # - # Or for a specific segment in specific state: - # - # POWERLEVEL9K_DIR_NOT_WRITABLE_ICON_BEFORE_CONTENT=false - typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT= - - # Add an empty line before each prompt. - typeset -g POWERLEVEL9K_PROMPT_ON_NEWLINE=true - typeset -g POWERLEVEL9K_RPROMPT_ON_NEWLINE=false - - # Connect left prompt lines with these symbols. You'll probably want to use the same color - # as POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND below. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='' - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX='%238F' - typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='%238F❯ ' - # Connect right prompt lines with these symbols. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX='%238F' - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX='%238F' - typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX='%238F' - - # Filler between left and right prompt on the first prompt line. You can set it to ' ', '·' or - # '─'. The last two make it easier to see the alignment between left and right prompt and to - # separate prompt from command output. You might want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false - # for more compact prompt if using using this option. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_BACKGROUND= - if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then - # The color of the filler. You'll probably want to match the color of POWERLEVEL9K_MULTILINE - # ornaments defined above. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=238 - # Start filler from the edge of the screen if there are no left segments on the first line. - typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}' - # End filler on the edge of the screen if there are no right segments on the first line. - typeset -g POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='%{%}' - fi - - # Default background color. - typeset -g POWERLEVEL9K_BACKGROUND=none - - # Separator between same-color segments on the left. - typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='%242F\uE0B1' - # Separator between same-color segments on the right. - typeset -g POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='%242F\uE0B3' - # Separator between different-color segments on the left. - typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0B0' - # Separator between different-color segments on the right. - typeset -g POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0B2' - # The right end of left prompt. - typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B0' - # The left end of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B2' - # The left end of left prompt. - typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B2' - # The right end of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B0' - # Left prompt terminator for lines without any segments. - typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= - - #################################[ os_icon: os identifier ]################################## - # OS identifier color. - typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=255 - # Custom icon. - # typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='⭐' - - ################################[ prompt_char: prompt symbol ]################################ - # Transparent background. - typeset -g POWERLEVEL9K_PROMPT_CHAR_BACKGROUND= - # Green prompt symbol if the last command succeeded. - typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=1 - # Red prompt symbol if the last command failed. - typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=17 - # Default prompt symbol. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯' - # Prompt symbol in command vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮' - # Prompt symbol in visual vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='Ⅴ' - # Prompt symbol in overwrite vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶' - typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true - # No line terminator if prompt_char is the last segment. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= - # No line introducer if prompt_char is the first segment. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= - # No surrounding whitespace. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_{LEFT,RIGHT}_WHITESPACE= - - ##################################[ dir: current directory ]################################## - typeset -g POWERLEVEL9K_{ETC,FOLDER,HOME,HOME_SUB}_ICON= - typeset -g POWERLEVEL9K_DIR_{ETC,HOME,HOME_SUBFOLDER,DEFAULT,NOT_WRITABLE}_BACKGROUND=1 - typeset -g POWERLEVEL9K_DIR_{ETC,HOME,HOME_SUBFOLDER,DEFAULT,NOT_WRITABLE}_FOREGROUND=0 - typeset -g POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_VISUAL_IDENTIFIER_COLOR=17 - - typeset -g POWERLEVEL9K_DIR_{ETC,DEFAULT}_BACKGROUND=15 - typeset -g POWERLEVEL9K_DIR_{HOME,HOME_SUBFOLDER}_BACKGROUND=1 - typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_BACKGROUND=1 - - # If directory is too long, shorten some of its segments to the shortest possible unique - # prefix. The shortened directory can be tab-completed to the original. - typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique - # Color of the shortened directory segments. - typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=0 - # Color of the anchor directory segments. Anchor segments are never shortened. The first - # segment is always an anchor. - typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=0 - # Display anchor directory segments in bold. - typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=false - # Don't shorten directories that contain any of these files. They are anchors. - local anchor_files=( - .bzr - .citc - .git - .hg - .node-version - .python-version - .go-version - .ruby-version - .lua-version - .java-version - .perl-version - .php-version - .tool-version - .shorten_folder_marker - .svn - .terraform - CVS - Cargo.toml - composer.json - go.mod - package.json - stack.yaml - ) - typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(${(j:|:)anchor_files})" - # If set to true, remove everything before the last (deepest) subdirectory that contains files - # matching $POWERLEVEL9K_SHORTEN_FOLDER_MARKER. For example, when the current directory is - # /foo/bar/git_repo/baz, prompt will display git_repo/baz. This assumes that /foo/bar/git_repo - # contains a marker (.git) and other directories don't. - typeset -g POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=false - # Don't shorten this many last directory segments. They are anchors. - typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 - # Shorten directory if it's longer than this even if there is space for it. The value can - # be either absolute (e.g., '80') or a percentage of terminal width (e.g, '50%'). If empty, - # directory will be shortened only when prompt doesn't fit or when other parameters demand it - # (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below). - # If set to `0`, directory will always be shortened to its minimum length. - typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80 - # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this - # many columns for typing commands. - typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40 - # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least - # COLUMNS * POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT * 0.01 columns for typing commands. - typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50 - # If set to true, embed a hyperlink into the directory. Useful for quickly - # opening a directory in the file manager simply by clicking the link. - # Can also be handy when the directory is shortened, as it allows you to see - # the full directory that was used in previous commands. - typeset -g POWERLEVEL9K_DIR_HYPERLINK=false - - # Enable special styling for non-writable directories. - typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true - # Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE - # above must be set to true for this parameter to have effect. - typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='∅' - - #####################################[ vcs: git status ]###################################### - # Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon. - typeset -g POWERLEVEL9K_VCS_BRANCH_ICON= - - # Untracked files icon. It's really a question mark, your font isn't broken. - # Change the value of this parameter to show a different icon. - typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?' - - # Formatter for Git status. - # - # Example output: master ⇣42⇡42 *42 merge ~42 +42 !42 ?42. - # - # You can edit the function to customize how Git status looks. - # - # VCS_STATUS_* parameters are set by gitstatus plugin. See reference: - # https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh. - function my_git_formatter() { - emulate -L zsh - - if [[ -n $P9K_CONTENT ]]; then - # If P9K_CONTENT is not empty, use it. It's either "loading" or from vcs_info (not from - # gitstatus plugin). VCS_STATUS_* parameters are not available in this case. - typeset -g my_git_format=$P9K_CONTENT - return - fi - - if (( $1 )); then - # Styling for up-to-date Git status. - local meta='%0F' # grey foreground - local clean='%0F' # green foreground - local modified='%0F' # yellow foreground - local untracked='%0F' # blue foreground - local conflicted='%0F' # red foreground - else - # Styling for incomplete and stale Git status. - local meta='%0F' # grey foreground - local clean='%0F' # grey foreground - local modified='%0F' # grey foreground - local untracked='%0F' # grey foreground - local conflicted='%0F' # grey foreground - fi - - local res - local where # branch or tag - if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then - res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}" - where=${(V)VCS_STATUS_LOCAL_BRANCH} - elif [[ -n $VCS_STATUS_TAG ]]; then - res+="${meta}#" - where=${(V)VCS_STATUS_TAG} - fi - - # If local branch name or tag is at most 32 characters long, show it in full. - # Otherwise show the first 12 … the last 12. - # Tip: To always show local branch name in full without truncation, delete the next line. - (( $#where > 32 )) && where[13,-13]="…" - res+="${clean}${where//\%/%%}" # escape % - - # Display the current Git commit if there is no branch or tag. - # Tip: To always display the current Git commit, remove `[[ -z $where ]] &&` from the next line. - [[ -z $where ]] && res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}" - - # Show tracking branch name if it differs from local branch. - if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then - res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape % - fi - - # ⇣42 if behind the remote. - (( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}⇣${VCS_STATUS_COMMITS_BEHIND}" - # ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42. - (( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" " - (( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}⇡${VCS_STATUS_COMMITS_AHEAD}" - # ⇠42 if behind the push remote. - (( VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" ${clean}⇠${VCS_STATUS_PUSH_COMMITS_BEHIND}" - (( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" " - # ⇢42 if ahead of the push remote; no leading space if also behind: ⇠42⇢42. - (( VCS_STATUS_PUSH_COMMITS_AHEAD )) && res+="${clean}⇢${VCS_STATUS_PUSH_COMMITS_AHEAD}" - # *42 if have stashes. - (( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}" - # 'merge' if the repo is in an unusual state. - [[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}" - # ~42 if have merge conflicts. - (( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}" - # +42 if have staged changes. - (( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}" - # !42 if have unstaged changes. - (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}" - # ?42 if have untracked files. It's really a question mark, your font isn't broken. - # See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon. - # Remove the next line if you don't want to see untracked files at all. - (( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}" - # "─" if the number of unstaged files is unknown. This can happen due to - # POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY (see below) being set to a non-negative number lower - # than the number of files in the Git index, or due to bash.showDirtyState being set to false - # in the repository config. The number of staged and untracked files may also be unknown - # in this case. - (( VCS_STATUS_HAS_UNSTAGED == -1 )) && res+=" ${modified}─" - - typeset -g my_git_format=$res - } - functions -M my_git_formatter 2>/dev/null - - # Don't count the number of unstaged, untracked and conflicted files in Git repositories with - # more than this many files in the index. Negative value means infinity. - # - # If you are working in Git repositories with tens of millions of files and seeing performance - # sagging, try setting POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY to a number lower than the output - # of `git ls-files | wc -l`. Alternatively, add `bash.showDirtyState = false` to the repository's - # config: `git config bash.showDirtyState false`. - typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1 - - # Don't show Git status in prompt for repositories whose workdir matches this pattern. - # For example, if set to '~', the Git repository at $HOME/.git will be ignored. - # Multiple patterns can be combined with '|': '~|~/some/dir'. - typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~' - - # Disable the default Git status formatting. - typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true - # Install our own Git status formatter. - typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}' - typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter(0)))+${my_git_format}}' - # Enable counters for staged, unstaged, etc. - typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1 - - # Icon color. - typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_COLOR=4 - typeset -g POWERLEVEL9K_VCS_LOADING_VISUAL_IDENTIFIER_COLOR=4 - # Custom icon. - typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION= - # Custom prefix. - # typeset -g POWERLEVEL9K_VCS_PREFIX='%244Fon ' - - # Show status of repositories of these types. You can add svn and/or hg if you are - # using them. If you do, your prompt may become slow even when your current directory - # isn't in an svn or hg reposotiry. - typeset -g POWERLEVEL9K_VCS_BACKENDS=(git) - - # These settings are used for respositories other than Git or when gitstatusd fails and - # Powerlevel10k has to fall back to using vcs_info. - typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=0 - typeset -g POWERLEVEL9K_VCS_CLEAN_BACKGROUND=2 - typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=0 - typeset -g POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND=3 - typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=0 - typeset -g POWERLEVEL9K_VCS_MODIFIED_BACKGROUND=3 - - ##########################[ status: exit code of the last command ]########################### - # Enable OK_PIPE, ERROR_PIPE and ERROR_SIGNAL status states to allow us to enable, disable and - # style them independently from the regular OK and ERROR state. - typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true - - # Status on success. No content, just an icon. No need to show it if prompt_char is enabled as - # it will signify success by turning green. - typeset -g POWERLEVEL9K_STATUS_OK=true - typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=70 - typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION='✔' - - # Status when some part of a pipe command fails but the overall exit status is zero. It may look - # like this: 1|0. - typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=70 - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='✔' - - # Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as - # it will signify error by turning red. - typeset -g POWERLEVEL9K_STATUS_ERROR=true - typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=160 - typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='✘' - - # Status when the last command was terminated by a signal. - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=160 - # Use terse signal names: "INT" instead of "SIGINT(2)". - typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION='✘' - - # Status when some part of a pipe command fails and the overall exit status is also non-zero. - # It may look like this: 1|0. - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=160 - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION='✘' - - ###################[ command_execution_time: duration of the last command ]################### - # Show duration of the last command if takes longer than this many seconds. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 - # Show this many fractional digits. Zero means round to seconds. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 - # Execution time color. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=0 - # Duration format: 1d 2h 3m 4s. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' - # Custom icon. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION= - # Custom prefix. - # typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='%244Ftook ' - - #######################[ background_jobs: presence of background jobs ]####################### - # Don't show the number of background jobs. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false - # Background jobs color. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=37 - # Custom icon. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='≡' - - #######################[ direnv: direnv status (https://direnv.net/) ]######################## - # Direnv color. - typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=178 - # Custom icon. - # typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ asdf: asdf version manager (https://github.com/asdf-vm/asdf) ]############### - # Default asdf color. Only used to display tools for which there is no color override (see below). - typeset -g POWERLEVEL9K_ASDF_FOREGROUND=66 - - # There are four parameters that can be used to hide asdf tools. Each parameter describes - # conditions under which a tool gets hidden. Parameters can hide tools but not unhide them. If at - # least one parameter decides to hide a tool, that tool gets hidden. If no parameter decides to - # hide a tool, it gets shown. - # - # Special note on the difference between POWERLEVEL9K_ASDF_SOURCES and - # POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW. Consider the effect of the following commands: - # - # asdf local python 3.8.1 - # asdf global python 3.8.1 - # - # After running both commands the current python version is 3.8.1 and its source is "local" as - # it takes precedence over "global". If POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW is set to false, - # it'll hide python version in this case because 3.8.1 is the same as the global version. - # POWERLEVEL9K_ASDF_SOURCES will hide python version only if the value of this parameter doesn't - # contain "local". - - # Hide tool versions that don't come from one of these sources. - # - # Available sources: - # - # - shell `asdf current` says "set by ASDF_${TOOL}_VERSION environment variable" - # - local `asdf current` says "set by /some/not/home/directory/file" - # - global `asdf current` says "set by /home/username/file" - # - # Note: If this parameter is set to (shell local global), it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SOURCES. - typeset -g POWERLEVEL9K_ASDF_SOURCES=(shell local global) - - # If set to false, hide tool versions that are the same as global. - # - # Note: The name of this parameter doesn't reflect its meaning at all. - # Note: If this parameter is set to true, it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_PROMPT_ALWAYS_SHOW. - typeset -g POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW=false - - # If set to false, hide tool versions that are equal to "system". - # - # Note: If this parameter is set to true, it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_SYSTEM. - typeset -g POWERLEVEL9K_ASDF_SHOW_SYSTEM=true - - # If set to non-empty value, hide tools unless there is a file matching the specified file pattern - # in the current directory, or its parent diretory, or its grandparent directory, and so on. - # - # Note: If this parameter is set to empty value, it won't hide tools. - # Note: SHOW_ON_UPGLOB isn't specific to asdf. It works with all prompt segments. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_ON_UPGLOB. - # - # Example: Hide nodejs version when there is no package.json and no *.js files in the current - # directory, in `..`, in `../..` and so on. - # - # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.js|package.json' - typeset -g POWERLEVEL9K_ASDF_SHOW_ON_UPGLOB= - - # Ruby version from asdf. - typeset -g POWERLEVEL9K_ASDF_RUBY_FOREGROUND=168 - # typeset -g POWERLEVEL9K_ASDF_RUBY_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_RUBY_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Python version from asdf. - typeset -g POWERLEVEL9K_ASDF_PYTHON_FOREGROUND=37 - # typeset -g POWERLEVEL9K_ASDF_PYTHON_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PYTHON_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Go version from asdf. - typeset -g POWERLEVEL9K_ASDF_GOLANG_FOREGROUND=37 - # typeset -g POWERLEVEL9K_ASDF_GOLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_GOLANG_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Node.js version from asdf. - typeset -g POWERLEVEL9K_ASDF_NODEJS_FOREGROUND=70 - # typeset -g POWERLEVEL9K_ASDF_NODEJS_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Rust version from asdf. - typeset -g POWERLEVEL9K_ASDF_RUST_FOREGROUND=37 - # typeset -g POWERLEVEL9K_ASDF_RUST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_RUST_SHOW_ON_UPGLOB='*.foo|*.bar' - - # .NET Core version from asdf. - typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=134 - # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Flutter version from asdf. - typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=38 - # typeset -g POWERLEVEL9K_ASDF_FLUTTER_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_FLUTTER_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Lua version from asdf. - typeset -g POWERLEVEL9K_ASDF_LUA_FOREGROUND=32 - # typeset -g POWERLEVEL9K_ASDF_LUA_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_LUA_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Java version from asdf. - typeset -g POWERLEVEL9K_ASDF_JAVA_FOREGROUND=32 - # typeset -g POWERLEVEL9K_ASDF_JAVA_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_JAVA_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Perl version from asdf. - typeset -g POWERLEVEL9K_ASDF_PERL_FOREGROUND=67 - # typeset -g POWERLEVEL9K_ASDF_PERL_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PERL_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Erlang version from asdf. - typeset -g POWERLEVEL9K_ASDF_ERLANG_FOREGROUND=125 - # typeset -g POWERLEVEL9K_ASDF_ERLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_ERLANG_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Elixir version from asdf. - typeset -g POWERLEVEL9K_ASDF_ELIXIR_FOREGROUND=129 - # typeset -g POWERLEVEL9K_ASDF_ELIXIR_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_ELIXIR_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Postgres version from asdf. - typeset -g POWERLEVEL9K_ASDF_POSTGRES_FOREGROUND=31 - # typeset -g POWERLEVEL9K_ASDF_POSTGRES_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_POSTGRES_SHOW_ON_UPGLOB='*.foo|*.bar' - - # PHP version from asdf. - typeset -g POWERLEVEL9K_ASDF_PHP_FOREGROUND=99 - # typeset -g POWERLEVEL9K_ASDF_PHP_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PHP_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Haskell version from asdf. - typeset -g POWERLEVEL9K_ASDF_HASKELL_FOREGROUND=172 - # typeset -g POWERLEVEL9K_ASDF_HASKELL_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_HASKELL_SHOW_ON_UPGLOB='*.foo|*.bar' - - ###########[ nix_shell ]########### - # # Nix shell color. - typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74 - - # Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line. - typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION='' - - # Custom icon. - typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='nix' - - ###########[ vi_mode: vi mode (you don't need this if you've enabled prompt_char) ]########### - # Text and color for normal (a.k.a. command) vi mode. - typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=CMD - typeset -g POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND=4 - # Text and color for visual vi mode. - typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=VIS - typeset -g POWERLEVEL9K_VI_MODE_VISUAL_FOREGROUND=3 - # Text and color for overtype (a.k.a. overwrite and replace) vi mode. - typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVR - typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_FOREGROUND=2 - # Text and color for insert vi mode. - typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING= - typeset -g POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=7 - - ##################################[ context: user@hostname ]################################## - typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=17 - # Context color in SSH without privileges. - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=7 - # Default context color (no privileges, no SSH). - typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=7 - - # Context format when running with privileges: bold user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%B%n@%m' - # Context format when in SSH without privileges: user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE='%n@%m' - # Default context format (no privileges, no SSH): user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m' - - ###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]### - # Python virtual environment color. - typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=37 - # Don't show Python version next to the virtual environment name. - typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false - # Separate environment name from Python version only with a space. - typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= - # Custom icon. - # typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #####################[ anaconda: conda environment (https://conda.io/) ]###################### - # Anaconda environment color. - typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=37 - # Don't show Python version next to the anaconda environment name. - typeset -g POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=false - # Separate environment name from Python version only with a space. - typeset -g POWERLEVEL9K_ANACONDA_{LEFT,RIGHT}_DELIMITER= - # Custom icon. - # typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################ - # Pyenv color. - typeset -g POWERLEVEL9K_PYENV_FOREGROUND=37 - # Hide python version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PYENV_SOURCES=(shell local global) - # If set to false, hide python version if it's the same as global: - # $(pyenv version-name) == $(pyenv global). - typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide python version if it's equal to "system". - typeset -g POWERLEVEL9K_PYENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ goenv: go environment (https://github.com/syndbg/goenv) ]################ - # Goenv color. - typeset -g POWERLEVEL9K_GOENV_FOREGROUND=37 - # Hide go version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_GOENV_SOURCES=(shell local global) - # If set to false, hide go version if it's the same as global: - # $(goenv version-name) == $(goenv global). - typeset -g POWERLEVEL9K_GOENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide go version if it's equal to "system". - typeset -g POWERLEVEL9K_GOENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_GOENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ nodenv: node.js version from nodenv (https://github.com/nodenv/nodenv) ]########## - # Nodenv color. - typeset -g POWERLEVEL9K_NODENV_FOREGROUND=70 - # Hide node version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_NODENV_SOURCES=(shell local global) - # If set to false, hide node version if it's the same as global: - # $(nodenv version-name) == $(nodenv global). - typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide node version if it's equal to "system". - typeset -g POWERLEVEL9K_NODENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_NODENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]############### - # Nvm color. - typeset -g POWERLEVEL9K_NVM_FOREGROUND=70 - # Custom icon. - # typeset -g POWERLEVEL9K_NVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ############[ nodeenv: node.js environment (https://github.com/ekalinin/nodeenv) ]############ - # Nodeenv color. - typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=70 - # Don't show Node version next to the environment name. - typeset -g POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false - # Separate environment name from Node version only with a space. - typeset -g POWERLEVEL9K_NODEENV_{LEFT,RIGHT}_DELIMITER= - # Custom icon. - # typeset -g POWERLEVEL9K_NODEENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##############################[ node_version: node.js version ]############################### - # Node version color. - typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=70 - # Show node version only when in a directory tree containing package.json. - typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_NODE_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######################[ go_version: go version (https://golang.org) ]######################## - # Go version color. - typeset -g POWERLEVEL9K_GO_VERSION_FOREGROUND=37 - # Show go version only when in a go project subdirectory. - typeset -g POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_GO_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #################[ rust_version: rustc version (https://www.rust-lang.org) ]################## - # Rust version color. - typeset -g POWERLEVEL9K_RUST_VERSION_FOREGROUND=37 - # Show rust version only when in a rust project subdirectory. - typeset -g POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_RUST_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ dotnet_version: .NET version (https://dotnet.microsoft.com) ]################ - # .NET version color. - typeset -g POWERLEVEL9K_DOTNET_VERSION_FOREGROUND=134 - # Show .NET version only when in a .NET project subdirectory. - typeset -g POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_DOTNET_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #####################[ php_version: php version (https://www.php.net/) ]###################### - # PHP version color. - typeset -g POWERLEVEL9K_PHP_VERSION_FOREGROUND=99 - # Show PHP version only when in a PHP project subdirectory. - typeset -g POWERLEVEL9K_PHP_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_PHP_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ laravel_version: laravel php framework version (https://laravel.com/) ]########### - # Laravel version color. - typeset -g POWERLEVEL9K_LARAVEL_VERSION_FOREGROUND=161 - # Custom icon. - # typeset -g POWERLEVEL9K_LARAVEL_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ####################[ java_version: java version (https://www.java.com/) ]#################### - # Java version color. - typeset -g POWERLEVEL9K_JAVA_VERSION_FOREGROUND=32 - # Show java version only when in a java project subdirectory. - typeset -g POWERLEVEL9K_JAVA_VERSION_PROJECT_ONLY=true - # Show brief version. - typeset -g POWERLEVEL9K_JAVA_VERSION_FULL=false - # Custom icon. - # typeset -g POWERLEVEL9K_JAVA_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###[ package: name@version from package.json (https://docs.npmjs.com/files/package.json) ]#### - # Package color. - typeset -g POWERLEVEL9K_PACKAGE_FOREGROUND=117 - # Package format. The following parameters are available within the expansion. - # - # - P9K_PACKAGE_NAME The value of `name` field in package.json. - # - P9K_PACKAGE_VERSION The value of `version` field in package.json. - # - # typeset -g POWERLEVEL9K_PACKAGE_CONTENT_EXPANSION='${P9K_PACKAGE_NAME//\%/%%}@${P9K_PACKAGE_VERSION//\%/%%}' - # Custom icon. - # typeset -g POWERLEVEL9K_PACKAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]############## - # Rbenv color. - typeset -g POWERLEVEL9K_RBENV_FOREGROUND=168 - # Hide ruby version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_RBENV_SOURCES=(shell local global) - # If set to false, hide ruby version if it's the same as global: - # $(rbenv version-name) == $(rbenv global). - typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide ruby version if it's equal to "system". - typeset -g POWERLEVEL9K_RBENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######################[ rvm: ruby version from rvm (https://rvm.io) ]######################## - # Rvm color. - typeset -g POWERLEVEL9K_RVM_FOREGROUND=168 - # Don't show @gemset at the end. - typeset -g POWERLEVEL9K_RVM_SHOW_GEMSET=false - # Don't show ruby- at the front. - typeset -g POWERLEVEL9K_RVM_SHOW_PREFIX=false - # Custom icon. - # typeset -g POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ fvm: flutter version management (https://github.com/leoafarias/fvm) ]############ - # Fvm color. - typeset -g POWERLEVEL9K_FVM_FOREGROUND=38 - # Custom icon. - # typeset -g POWERLEVEL9K_FVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ luaenv: lua version from luaenv (https://github.com/cehoffman/luaenv) ]########### - # Lua color. - typeset -g POWERLEVEL9K_LUAENV_FOREGROUND=32 - # Hide lua version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_LUAENV_SOURCES=(shell local global) - # If set to false, hide lua version if it's the same as global: - # $(luaenv version-name) == $(luaenv global). - typeset -g POWERLEVEL9K_LUAENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide lua version if it's equal to "system". - typeset -g POWERLEVEL9K_LUAENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_LUAENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ jenv: java version from jenv (https://github.com/jenv/jenv) ]################ - # Java color. - typeset -g POWERLEVEL9K_JENV_FOREGROUND=32 - # Hide java version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_JENV_SOURCES=(shell local global) - # If set to false, hide java version if it's the same as global: - # $(jenv version-name) == $(jenv global). - typeset -g POWERLEVEL9K_JENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide java version if it's equal to "system". - typeset -g POWERLEVEL9K_JENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_JENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ plenv: perl version from plenv (https://github.com/tokuhirom/plenv) ]############ - # Perl color. - typeset -g POWERLEVEL9K_PLENV_FOREGROUND=67 - # Hide perl version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PLENV_SOURCES=(shell local global) - # If set to false, hide perl version if it's the same as global: - # $(plenv version-name) == $(plenv global). - typeset -g POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide perl version if it's equal to "system". - typeset -g POWERLEVEL9K_PLENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ############[ phpenv: php version from phpenv (https://github.com/phpenv/phpenv) ]############ - # PHP color. - typeset -g POWERLEVEL9K_PHPENV_FOREGROUND=99 - # Hide php version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PHPENV_SOURCES=(shell local global) - # If set to false, hide php version if it's the same as global: - # $(phpenv version-name) == $(phpenv global). - typeset -g POWERLEVEL9K_PHPENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide php version if it's equal to "system". - typeset -g POWERLEVEL9K_PHPENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]########### - # Haskell color. - typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=172 - # Hide haskell version if it doesn't come from one of these sources. - # - # shell: version is set by STACK_YAML - # local: version is set by stack.yaml up the directory tree - # global: version is set by the implicit global project (~/.stack/global-project/stack.yaml) - typeset -g POWERLEVEL9K_HASKELL_STACK_SOURCES=(shell local) - # If set to false, hide haskell version if it's the same as in the implicit global project. - typeset -g POWERLEVEL9K_HASKELL_STACK_ALWAYS_SHOW=true - # Custom icon. - # typeset -g POWERLEVEL9K_HASKELL_STACK_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # Example of a user-defined prompt segment. Function prompt_example will be called on every - # prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or - # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and orange text greeting the user. - # - # Type `p10k help segment` for documentation and a more sophisticated example. - function prompt_watson() { - local watson_status=$(watson status) - local noproject="No project started." - if [ "$watson_status" != "$noproject" ]; then - p10k segment -i "祥" -f yellow -t "$(echo $watson_status | awk '{print $2,$3}')" - else - p10k segment -i "⏾" -f red -t "" - fi - } - - function prompt_triton() { - local triton_profile=$(echo $TRITON_PROFILE) - if [ "$triton_profile" != "" ]; then - p10k segment -f yellow -t "$(echo "✚" "$triton_profile")" - fi - } - - # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt - # when accepting a command line. Supported values: - # - # - off: Don't change prompt when accepting a command line. - # - always: Trim down prompt when accepting a command line. - # - same-dir: Trim down prompt when accepting a command line unless this is the first command - # typed after changing current working directory. - typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always - - # Instant prompt mode. - # - # - off: Disable instant prompt. Choose this if you've tried instant prompt and found - # it incompatible with your zsh configuration files. - # - quiet: Enable instant prompt and don't print warnings when detecting console output - # during zsh initialization. Choose this if you've read and understood - # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt. - # - verbose: Enable instant prompt and print a warning when detecting console output during - # zsh initialization. Choose this if you've never tried instant prompt, haven't - # seen the warning, or if you are unsure what this all means. - typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose - - # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. - # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload - # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you - # really need it. - typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=false - - # If p10k is already loaded, reload configuration. - # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true. - (( ! $+functions[p10k] )) || p10k reload -} - -# Tell `p10k configure` which file it should overwrite. -typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a} - -(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} -'builtin' 'unset' 'p10k_config_opts' diff --git a/pkgs/_sources/generated.nix b/pkgs/_sources/generated.nix index d923f214..d11baea1 100644 --- a/pkgs/_sources/generated.nix +++ b/pkgs/_sources/generated.nix @@ -4,17 +4,6 @@ fetchurl, fetchFromGitHub, }: { - F-Sy-H = { - pname = "F-Sy-H"; - version = "899f68b52b6b86a36cd8178eb0e9782d4aeda714"; - src = fetchFromGitHub { - owner = "z-shell"; - repo = "F-Sy-H"; - rev = "899f68b52b6b86a36cd8178eb0e9782d4aeda714"; - fetchSubmodules = false; - sha256 = "sha256-zhaXjrNL0amxexbZm4Kr5Y/feq1+2zW0O6eo9iZhmi0="; - }; - }; blesh-nvfetcher = { pname = "blesh-nvfetcher"; version = "10aa9b4fe47fc07ccdc9d5ba35f1417fdb614d41"; @@ -50,28 +39,6 @@ sha256 = "sha256-GqPuYscLhkR5E2HnSFV4R48hCWvtM3C++3zlJhiK/aw="; }; }; - ohmyzsh = { - pname = "ohmyzsh"; - version = "b602e0a066d8c98e8c02201ad16c764447fd8531"; - src = fetchFromGitHub { - owner = "ohmyzsh"; - repo = "ohmyzsh"; - rev = "b602e0a066d8c98e8c02201ad16c764447fd8531"; - fetchSubmodules = false; - sha256 = "sha256-O4thanOQpX/DHPdfW2p/RUXzIPj6GUp9EnKJfkh7yQM="; - }; - }; - powerlevel10k = { - pname = "powerlevel10k"; - version = "a30145b0f82d06770e924e9eac064ed223a94e6b"; - src = fetchFromGitHub { - owner = "romkatv"; - repo = "powerlevel10k"; - rev = "a30145b0f82d06770e924e9eac064ed223a94e6b"; - fetchSubmodules = false; - sha256 = "sha256-jnZXLrywUrJgTX1tFpoNH94r/jcGl2P6R7DoedluHxQ="; - }; - }; rnix-lsp-nvfetcher = { pname = "rnix-lsp-nvfetcher"; version = "95d40673fe43642e2e1144341e86d0036abd95d9"; @@ -149,15 +116,4 @@ sha256 = "sha256-5KqQaaKwW14F/rVWGQ0qBUU0b3Z+v/Mq8lnSwqLtT7U="; }; }; - zsh-nix-shell = { - pname = "zsh-nix-shell"; - version = "af6f8a266ea1875b9a3e86e14796cadbe1cfbf08"; - src = fetchFromGitHub { - owner = "chisui"; - repo = "zsh-nix-shell"; - rev = "af6f8a266ea1875b9a3e86e14796cadbe1cfbf08"; - fetchSubmodules = false; - sha256 = "sha256-BjgMhILEL/qdgfno4LR64LSB8n9pC9R+gG7IQWwgyfQ="; - }; - }; } diff --git a/pkgs/sources.toml b/pkgs/sources.toml index cfb07131..ac9d5e1a 100644 --- a/pkgs/sources.toml +++ b/pkgs/sources.toml @@ -3,22 +3,6 @@ src.git = "https://github.com/mlvzk/manix" fetch.github = "mlvzk/manix" -[ohmyzsh] -src.git = "https://github.com/ohmyzsh/ohmyzsh" -fetch.github = "ohmyzsh/ohmyzsh" - -[powerlevel10k] -src.git = "https://github.com/romkatv/powerlevel10k" -fetch.github = "romkatv/powerlevel10k" - -[F-Sy-H] -src.git = "https://github.com/z-shell/F-Sy-H" -fetch.github = "z-shell/F-Sy-H" - -[zsh-nix-shell] -src.git = "https://github.com/chisui/zsh-nix-shell" -fetch.github = "chisui/zsh-nix-shell" - [rnix-lsp-nvfetcher] src.git = "https://github.com/nix-community/rnix-lsp" fetch.github = "nix-community/rnix-lsp" diff --git a/modules/terminal-life/zsh/base16.zsh b/profiles/base-user/.local/share/scripts/base16.sh similarity index 69% rename from modules/terminal-life/zsh/base16.zsh rename to profiles/base-user/.local/share/scripts/base16.sh index 3686b98d..ee33516b 100644 --- a/modules/terminal-life/zsh/base16.zsh +++ b/profiles/base-user/.local/share/scripts/base16.sh @@ -3,28 +3,28 @@ # Base16 Shell template by Chris Kempson (http://chriskempson.com) # Burn scheme by Benjamin Bädorf -color00="1a/18/1a" # Base 00 - Black -color01="f8/5e/84" # Base 08 - Red -color02="9e/cd/6f" # Base 0B - Green -color03="e5/c4/63" # Base 0A - Yellow -color04="7a/cc/d7" # Base 0D - Blue -color05="ab/9d/f2" # Base 0E - Magenta -color06="ef/90/62" # Base 0C - Cyan -color07="e3/e1/e4" # Base 05 - White -color08="94/94/94" # Base 03 - Bright Black -color09=$color01 # Base 08 - Bright Red -color10=$color02 # Base 0B - Bright Green -color11=$color03 # Base 0A - Bright Yellow -color12=$color04 # Base 0D - Bright Blue -color13=$color05 # Base 0E - Bright Magenta -color14=$color06 # Base 0C - Bright Cyan -color15="ff/5f/5f" # Base 07 - Bright White -color16="df/59/23" # Base 09 -color17="d7/00/00" # Base 0F -color18="2d/2a/2e" # Base 01 -color19="30/30/30" # Base 02 -color20="d3/d1/d4" # Base 04 -color21="30/30/30" # Base 06 +color00="1a/18/1a" # Base 00 - Black +color01="f8/5e/84" # Base 08 - Red +color02="9e/cd/6f" # Base 0B - Green +color03="e5/c4/63" # Base 0A - Yellow +color04="7a/cc/d7" # Base 0D - Blue +color05="ab/9d/f2" # Base 0E - Magenta +color06="ef/90/62" # Base 0C - Cyan +color07="e3/e1/e4" # Base 05 - White +color08="94/94/94" # Base 03 - Bright Black +color09=$color01 # Base 08 - Bright Red +color10=$color02 # Base 0B - Bright Green +color11=$color03 # Base 0A - Bright Yellow +color12=$color04 # Base 0D - Bright Blue +color13=$color05 # Base 0E - Bright Magenta +color14=$color06 # Base 0C - Bright Cyan +color15="ff/5f/5f" # Base 07 - Bright White +color16="df/59/23" # Base 09 +color17="d7/00/00" # Base 0F +color18="2d/2a/2e" # Base 01 +color19="30/30/30" # Base 02 +color20="d3/d1/d4" # Base 04 +color21="30/30/30" # Base 06 color_foreground="e3/e1/e4" # Base 05 color_background="1a/18/1a" # Base 00 @@ -50,16 +50,16 @@ else fi # 16 color space -put_template 0 $color00 -put_template 1 $color01 -put_template 2 $color02 -put_template 3 $color03 -put_template 4 $color04 -put_template 5 $color05 -put_template 6 $color06 -put_template 7 $color07 -put_template 8 $color08 -put_template 9 $color09 +put_template 0 $color00 +put_template 1 $color01 +put_template 2 $color02 +put_template 3 $color03 +put_template 4 $color04 +put_template 5 $color05 +put_template 6 $color06 +put_template 7 $color07 +put_template 8 $color08 +put_template 9 $color09 put_template 10 $color10 put_template 11 $color11 put_template 12 $color12 diff --git a/profiles/base-user/home.nix b/profiles/base-user/home.nix index 3d801baa..1da6ace5 100644 --- a/profiles/base-user/home.nix +++ b/profiles/base-user/home.nix @@ -71,6 +71,8 @@ in { # docker run -it --name caddy-json-schema registry.greenbaum.cloud/gc/caddy-l4:2.5.2 caddy json-schema -output /srv/caddy_schema.json xdg.dataFile."nvim/json-schemas/caddy_schema.json".source = .local/share/nvim/json-schemas/caddy_schema.json; xdg.dataFile."nvim/templates/.keep".text = ""; + xdg.dataFile."scripts/.keep".text = ""; + xdg.dataFile."scripts/base16.sh".source = .local/share/scripts/base16.sh; xdg.dataFile."shell.nix.tmpl" = { text = '' let diff --git a/tests/first-test.nix b/tests/first-test.nix index a1da457d..248dd638 100644 --- a/tests/first-test.nix +++ b/tests/first-test.nix @@ -8,7 +8,7 @@ nodes.test-machine = {suites ? null, ...}: { imports = suites.iso; - home-manager.users.pub-solar.programs.zsh.shellAliases = { + home-manager.users.pub-solar.programs.bash.shellAliases = { test-x11 = "glinfo | tee /tmp/test-x11.out && touch /tmp/test-x11-exit-ok"; test-wayland = "wayland-info | tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok"; }; From b5ff01f703cc620d9c5734270e1337969d55ece0 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 16 May 2023 15:04:29 +0200 Subject: [PATCH 12/46] sway: fix sway-launcher whence is a zsh builtin, use bash's compgen function to get a list of available commands --- pkgs/sway-launcher.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/sway-launcher.nix b/pkgs/sway-launcher.nix index 1ace27b5..abc7f443 100644 --- a/pkgs/sway-launcher.nix +++ b/pkgs/sway-launcher.nix @@ -11,7 +11,7 @@ with self; '' # Get shell command list # This may include the occasional non-executable file - command_list=$({ whence -wm '*' | sed 's/:[^:]*$//' }) + command_list=$({ compgen -c | sed 's/:[^:]*$//'; }) # read existing command history if [ -f "$HIST_FILE" ]; then From 97cc2f3fa84ce384f8d79fa2320443d03f8f6c17 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Thu, 18 May 2023 00:00:56 +0200 Subject: [PATCH 13/46] starship: more icons for git status --- modules/terminal-life/starship.toml.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/terminal-life/starship.toml.nix b/modules/terminal-life/starship.toml.nix index ed10ae61..09c845ab 100644 --- a/modules/terminal-life/starship.toml.nix +++ b/modules/terminal-life/starship.toml.nix @@ -84,6 +84,7 @@ git_branch = { style = "#E5C463"; format = "[](fg:black bg:$style)[ $symbol$branch](fg:black bg:$style)[](fg:$style)"; + symbol = " "; }; git_commit = { @@ -104,16 +105,16 @@ git_status = { style = "#E5C463"; format = "([ ](bg:$style fg:black)$conflicted$staged$modified$renamed$deleted$untracked$stashed$ahead_behind[](fg:$style))"; - conflicted = "[ ](bold fg:88 bg:#E5C463)[  \${count} ](fg:black bg:#E5C463)"; + conflicted = "[ ](bold fg:88 bg:#E5C463)[  \${count} ](fg:black bg:#E5C463)"; staged = "[ $count ](fg:black bg:#E5C463)"; - modified = "[ \${count} ](fg:black bg:#E5C463)"; + modified = "[ \${count} ](fg:black bg:#E5C463)"; renamed = "[ \${count} ](fg:black bg:#E5C463)"; deleted = "[ \${count} ](fg:black bg:#E5C463)"; untracked = "[?\${count} ](fg:black bg:#E5C463)"; stashed = "[ \${count} ](fg:black bg:#E5C463)"; ahead = "[ \${count} ](fg:#523333 bg:#E5C463)"; behind = "[ \${count} ](fg:black bg:#E5C463)"; - diverged = "[ ](fg:88 bg:#E5C463)[ נּ ](fg:black bg:#E5C463)[ \${ahead_count} ](fg:black bg:#E5C463)[ \${behind_count} ](fg:black bg:#E5C463)"; + diverged = "[ ](fg:88 bg:#E5C463)[  ](fg:black bg:#E5C463)[ \${ahead_count} ](fg:black bg:#E5C463)[ \${behind_count} ](fg:black bg:#E5C463)"; }; golang = { From 7dbe853f3a1090b590a479bf96922e93ed474679 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Wed, 31 May 2023 20:54:31 +0200 Subject: [PATCH 14/46] ble.sh: use fzf ctrl-r history, ble.sh built-in completion Fix selected ble-face region_input Fix jump words limited by space (uword) --- modules/terminal-life/bash/default.nix | 11 +++++++++-- modules/terminal-life/fzf/default.nix | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index 1370f04a..fa535348 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -18,6 +18,9 @@ in { # Run when initializing an interactive shell initExtra = '' + # Use fzf's CTRL-R history widget + source ${pkgs.fzf}/share/fzf/key-bindings.bash + # If a command is not found, show me where it is source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh @@ -37,9 +40,11 @@ in { # Meta (Alt) + Backspace to delete a word ble-bind -m 'vi_imap' -f 'M-C-?' 'kill-backward-cword' # Meta (Alt) + p to jump one word backwards - ble-bind -m 'vi_imap' -f M-p '@nomarked backward-cword' + ble-bind -m 'vi_imap' -f M-p '@nomarked backward-uword' + ble-bind -m 'vi_imap' -f M-left '@nomarked backward-uword' # Meta (Alt) + n to jump one word forwards - ble-bind -m 'vi_imap' -f M-n '@nomarked forward-cword' + ble-bind -m 'vi_imap' -f M-n '@nomarked forward-uword' + ble-bind -m 'vi_imap' -f M-right '@nomarked forward-uword' # Arrow up and Ctrl + p searches history for entered input ble-bind -m 'vi_imap' -f up 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' ble-bind -m 'vi_imap' -f C-p 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' @@ -47,6 +52,8 @@ in { ble-bind -m 'vi_imap' -f down 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' ble-bind -m 'vi_imap' -f C-n 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' + ble-face region_insert='fg=black,bg=navy' + function my/complete-load-hook { bleopt complete_auto_delay=250 } diff --git a/modules/terminal-life/fzf/default.nix b/modules/terminal-life/fzf/default.nix index 372e768d..88e60592 100644 --- a/modules/terminal-life/fzf/default.nix +++ b/modules/terminal-life/fzf/default.nix @@ -10,5 +10,8 @@ "--color=fg:#d3d1d4,header:#7accd7,info:#e5c463,pointer:#ef9062" "--color=marker:#ef9062,fg+:#303030,prompt:#e5c463,hl+:#7accd7" ]; - enableBashIntegration = true; + # Use ble.sh for completions, see + # modules/terminal-life/bash/default.nix -> bleopt complete_menu_style=desc + # and https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion + enableBashIntegration = false; } From 97239d1fbb62fb312440b5c9d7d5f087601da328 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Thu, 18 May 2023 00:04:39 +0200 Subject: [PATCH 15/46] inputs: switch to nixos-23.05 --- flake.lock | 77 ++++++------------------ flake.nix | 4 +- modules/audio/default.nix | 47 +++++++++------ modules/audio/pipewire-pulse.conf.json | 36 ----------- modules/core/packages.nix | 1 + modules/core/services.nix | 2 +- modules/graphical/default.nix | 2 +- profiles/base-user/session-variables.nix | 2 +- 8 files changed, 54 insertions(+), 117 deletions(-) delete mode 100644 modules/audio/pipewire-pulse.conf.json diff --git a/flake.lock b/flake.lock index 43e6b1d0..dfb93ccb 100644 --- a/flake.lock +++ b/flake.lock @@ -30,11 +30,11 @@ ] }, "locked": { - "lastModified": 1683754942, - "narHash": "sha256-L+Bj8EL4XLmODRIuOkk9sI6FDECVzK+C8jeZFv7q6eY=", + "lastModified": 1686307493, + "narHash": "sha256-R4VEFnDn7nRmNxAu1LwNbjns5DPM8IBsvnrWmZ8ymPs=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "252541bd05a7f55f3704a3d014ad1badc1e3360d", + "rev": "7c16d31383a90e0e72ace0c35d2d66a18f90fb4f", "type": "github" }, "original": { @@ -54,11 +54,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1683779844, - "narHash": "sha256-sIeOU0GsCeQEn5TpqE/jFRN4EGsPsjqVRsPdrzIDABM=", + "lastModified": 1685948350, + "narHash": "sha256-1FldJ059so0X/rScdbIiOlQbjjSNCCTdj2cUr5pHU4A=", "owner": "serokell", "repo": "deploy-rs", - "rev": "c80189917086e43d49eece2bd86f56813500a0eb", + "rev": "65211db63ba1199f09b4c9f27e5eba5ec50d76ac", "type": "github" }, "original": { @@ -201,52 +201,30 @@ "inputs": { "nixpkgs": [ "nixos" - ], - "utils": "utils_2" - }, - "locked": { - "lastModified": 1681092193, - "narHash": "sha256-JerCqqOqbT2tBnXQW4EqwFl0hHnuZp21rIQ6lu/N4rI=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "f9edbedaf015013eb35f8caacbe0c9666bbc16af", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "release-22.11", - "repo": "home-manager", - "type": "github" - } - }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "agenix", - "nixpkgs" ] }, "locked": { - "lastModified": 1682203081, - "narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=", + "lastModified": 1686582345, + "narHash": "sha256-z4wLfa++k1d7Y/tQpQYub1D0K0OO9Wju0FZ8U53KUE0=", "owner": "nix-community", "repo": "home-manager", - "rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1", + "rev": "e753d659c64c7d158433d87ef7d6151ca1d1817a", "type": "github" }, "original": { "owner": "nix-community", + "ref": "release-23.05", "repo": "home-manager", "type": "github" } }, "latest": { "locked": { - "lastModified": 1683408522, - "narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=", + "lastModified": 1686501370, + "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7", + "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", "type": "github" }, "original": { @@ -258,27 +236,27 @@ }, "nixos": { "locked": { - "lastModified": 1683928319, - "narHash": "sha256-maz0DRKixJVcNRMiAMWlJniiF8IuQ+WbfmlJJ8D+jfM=", + "lastModified": 1686431482, + "narHash": "sha256-oPVQ/0YP7yC2ztNsxvWLrV+f0NQ2QAwxbrZ+bgGydEM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9656e85a15a0fe67847ee8cdb99a20d8df499962", + "rev": "d3bb401dcfc5a46ce51cdfb5762e70cc75d082d2", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-22.11", + "ref": "nixos-23.05", "repo": "nixpkgs", "type": "github" } }, "nixos-hardware": { "locked": { - "lastModified": 1683965003, - "narHash": "sha256-DrzSdOnLv/yFBvS2FqmwBA2xIbN/Lny/WlxHyoLR9zE=", + "lastModified": 1686452266, + "narHash": "sha256-zLKiX0iu6jZFeZDpR1gE6fNyMr8eiM8GLnj9SoUCjFs=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "81cd886719e10d4822b2a6caa96e95d56cc915ef", + "rev": "2a807ad6e8dc458db08588b78cc3c0f0ec4ff321", "type": "github" }, "original": { @@ -330,21 +308,6 @@ "repo": "flake-utils", "type": "github" } - }, - "utils_2": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index dd7ed53b..7d92a327 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,7 @@ inputs = { # Track channels with commits tested and built by hydra - nixos.url = "github:nixos/nixpkgs/nixos-22.11"; + nixos.url = "github:nixos/nixpkgs/nixos-23.05"; latest.url = "github:nixos/nixpkgs/nixos-unstable"; flake-compat.url = "github:edolstra/flake-compat"; @@ -19,7 +19,7 @@ digga.inputs.darwin.follows = "darwin"; digga.inputs.flake-compat.follows = "flake-compat"; - home.url = "github:nix-community/home-manager/release-22.11"; + home.url = "github:nix-community/home-manager/release-23.05"; home.inputs.nixpkgs.follows = "nixos"; darwin.url = "github:LnL7/nix-darwin"; diff --git a/modules/audio/default.nix b/modules/audio/default.nix index 9a69301b..8ff6f2e6 100644 --- a/modules/audio/default.nix +++ b/modules/audio/default.nix @@ -66,31 +66,31 @@ in { # rtkit is optional but recommended security.rtkit.enable = true; - # Enable sound using pipewire-pulse + # Enable sound using pipewire-pulse, default config: + # https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/daemon/pipewire.conf.in services.pipewire = { enable = true; alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; - - config.pipewire = { - context.default.clock = { - allowed-rates = [44100 48000 88200 96000]; - rate = 44100; - }; - }; - config.pipewire-pulse = builtins.fromJSON (builtins.readFile ./pipewire-pulse.conf.json); }; - # Bluetooth configuration using wireplumber - # https://nixos.wiki/wiki/PipeWire#Bluetooth_Configuration - environment.etc = mkIf cfg.bluetooth.enable { - "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' - bluez_monitor.properties = { - ["bluez5.enable-sbc-xq"] = true, - ["bluez5.enable-msbc"] = true, - ["bluez5.enable-hw-volume"] = true, - ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]" + # Make pulseaudio listen on port 4713 for mopidy, extending the default + # config: https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/daemon/pipewire-pulse.conf.in + environment.etc = mkIf cfg.mopidy.enable { + "pipewire/pipewire-pulse.conf.d/99-custom.conf".text = '' + { + "context.modules": [ + { + "name": "libpipewire-module-protocol-pulse", + "args": { + "server.address": ["unix:native", "tcp:4713"], + "vm.overrides": { + "pulse.min.quantum": "1024/48000" + } + } + } + ] } ''; }; @@ -98,10 +98,19 @@ in { # Enable bluetooth hardware.bluetooth = mkIf cfg.bluetooth.enable { enable = true; - # disable useless SIM Access Profile plugin + # Disable bluetooth on startup to save battery + powerOnBoot = false; + # Disable useless SIM Access Profile plugin disabledPlugins = [ "sap" ]; + settings = { + General = { + # Enables experimental features and interfaces. + # Makes BlueZ Battery Provider available + Experimental = true; + }; + }; }; services.blueman.enable = mkIf cfg.bluetooth.enable true; diff --git a/modules/audio/pipewire-pulse.conf.json b/modules/audio/pipewire-pulse.conf.json deleted file mode 100644 index 97bedaaa..00000000 --- a/modules/audio/pipewire-pulse.conf.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "context.properties": {}, - "context.spa-libs": { - "audio.convert.*": "audioconvert/libspa-audioconvert", - "support.*": "support/libspa-support" - }, - "context.modules": [ - { - "name": "libpipewire-module-rtkit", - "args": {}, - "flags": ["ifexists", "nofail"] - }, - { - "name": "libpipewire-module-protocol-native" - }, - { - "name": "libpipewire-module-client-node" - }, - { - "name": "libpipewire-module-adapter" - }, - { - "name": "libpipewire-module-metadata" - }, - { - "name": "libpipewire-module-protocol-pulse", - "args": { - "server.address": ["unix:native", "tcp:4713"], - "vm.overrides": { - "pulse.min.quantum": "1024/48000" - } - } - } - ], - "stream.properties": {} -} diff --git a/modules/core/packages.nix b/modules/core/packages.nix index f0a35d17..807b282c 100644 --- a/modules/core/packages.nix +++ b/modules/core/packages.nix @@ -24,6 +24,7 @@ in { openssh curl htop + btop lsof psmisc file diff --git a/modules/core/services.nix b/modules/core/services.nix index 2d53dd74..475945e6 100644 --- a/modules/core/services.nix +++ b/modules/core/services.nix @@ -10,7 +10,7 @@ # If you don't want the host to have SSH actually opened up to the net, # set `services.openssh.openFirewall` to false in your config. openFirewall = lib.mkDefault true; - passwordAuthentication = lib.mkDefault false; + settings.PasswordAuthentication = lib.mkDefault false; }; # Service that makes Out of Memory Killer more effective diff --git a/modules/graphical/default.nix b/modules/graphical/default.nix index 39f6be5d..46812e92 100644 --- a/modules/graphical/default.nix +++ b/modules/graphical/default.nix @@ -66,7 +66,7 @@ in { services.getty.autologinUser = mkIf cfg.autologin.enable (mkForce "${psCfg.user.name}"); - qt5 = { + qt = { enable = true; platformTheme = "gtk2"; style = "gtk2"; diff --git a/profiles/base-user/session-variables.nix b/profiles/base-user/session-variables.nix index fb816046..d21a9f80 100644 --- a/profiles/base-user/session-variables.nix +++ b/profiles/base-user/session-variables.nix @@ -85,7 +85,7 @@ VUEDX_TELEMETRY = "off"; # FZF shell history widget default colors - FZF_DEFAULT_OPTS = "--color=bg+:#2d2a2e,bg:#1a181a,spinner:#ef9062,hl:#7accd7 --color=fg:#d3d1d4,header:#7accd7,info:#e5c463,pointer:#ef9062 --color=marker:#ef9062,fg+:#d3d1d4,prompt:#e5c463,hl+:#7accd7"; + FZF_DEFAULT_OPTS = lib.mkForce "--color=bg+:#2d2a2e,bg:#1a181a,spinner:#ef9062,hl:#7accd7 --color=fg:#d3d1d4,header:#7accd7,info:#e5c463,pointer:#ef9062 --color=marker:#ef9062,fg+:#d3d1d4,prompt:#e5c463,hl+:#7accd7"; }; envListNames = lib.attrsets.mapAttrsToList (name: value: name) variables; From f4f67b3197a28a2c5dc6092fcbbec8bb5a83a29d Mon Sep 17 00:00:00 2001 From: teutat3s Date: Wed, 17 May 2023 23:56:46 +0200 Subject: [PATCH 16/46] chore: python3{9,10}Packages -> python3Packages - Apply treefmt --- modules/docker-ci-runner/default.nix | 19 +++-- modules/terminal-life/nvim/default.nix | 103 +++++++++++++------------ modules/virtualisation/default.nix | 2 +- pkgs/lgcl.nix | 3 +- pkgs/mopidy-jellyfin.nix | 13 ++-- pkgs/uhk-agent.nix | 3 +- 6 files changed, 75 insertions(+), 68 deletions(-) diff --git a/modules/docker-ci-runner/default.nix b/modules/docker-ci-runner/default.nix index 69decb0b..6a15f928 100644 --- a/modules/docker-ci-runner/default.nix +++ b/modules/docker-ci-runner/default.nix @@ -1,7 +1,11 @@ -{ lib, config, pkgs, self, ... }: - -with lib; -let +{ + lib, + config, + pkgs, + self, + ... +}: +with lib; let bootstrap = pkgs.writeScript "bootstrap.sh" '' #!/usr/bin/env bash @@ -40,8 +44,7 @@ let ''; psCfg = config.pub-solar; cfg = config.pub-solar.docker-ci-runner; -in -{ +in { options.pub-solar.docker-ci-runner = { enable = lib.mkEnableOption "Enables a docker container running a drone exec runner as unprivileged user."; @@ -88,7 +91,7 @@ in image = "debian"; autoStart = true; entrypoint = "bash"; - cmd = [ "/bootstrap.sh" ]; + cmd = ["/bootstrap.sh"]; volumes = [ "${cfg.runnerVarsFile}:/run/vars" @@ -98,7 +101,7 @@ in environment = cfg.runnerEnvironment; - extraOptions = lib.mkIf cfg.enableKvm [ "--device=/dev/kvm" ]; + extraOptions = lib.mkIf cfg.enableKvm ["--device=/dev/kvm"]; }; }; }; diff --git a/modules/terminal-life/nvim/default.nix b/modules/terminal-life/nvim/default.nix index e1bfd4e6..ba53ef49 100644 --- a/modules/terminal-life/nvim/default.nix +++ b/modules/terminal-life/nvim/default.nix @@ -34,7 +34,7 @@ in { nodePackages.vue-language-server nodePackages.vscode-langservers-extracted nodePackages.yaml-language-server - python39Packages.python-lsp-server + python3Packages.python-lsp-server python3Full solargraph rnix-lsp @@ -43,65 +43,66 @@ in { universal-ctags ]; - plugins = with pkgs.vimPlugins; [ ] - ++ lib.optionals (!cfg.lite) [ - nvim-cmp - cmp-nvim-lsp - cmp_luasnip - luasnip + plugins = with pkgs.vimPlugins; + [] + ++ lib.optionals (!cfg.lite) [ + nvim-cmp + cmp-nvim-lsp + cmp_luasnip + luasnip - lsp_extensions-nvim - nvim-lspconfig + lsp_extensions-nvim + nvim-lspconfig - instant-nvim-nvfetcher + instant-nvim-nvfetcher - ack-vim - vim-airline - editorconfig-vim - nnn-vim - quick-scope - suda-vim - syntastic - vim-gutentags - vim-vinegar - vim-workspace-nvfetcher + ack-vim + vim-airline + editorconfig-vim + nnn-vim + quick-scope + suda-vim + syntastic + vim-gutentags + vim-vinegar + vim-workspace-nvfetcher - sonokai - vim-hybrid-material - vim-airline-themes - vim-apprentice-nvfetcher + sonokai + vim-hybrid-material + vim-airline-themes + vim-apprentice-nvfetcher - fugitive - vim-gitgutter - vim-rhubarb - vimagit-nvfetcher + fugitive + vim-gitgutter + vim-rhubarb + vimagit-nvfetcher - fzf-vim - fzfWrapper - vim-highlightedyank + fzf-vim + fzfWrapper + vim-highlightedyank - vim-beautify-nvfetcher - vim-surround + vim-beautify-nvfetcher + vim-surround - vim-bufkill - vim-sensible + vim-bufkill + vim-sensible - ansible-vim - emmet-vim - rust-vim - vim-caddyfile-nvfetcher - vim-go - vim-javascript - vim-json - SchemaStore-nvim - vim-markdown - vim-nix - vim-nixhash - vim-ruby - vim-toml - vim-vue - yats-vim - ]; + ansible-vim + emmet-vim + rust-vim + vim-caddyfile-nvfetcher + vim-go + vim-javascript + vim-json + SchemaStore-nvim + vim-markdown + vim-nix + vim-nixhash + vim-ruby + vim-toml + vim-vue + yats-vim + ]; extraConfig = builtins.concatStringsSep "\n" [ '' diff --git a/modules/virtualisation/default.nix b/modules/virtualisation/default.nix index b4ce6a0c..3376014a 100644 --- a/modules/virtualisation/default.nix +++ b/modules/virtualisation/default.nix @@ -39,7 +39,7 @@ in { libvirt-glib qemu virt-manager - python38Packages.libvirt + python3Packages.libvirt gvfs edk2 OVMF diff --git a/pkgs/lgcl.nix b/pkgs/lgcl.nix index 235fbe5e..73f91124 100644 --- a/pkgs/lgcl.nix +++ b/pkgs/lgcl.nix @@ -1,4 +1,5 @@ -self: with self; let +self: +with self; let looking-glass-client = self.looking-glass-client.overrideAttrs (old: { meta.platforms = ["x86_64-linux" "aarch64-linux"]; }); diff --git a/pkgs/mopidy-jellyfin.nix b/pkgs/mopidy-jellyfin.nix index ec0d64a5..b507ba17 100644 --- a/pkgs/mopidy-jellyfin.nix +++ b/pkgs/mopidy-jellyfin.nix @@ -1,19 +1,20 @@ -self: with self; let - websocket-client = python39.pkgs.buildPythonPackage rec { +self: +with self; let + websocket-client = python3.pkgs.buildPythonPackage rec { pname = "websocket-client"; version = "1.2.1"; doCheck = false; - src = python39.pkgs.fetchPypi { + src = python3.pkgs.fetchPypi { inherit pname version; sha256 = "sha256-jftxXYqZL1cS//jIQ62ulOIrIqmbLF5rDsShqYHMTg0="; }; }; in - python39.pkgs.buildPythonPackage rec { + python3.pkgs.buildPythonPackage rec { pname = "Mopidy-Jellyfin"; version = "1.0.2"; doCheck = false; - propagatedBuildInputs = with python39.pkgs; [ + propagatedBuildInputs = with python3.pkgs; [ unidecode websocket-client requests @@ -21,7 +22,7 @@ in pykka mopidy ]; - src = python39.pkgs.fetchPypi { + src = python3.pkgs.fetchPypi { inherit pname version; sha256 = "sha256-5XimIIQSpvNyQbSOFtSTkA0jhA0V68BbyQEQNnov+0g="; }; diff --git a/pkgs/uhk-agent.nix b/pkgs/uhk-agent.nix index bccf06db..1293fc4b 100644 --- a/pkgs/uhk-agent.nix +++ b/pkgs/uhk-agent.nix @@ -1,4 +1,5 @@ -self: with self; let +self: +with self; let uhk-agent-bin = stdenv.mkDerivation rec { pname = "uhk-agent-bin"; version = "1.5.14"; From a3ad8e57f81d37aef00b5673d278266917591474 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 13 May 2023 18:43:12 +0200 Subject: [PATCH 17/46] deploy-rs: use nixpkgs version, avoid rebuilding https://github.com/serokell/deploy-rs/pull/207 https://github.com/serokell/deploy-rs/issues/163 --- flake.nix | 25 +++++++++++++++++++++++-- shell/devos.nix | 2 +- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 7d92a327..d7f45cbe 100644 --- a/flake.nix +++ b/flake.nix @@ -61,7 +61,17 @@ imports = [(digga.lib.importOverlays ./overlays)]; overlays = []; }; - latest = {}; + latest = { + overlays = [ + deploy.overlay + (self: super: { + deploy-rs = { + inherit (inputs.latest.legacyPackages.x86_64-linux) deploy-rs; + lib = super.deploy-rs.lib; + }; + }) + ]; + }; }; lib = import ./lib {lib = digga.lib // nixos.lib;}; @@ -149,6 +159,17 @@ homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; - deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations {}; + deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { + #example = { + # hostname = "example.com:22"; + # sshUser = "bartender"; + # fastConnect = true; + # profilesOrder = ["system" "direnv"]; + # profiles.direnv = { + # user = "bartender"; + # path = self.channels.latest.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.bartender; + # }; + #}; + }; }; } diff --git a/shell/devos.nix b/shell/devos.nix index fdbcee2e..3a61ec3c 100644 --- a/shell/devos.nix +++ b/shell/devos.nix @@ -59,6 +59,6 @@ in { ] ++ lib.optionals (pkgs.stdenv.hostPlatform.isLinux && !pkgs.stdenv.buildPlatform.isDarwin) [ (devos nixos-generators) - (devos deploy-rs) + (devos deploy-rs.deploy-rs) ]; } From 5131912195d51431e1d3d7e99bab04db7b6a25cc Mon Sep 17 00:00:00 2001 From: teutat3s Date: Wed, 31 May 2023 20:46:44 +0200 Subject: [PATCH 18/46] overrides: use version from nixos-23.05 --- overlays/overrides.nix | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/overlays/overrides.nix b/overlays/overrides.nix index 839426d0..7bea8fc0 100644 --- a/overlays/overrides.nix +++ b/overlays/overrides.nix @@ -3,20 +3,6 @@ channels: final: prev: { inherit (channels.latest) - cachix - dhall - discord - element-desktop - rage - nix-index - qutebrowser - alejandra - signal-desktop - starship - deploy-rs - tdesktop - arduino - arduino-cli ; haskellPackages = From f964dd38033ba7e0c92b206f854d1d18bb778681 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Wed, 31 May 2023 20:59:02 +0200 Subject: [PATCH 19/46] flake: use nixos-23.05 Use overlay for nvfetcher for recent fixes from master branch --- flake.lock | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 14 ++++++++----- 2 files changed, 68 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index dfb93ccb..f1d08d5c 100644 --- a/flake.lock +++ b/flake.lock @@ -197,6 +197,24 @@ "type": "github" } }, + "flake-utils_3": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home": { "inputs": { "nixpkgs": [ @@ -281,6 +299,30 @@ "type": "github" } }, + "nvfetcher": { + "inputs": { + "flake-compat": [ + "flake-compat" + ], + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "nixos" + ] + }, + "locked": { + "lastModified": 1685158767, + "narHash": "sha256-vgyu3jsnGDDAEYg4y/oFk2IaTCXUlce0ZaLtQprhmFk=", + "owner": "berberman", + "repo": "nvfetcher", + "rev": "c5ae2cb436a04f4590306589e71638d023a33bd4", + "type": "github" + }, + "original": { + "owner": "berberman", + "repo": "nvfetcher", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", @@ -291,7 +333,23 @@ "home": "home", "latest": "latest", "nixos": "nixos", - "nixos-hardware": "nixos-hardware" + "nixos-hardware": "nixos-hardware", + "nvfetcher": "nvfetcher" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } }, "utils": { diff --git a/flake.nix b/flake.nix index d7f45cbe..868ee558 100644 --- a/flake.nix +++ b/flake.nix @@ -34,6 +34,10 @@ agenix.inputs.darwin.follows = "darwin"; nixos-hardware.url = "github:nixos/nixos-hardware"; + + nvfetcher.url = "github:berberman/nvfetcher"; + nvfetcher.inputs.nixpkgs.follows = "nixos"; + nvfetcher.inputs.flake-compat.follows = "flake-compat"; }; outputs = { @@ -44,6 +48,7 @@ nixos-hardware, agenix, deploy, + nvfetcher, ... } @ inputs: digga.lib.mkFlake @@ -59,19 +64,17 @@ channels = { nixos = { imports = [(digga.lib.importOverlays ./overlays)]; - overlays = []; - }; - latest = { overlays = [ deploy.overlay (self: super: { deploy-rs = { - inherit (inputs.latest.legacyPackages.x86_64-linux) deploy-rs; + inherit (inputs.nixos.legacyPackages.x86_64-linux) deploy-rs; lib = super.deploy-rs.lib; }; }) ]; }; + latest = {}; }; lib = import ./lib {lib = digga.lib // nixos.lib;}; @@ -84,6 +87,7 @@ }); }) agenix.overlays.default + nvfetcher.overlays.default (import ./pkgs) ]; @@ -167,7 +171,7 @@ # profilesOrder = ["system" "direnv"]; # profiles.direnv = { # user = "bartender"; - # path = self.channels.latest.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.bartender; + # path = self.channels.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.bartender; # }; #}; }; From 4a8c97ff74bf9cc2cecc51a8da5c799c00c186ed Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 9 Jun 2023 17:05:39 +0200 Subject: [PATCH 20/46] waybar: use version from nixos-23.05 --- overlays/waybar.nix | 5 ----- pkgs/sources.toml | 4 ---- 2 files changed, 9 deletions(-) delete mode 100644 overlays/waybar.nix diff --git a/overlays/waybar.nix b/overlays/waybar.nix deleted file mode 100644 index 075f5d3e..00000000 --- a/overlays/waybar.nix +++ /dev/null @@ -1,5 +0,0 @@ -channels: final: prev: { - waybar = channels.latest.waybar.overrideAttrs (oldAttrs: rec { - inherit (prev.sources.waybar-nvfetcher) version src; - }); -} diff --git a/pkgs/sources.toml b/pkgs/sources.toml index 183c914b..5ec5e936 100644 --- a/pkgs/sources.toml +++ b/pkgs/sources.toml @@ -46,7 +46,3 @@ fetch.github = "zeekay/vim-beautify" [vim-apprentice-nvfetcher] src.git = "https://github.com/romainl/Apprentice" fetch.github = "romainl/Apprentice" - -[waybar-nvfetcher] -src.git = "https://github.com/Alexays/Waybar" -fetch.github = "Alexays/Waybar" From a7d4be4af59ac4da6098265343f442bc2aadcb16 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 9 Jun 2023 17:06:11 +0200 Subject: [PATCH 21/46] neovim: add ansible-language-server --- modules/terminal-life/nvim/default.nix | 1 + modules/terminal-life/nvim/lsp.vim | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/terminal-life/nvim/default.nix b/modules/terminal-life/nvim/default.nix index ba53ef49..1afb5088 100644 --- a/modules/terminal-life/nvim/default.nix +++ b/modules/terminal-life/nvim/default.nix @@ -22,6 +22,7 @@ in { extraPackages = with pkgs; lib.mkIf (!cfg.lite) [ + ansible-language-server ccls gopls nodejs diff --git a/modules/terminal-life/nvim/lsp.vim b/modules/terminal-life/nvim/lsp.vim index ef238fe6..399e52e4 100644 --- a/modules/terminal-life/nvim/lsp.vim +++ b/modules/terminal-life/nvim/lsp.vim @@ -81,6 +81,7 @@ lua < Date: Wed, 26 Apr 2023 12:49:44 +0200 Subject: [PATCH 22/46] pre-commit hook: only format modified lines instead of entire files --- shell/hooks/pre-commit.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/shell/hooks/pre-commit.sh b/shell/hooks/pre-commit.sh index 4ce4fa13..23776793 100755 --- a/shell/hooks/pre-commit.sh +++ b/shell/hooks/pre-commit.sh @@ -9,15 +9,25 @@ fi diff="git diff-index --name-only --cached $against --diff-filter d" -all_files=($($diff)) +mapfile -t all_files < <($diff) -# Format staged files. +# Stash only unstaged changes, keeping staged changes +old_stash=$(git rev-parse --quiet --verify refs/stash) +git stash push --quiet --keep-index -m 'Unstaged changes before pre-commit hook' +new_stash=$(git rev-parse --quiet --verify refs/stash) + +# Format staged files if ((${#all_files[@]} != 0)); then treefmt "${all_files[@]}" && git add "${all_files[@]}" fi -# check editorconfig +# If unstaged changes were stashed re-apply to working tree +if [ "$old_stash" != "$new_stash" ]; then + git stash pop --quiet +fi + +# Check editorconfig if ((${#all_files[@]} != 0)); then if ! editorconfig-checker -- "${all_files[@]}"; then printf "%b\n" \ From d28da2e1e68b44bcc46459466bd178ccbe011e15 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 5 May 2023 18:32:40 +0200 Subject: [PATCH 23/46] lint: exclude file generated by nvfetcher Fix pre-commit hook to only format staged files --- shell/hooks/pre-commit.sh | 8 ++++---- treefmt.toml | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/shell/hooks/pre-commit.sh b/shell/hooks/pre-commit.sh index 23776793..45efec25 100755 --- a/shell/hooks/pre-commit.sh +++ b/shell/hooks/pre-commit.sh @@ -7,15 +7,15 @@ else against=$(${git}/bin/git hash-object -t tree /dev/null) fi -diff="git diff-index --name-only --cached $against --diff-filter d" - -mapfile -t all_files < <($diff) - # Stash only unstaged changes, keeping staged changes old_stash=$(git rev-parse --quiet --verify refs/stash) git stash push --quiet --keep-index -m 'Unstaged changes before pre-commit hook' new_stash=$(git rev-parse --quiet --verify refs/stash) +diff="git diff-index --name-only --cached $against --diff-filter d" + +mapfile -t all_files < <($diff) + # Format staged files if ((${#all_files[@]} != 0)); then treefmt "${all_files[@]}" && diff --git a/treefmt.toml b/treefmt.toml index c7c1710d..41ee3051 100644 --- a/treefmt.toml +++ b/treefmt.toml @@ -1,6 +1,7 @@ [formatter.nix] command = "alejandra" includes = ["*.nix"] +excludes = ["pkgs/_sources/generated.nix"] [formatter.prettier] command = "prettier" From d664702dc8d44d9f3ab3499a540a65e4f6c3ae9a Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 13 Jun 2023 14:58:03 +0200 Subject: [PATCH 24/46] ci.b12f.io -> ci.pub.solar --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f27fd0b..4efeef2c 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ _PubSolarOS_: as much non-free software as you like. - Automation is better. The reproducibility of nix feels so much more powerful once you're deploying your new configuration from your laptop - to all your other devices with one command. [We have an automated CI using drone](https://ci.b12f.io/pub-solar/os). + to all your other devices with one command. [We have an automated CI using drone](https://ci.pub.solar/pub-solar/os). - Community is important. We just like working on this together, and it feels really good to see our progress at the end of a [hakken.irl](https://pub.solar/hakken) session. From 972e0af361b51e2bb6067ee0d37a31bcefacc056 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 13 Jun 2023 14:58:31 +0200 Subject: [PATCH 25/46] nvfetcher: bump versions --- pkgs/_sources/generated.nix | 52 ++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/pkgs/_sources/generated.nix b/pkgs/_sources/generated.nix index addb0e89..2d455cc8 100644 --- a/pkgs/_sources/generated.nix +++ b/pkgs/_sources/generated.nix @@ -1,9 +1,6 @@ # This file was generated by nvfetcher, please do not modify it manually. +{ fetchgit, fetchurl, fetchFromGitHub, dockerTools }: { - fetchgit, - fetchurl, - fetchFromGitHub, -}: { F-Sy-H = { pname = "F-Sy-H"; version = "899f68b52b6b86a36cd8178eb0e9782d4aeda714"; @@ -14,6 +11,7 @@ fetchSubmodules = false; sha256 = "sha256-zhaXjrNL0amxexbZm4Kr5Y/feq1+2zW0O6eo9iZhmi0="; }; + date = "2023-01-25"; }; instant-nvim-nvfetcher = { pname = "instant-nvim-nvfetcher"; @@ -25,6 +23,7 @@ fetchSubmodules = false; sha256 = "sha256-DXJWji/NR8ZCxe014rD51v3EHJHMhRQeOoI3SsY8mR4="; }; + date = "2022-06-25"; }; manix = { pname = "manix"; @@ -36,28 +35,31 @@ fetchSubmodules = false; sha256 = "sha256-GqPuYscLhkR5E2HnSFV4R48hCWvtM3C++3zlJhiK/aw="; }; + date = "2021-04-20"; }; ohmyzsh = { pname = "ohmyzsh"; - version = "b602e0a066d8c98e8c02201ad16c764447fd8531"; + version = "cb8b677488c7a20278917af58dfccd72cd40e1b1"; src = fetchFromGitHub { owner = "ohmyzsh"; repo = "ohmyzsh"; - rev = "b602e0a066d8c98e8c02201ad16c764447fd8531"; + rev = "cb8b677488c7a20278917af58dfccd72cd40e1b1"; fetchSubmodules = false; - sha256 = "sha256-O4thanOQpX/DHPdfW2p/RUXzIPj6GUp9EnKJfkh7yQM="; + sha256 = "sha256-c7tGTEdE8e1qD83Nxzno1VLAFV5gKoB4TJes4aVa2mY="; }; + date = "2023-06-11"; }; powerlevel10k = { pname = "powerlevel10k"; - version = "a30145b0f82d06770e924e9eac064ed223a94e6b"; + version = "944f52fc430259ff49f497f3516a3ddfb45a0a6b"; src = fetchFromGitHub { owner = "romkatv"; repo = "powerlevel10k"; - rev = "a30145b0f82d06770e924e9eac064ed223a94e6b"; + rev = "944f52fc430259ff49f497f3516a3ddfb45a0a6b"; fetchSubmodules = false; - sha256 = "sha256-jnZXLrywUrJgTX1tFpoNH94r/jcGl2P6R7DoedluHxQ="; + sha256 = "sha256-a2HTHvvI6aQXe/tzvd0P1IGWFFo64fMeKNX3TxMvCcc="; }; + date = "2023-06-11"; }; rnix-lsp-nvfetcher = { pname = "rnix-lsp-nvfetcher"; @@ -69,6 +71,7 @@ fetchSubmodules = false; sha256 = "sha256-F0s0m62S5bHNVWNHLZD6SeHiLrsDx98VQbRjDyIu+qQ="; }; + date = "2022-11-27"; }; vim-apprentice-nvfetcher = { pname = "vim-apprentice-nvfetcher"; @@ -80,6 +83,7 @@ fetchSubmodules = false; sha256 = "sha256-03B9tmU9+6t2hxhOgZxBqJr9r41CAqhHLUkHYvFdcks="; }; + date = "2023-02-15"; }; vim-beautify-nvfetcher = { pname = "vim-beautify-nvfetcher"; @@ -91,6 +95,7 @@ fetchSubmodules = false; sha256 = "sha256-QPTCl6KaGcAjTS5yVDov9yxmv0fDaFoPLMsrtVIG6GQ="; }; + date = "2018-12-27"; }; vim-caddyfile-nvfetcher = { pname = "vim-caddyfile-nvfetcher"; @@ -102,17 +107,19 @@ fetchSubmodules = false; sha256 = "sha256-rRYv3vnt31g7hNTxttTD6BWdv5JJ+ko3rPNyDUEOZ9o="; }; + date = "2022-05-09"; }; vim-workspace-nvfetcher = { pname = "vim-workspace-nvfetcher"; - version = "c26b473f9b073f24bacecd38477f44c5cd1f5a62"; + version = "c0d1e4332a378f58bfdf363b4957168fa78e79b4"; src = fetchFromGitHub { owner = "thaerkh"; repo = "vim-workspace"; - rev = "c26b473f9b073f24bacecd38477f44c5cd1f5a62"; + rev = "c0d1e4332a378f58bfdf363b4957168fa78e79b4"; fetchSubmodules = false; - sha256 = "sha256-XV7opLyfkHIDO0+JJaO/x0za0gsHuklrzapTGdLHJmI="; + sha256 = "sha256-2Brx098dk5THiieBiW71FG9mUUwS1CSY9mpOPWA/Tq4="; }; + date = "2023-05-28"; }; vimagit-nvfetcher = { pname = "vimagit-nvfetcher"; @@ -124,27 +131,18 @@ fetchSubmodules = false; sha256 = "sha256-fhazQQqyFaO0fdoeNI9nBshwTDhKNHH262H/QThtuO0="; }; - }; - waybar-nvfetcher = { - pname = "waybar-nvfetcher"; - version = "09142fa322e080474de0f2dc3ea98036846550df"; - src = fetchFromGitHub { - owner = "Alexays"; - repo = "Waybar"; - rev = "09142fa322e080474de0f2dc3ea98036846550df"; - fetchSubmodules = false; - sha256 = "sha256-5KqQaaKwW14F/rVWGQ0qBUU0b3Z+v/Mq8lnSwqLtT7U="; - }; + date = "2022-07-03"; }; zsh-nix-shell = { pname = "zsh-nix-shell"; - version = "af6f8a266ea1875b9a3e86e14796cadbe1cfbf08"; + version = "227d284ab2dc2f5153826974e0094a1990b1b5b9"; src = fetchFromGitHub { owner = "chisui"; repo = "zsh-nix-shell"; - rev = "af6f8a266ea1875b9a3e86e14796cadbe1cfbf08"; + rev = "227d284ab2dc2f5153826974e0094a1990b1b5b9"; fetchSubmodules = false; - sha256 = "sha256-BjgMhILEL/qdgfno4LR64LSB8n9pC9R+gG7IQWwgyfQ="; + sha256 = "sha256-SrGvHsAJCxzi69CKNKKvItYUaAP7CKwRntsprVHBs4Y="; }; + date = "2023-05-29"; }; } From 323a3bd189d3e3a86c03ef863430750647440529 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Thu, 2 Jun 2022 10:45:03 +0200 Subject: [PATCH 26/46] sway: use ExecStartPre in systemd service, like upstream wiki --- modules/sway/sway.service.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/sway/sway.service.nix b/modules/sway/sway.service.nix index fbca3acd..253df4ac 100644 --- a/modules/sway/sway.service.nix +++ b/modules/sway/sway.service.nix @@ -8,10 +8,10 @@ }; Service = { Type = "simple"; + ExecStartPre = "${pkgs.systemd}/bin/systemctl --user unset-environment WAYLAND_DISPLAY DISPLAY"; ExecStart = "${pkgs.sway}/bin/sway"; Restart = "on-failure"; RestartSec = "1"; TimeoutStopSec = "10"; - ExecStopPost = "${pkgs.systemd}/bin/systemctl --user unset-environment SWAYSOCK DISPLAY I3SOCK WAYLAND_DISPLAY"; }; } From a6bec82fb78de30f1611253e2137d2d831927807 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 13 Jun 2023 15:05:53 +0200 Subject: [PATCH 27/46] core: use linux 6.1 --- modules/core/boot.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/boot.nix b/modules/core/boot.nix index 4f82a4b0..711569ef 100644 --- a/modules/core/boot.nix +++ b/modules/core/boot.nix @@ -36,7 +36,7 @@ in { loader.systemd-boot.enable = lib.mkDefault true; # Use latest LTS linux kernel by default - kernelPackages = lib.mkDefault pkgs.linuxPackages_5_15; + kernelPackages = lib.mkDefault pkgs.linuxPackages_6_1; # Support ntfs drives supportedFilesystems = ["ntfs"]; From 3569216294736bcca970a5bca23f6b6b33fe0e43 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 13 Jun 2023 15:06:07 +0200 Subject: [PATCH 28/46] graphical: switch to ungoogled-chromium --- modules/graphical/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/graphical/default.nix b/modules/graphical/default.nix index 46812e92..5966e73e 100644 --- a/modules/graphical/default.nix +++ b/modules/graphical/default.nix @@ -100,7 +100,7 @@ in { home.packages = [ alacritty foot - chromium + ungoogled-chromium firefox-wayland flameshot From a2733eee73c7add246cebec035a6ecd8fcb70905 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 13 Jun 2023 16:22:52 +0200 Subject: [PATCH 29/46] zsh: enable until we switch to bash to fix assertion https://github.com/NixOS/nixpkgs/commit/631b7f6f882b05c2a5c35f088bfdd99ebbcbf1f3 --- modules/terminal-life/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/terminal-life/default.nix b/modules/terminal-life/default.nix index 083f05e9..2e9436bd 100644 --- a/modules/terminal-life/default.nix +++ b/modules/terminal-life/default.nix @@ -30,6 +30,7 @@ in { environment.shells = with pkgs; [ zsh ]; + programs.zsh.enable = true; environment.systemPackages = with pkgs; [ screen From c9c874ab00d7a85b078ff8c97c3842ce9725f2f8 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 20 Jun 2023 23:35:15 +0200 Subject: [PATCH 30/46] bash: show current directory on top in alacritty --- modules/terminal-life/bash/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index fa535348..9528aee9 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -18,8 +18,8 @@ in { # Run when initializing an interactive shell initExtra = '' - # Use fzf's CTRL-R history widget - source ${pkgs.fzf}/share/fzf/key-bindings.bash + # Show current directory at the top in Alacritty + PROMPT_COMMAND='echo -e -n "\e]2;$(basename "$PWD")\e\\"' # If a command is not found, show me where it is source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh From 4c37713f2da6522f7cc242fcad76ccdbfebbc985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Wed, 28 Jun 2023 19:03:12 +0200 Subject: [PATCH 31/46] Update user & hostname display in starship --- modules/terminal-life/starship.toml.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/terminal-life/starship.toml.nix b/modules/terminal-life/starship.toml.nix index 09c845ab..e05a1f46 100644 --- a/modules/terminal-life/starship.toml.nix +++ b/modules/terminal-life/starship.toml.nix @@ -1,20 +1,20 @@ { - format = "$directory($git_branch$git_commit$git_state$git_status)($c$deno$golang$haskell$nodejs$php$python$ruby$rust$terraform[](fg:#F85E84 bg:black))($docker_context[](fg:#06969A))($container)$fill(\${custom.triton})$nix_shell$status[ |](fg:#F85E84)$line_break$character"; + format = "$username$hostname$directory($git_branch$git_commit$git_state$git_status)($c$deno$golang$haskell$nodejs$php$python$ruby$rust$terraform[](fg:#F85E84 bg:#000000))($docker_context[](fg:#06969A))($container)$fill(\${custom.triton})$nix_shell$status[ |](fg:#F85E84)$line_break$character"; # Disable the blank line at the start of the prompt add_newline = false; # You can also replace your username with a neat symbol like  to save some space username = { - show_always = true; - style_user = "bg:#9A348E"; - style_root = "bg:#9A348E"; - format = ''[$user]($style)''; + style_user = "bg:#000000 fg:#F85E84"; + style_root = "bg:#F85E84 fg:#000000"; + format = ''[$user ]($style)''; }; + hostname = { - ssh_only = false; - format = "@[$ssh_symbol$hostname]($style)"; - disabled = false; + ssh_symbol = ""; + trim_at = ""; + style = "bg:#000000 fg:#F85E84"; }; character = { From 2b9def0a764030c30ddb95a07c103389e1fca39a Mon Sep 17 00:00:00 2001 From: teutat3s Date: Wed, 28 Jun 2023 19:20:11 +0200 Subject: [PATCH 32/46] Merge branch main into origin/nixos-23.05 --- flake.nix | 2 +- modules/terminal-life/bash/default.nix | 107 ++ modules/terminal-life/default.nix | 25 +- modules/terminal-life/fzf/default.nix | 5 +- modules/terminal-life/nvim/ui.vim | 2 +- modules/terminal-life/starship.toml.nix | 169 ++++ modules/terminal-life/zsh/default.nix | 123 --- modules/terminal-life/zsh/fzf.zsh | 58 -- modules/terminal-life/zsh/p10k.zsh | 943 ------------------ overlays/blesh.nix | 5 + pkgs/_sources/generated.nix | 60 +- pkgs/sources.toml | 26 +- pkgs/sway-launcher.nix | 5 +- .../base-user/.local/share/scripts/base16.sh | 64 +- profiles/base-user/default.nix | 1 - profiles/base-user/home.nix | 3 +- tests/first-test.nix | 2 +- 17 files changed, 366 insertions(+), 1234 deletions(-) create mode 100644 modules/terminal-life/bash/default.nix create mode 100644 modules/terminal-life/starship.toml.nix delete mode 100644 modules/terminal-life/zsh/default.nix delete mode 100644 modules/terminal-life/zsh/fzf.zsh delete mode 100644 modules/terminal-life/zsh/p10k.zsh create mode 100644 overlays/blesh.nix rename modules/terminal-life/zsh/base16.zsh => profiles/base-user/.local/share/scripts/base16.sh (69%) diff --git a/flake.nix b/flake.nix index 868ee558..5394598d 100644 --- a/flake.nix +++ b/flake.nix @@ -59,7 +59,7 @@ # allowUnfree = true; }; - supportedSystems = ["x86_64-linux" "aarch64-linux"]; + supportedSystems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin"]; channels = { nixos = { diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix new file mode 100644 index 00000000..9528aee9 --- /dev/null +++ b/modules/terminal-life/bash/default.nix @@ -0,0 +1,107 @@ +{ + config, + pkgs, + self, + ... +}: let + psCfg = config.pub-solar; + xdg = config.home-manager.users."${psCfg.user.name}".xdg; +in { + enable = true; + + historyControl = ["ignorespace"]; + + # Run when initializing a login shell + profileExtra = '' + [ "$(tty)" = "/dev/tty1" ] && exec ${pkgs.sway-service}/bin/sway-service + ''; + + # Run when initializing an interactive shell + initExtra = '' + # Show current directory at the top in Alacritty + PROMPT_COMMAND='echo -e -n "\e]2;$(basename "$PWD")\e\\"' + + # If a command is not found, show me where it is + source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh + + # Helps you navigate directories faster + # https://github.com/gsamokovarov/jump + eval "$(${pkgs.jump}/bin/jump shell --bind=z)" + + eval "$(${pkgs.direnv}/bin/direnv hook bash)" + + bind 'set show-all-if-ambiguous on' + + # Syntax highlighting, auto suggestions, vim modes, etc. + # https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs + source "$(blesh-share)" --attach=none + # ctrl + space to accept autocomplete suggestion + ble-bind -m 'auto_complete' -f 'C-@' 'auto_complete/insert-on-end' + # Meta (Alt) + Backspace to delete a word + ble-bind -m 'vi_imap' -f 'M-C-?' 'kill-backward-cword' + # Meta (Alt) + p to jump one word backwards + ble-bind -m 'vi_imap' -f M-p '@nomarked backward-uword' + ble-bind -m 'vi_imap' -f M-left '@nomarked backward-uword' + # Meta (Alt) + n to jump one word forwards + ble-bind -m 'vi_imap' -f M-n '@nomarked forward-uword' + ble-bind -m 'vi_imap' -f M-right '@nomarked forward-uword' + # Arrow up and Ctrl + p searches history for entered input + ble-bind -m 'vi_imap' -f up 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' + ble-bind -m 'vi_imap' -f C-p 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' + # Arrow down and Ctrl + n searches history for entered input + ble-bind -m 'vi_imap' -f down 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' + ble-bind -m 'vi_imap' -f C-n 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' + + ble-face region_insert='fg=black,bg=navy' + + function my/complete-load-hook { + bleopt complete_auto_delay=250 + } + blehook/eval-after-load complete my/complete-load-hook + + bleopt exec_errexit_mark= + bleopt filename_ls_colors="$LS_COLORS" + + bleopt complete_menu_style=desc + + # Bash vim mode keybindings + if [[ $- == *i* ]]; then # in interactive session + set -o vi + + ble-bind -m vi_imap -f 'ENTER' 'vi_imap/complete' + ble-bind -m vi_imap -f 'TAB' 'vi_imap/complete' + + ble-bind -m vi_imap -f 'j j' 'vi_imap/normal-mode' + ble-bind -m vi_imap -f 'ESC' 'vi_imap/normal-mode' + + ble-bind -m vi_nmap -f 'h' 'vi_nmap/insert-mode' + ble-bind -m vi_nmap -f 'i' 'vi-command/backward-line' + ble-bind -m vi_nmap -f 'j' 'vi-command/backward-char' + ble-bind -m vi_nmap -f 'k' 'vi-command/forward-line' + ble-bind -m vi_nmap -f 'l' 'vi-command/forward-char' + + ble-bind -m vi_imap -f 'C-c' discard-line + fi + + # end of .bashrc + [[ ''${BLE_VERSION-} ]] && ble-attach + ''; + + shellAliases = { + nano = "nvim"; + vi = "nvim"; + vim = "nvim"; + mutt = "neomutt"; + ls = "exa"; + la = "exa --group-directories-first -lag"; + fm = "vifm ."; + vifm = "vifm ."; + wget = "wget --hsts-file=$XDG_CACHE_HOME/wget-hsts"; + irssi = "irssi --config=$XDG_CONFIG_HOME/irssi/config --home=$XDG_DATA_HOME/irssi"; + drone = "DRONE_TOKEN=$(secret-tool lookup drone token) drone"; + no = "manix \"\" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview=\"manix '{}'\" | xargs manix"; + # fix nixos-option + nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat"; + myip = "dig +short myip.opendns.com @208.67.222.222 2>&1"; + }; +} diff --git a/modules/terminal-life/default.nix b/modules/terminal-life/default.nix index 2e9436bd..047eb3bd 100644 --- a/modules/terminal-life/default.nix +++ b/modules/terminal-life/default.nix @@ -24,28 +24,29 @@ in { config = mkIf cfg.enable { programs.command-not-found.enable = false; - # Needed to get zsh completion for system packages (e.g. systemd). - environment.pathsToLink = ["/share/zsh"]; - - environment.shells = with pkgs; [ - zsh - ]; - programs.zsh.enable = true; - environment.systemPackages = with pkgs; [ screen ]; + # Starship is a fast and featureful shell prompt + # starship.toml has sane defaults that can be changed there + programs.starship = { + enable = true; + settings = import ./starship.toml.nix; + }; + home-manager = with pkgs; pkgs.lib.setAttrByPath ["users" psCfg.user.name] { home.packages = [ ack asciinema bat + blesh exa fd gh glow + jump nnn powerline silver-searcher @@ -53,19 +54,19 @@ in { watson ]; - programs.neovim = import ./nvim { + programs.bash = import ./bash { inherit config; inherit pkgs; - inherit lib; + inherit self; }; programs.fzf = import ./fzf { inherit config; inherit pkgs; }; - programs.zsh = import ./zsh { + programs.neovim = import ./nvim { inherit config; inherit pkgs; - inherit self; + inherit lib; }; }; }; diff --git a/modules/terminal-life/fzf/default.nix b/modules/terminal-life/fzf/default.nix index 0cc6fd94..88e60592 100644 --- a/modules/terminal-life/fzf/default.nix +++ b/modules/terminal-life/fzf/default.nix @@ -10,5 +10,8 @@ "--color=fg:#d3d1d4,header:#7accd7,info:#e5c463,pointer:#ef9062" "--color=marker:#ef9062,fg+:#303030,prompt:#e5c463,hl+:#7accd7" ]; - enableZshIntegration = true; + # Use ble.sh for completions, see + # modules/terminal-life/bash/default.nix -> bleopt complete_menu_style=desc + # and https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion + enableBashIntegration = false; } diff --git a/modules/terminal-life/nvim/ui.vim b/modules/terminal-life/nvim/ui.vim index 3131188f..017b413e 100644 --- a/modules/terminal-life/nvim/ui.vim +++ b/modules/terminal-life/nvim/ui.vim @@ -1,4 +1,4 @@ -let g:base16_shell_path = $XDG_CONFIG_HOME . "/zsh/base16.sh" +let g:base16_shell_path = $XDG_DATA_HOME . "/scripts/base16.sh" let base16colorspace = 256 set termguicolors let g:sonokai_style = 'shusia' diff --git a/modules/terminal-life/starship.toml.nix b/modules/terminal-life/starship.toml.nix new file mode 100644 index 00000000..e05a1f46 --- /dev/null +++ b/modules/terminal-life/starship.toml.nix @@ -0,0 +1,169 @@ +{ + format = "$username$hostname$directory($git_branch$git_commit$git_state$git_status)($c$deno$golang$haskell$nodejs$php$python$ruby$rust$terraform[](fg:#F85E84 bg:#000000))($docker_context[](fg:#06969A))($container)$fill(\${custom.triton})$nix_shell$status[ |](fg:#F85E84)$line_break$character"; + + # Disable the blank line at the start of the prompt + add_newline = false; + + # You can also replace your username with a neat symbol like  to save some space + username = { + style_user = "bg:#000000 fg:#F85E84"; + style_root = "bg:#F85E84 fg:#000000"; + format = ''[$user ]($style)''; + }; + + hostname = { + ssh_symbol = ""; + trim_at = ""; + style = "bg:#000000 fg:#F85E84"; + }; + + character = { + success_symbol = "[❯](bold purple)"; + error_symbol = "[✗](#FF4B00)"; + }; + + status = { + disabled = false; + style = "#FF4B00"; + }; + + fill = { + symbol = "-"; + #style = "bold green"; + style = "black"; + }; + + directory = { + style = "#F85E84"; + truncate_to_repo = false; + fish_style_pwd_dir_length = 1; + truncation_symbol = "…/"; + format = "[](fg:black bg:#F85E84)[$path[$read_only](bg:$style fg:black)](bg:$style fg:black)[](fg:$style)"; + read_only = " "; + }; + + # Here is how you can shorten some long paths by text replacement + # similar to mapped_locations in Oh My Posh: + directory.substitutions = { + "Documents" = " "; + "Downloads" = " "; + "Music" = " "; + "Pictures" = " "; + }; + # Keep in mind that the order matters. For example: + # "Important Documents" = "  " + # will not be replaced, because "Documents" was already substituted before. + # So either put "Important Documents" before "Documents" or use the substituted version: + # "Important  " = "  " + + c = { + symbol = " "; + style = "bg:#86BBD8"; + format = ''[ $symbol ($version) ]($style)''; + }; + + #container = {}; + + custom = { + triton = { + command = "echo $TRITON_PROFILE"; + when = "test $TRITON_PROFILE"; + format = "[✚ ](fg:#F85E84 bg:#1A181A)[$output](fg:#F85E84 bg:#1A181A)"; + description = "The current triton profile"; + }; + }; + + docker_context = { + symbol = " "; + style = "bg:#06969A"; + format = ''[ $symbol $context ]($style) $path''; + }; + + #deno = {}; + + git_branch = { + style = "#E5C463"; + format = "[](fg:black bg:$style)[ $symbol$branch](fg:black bg:$style)[](fg:$style)"; + symbol = " "; + }; + + git_commit = { + style = "#E5C463"; + # ^H is the literal backspace character which renders to \b in the final + # starship config TOML, produced in insert mode via ctrl+v then ctrl+h. + # We use the literal character, because escaping a single \ doesn't work + # with pkgs.formats.toml, see: https://github.com/NixOS/nixpkgs/issues/97310 and + # https://jdhao.github.io/2020/10/07/nvim_insert_unicode_char/ + format = "[ ](bg:$style)[\\($hash$tag\\)](fg:black bg:$style)[](fg:$style)"; + }; + + git_state = { + style = "#E5C463"; + format = "[ ](bg:$style)[ \\($state( $progress_current/$progress_total)\\)](fg:black bg:$style)[](fg:$style)"; + }; + + git_status = { + style = "#E5C463"; + format = "([ ](bg:$style fg:black)$conflicted$staged$modified$renamed$deleted$untracked$stashed$ahead_behind[](fg:$style))"; + conflicted = "[ ](bold fg:88 bg:#E5C463)[  \${count} ](fg:black bg:#E5C463)"; + staged = "[ $count ](fg:black bg:#E5C463)"; + modified = "[ \${count} ](fg:black bg:#E5C463)"; + renamed = "[ \${count} ](fg:black bg:#E5C463)"; + deleted = "[ \${count} ](fg:black bg:#E5C463)"; + untracked = "[?\${count} ](fg:black bg:#E5C463)"; + stashed = "[ \${count} ](fg:black bg:#E5C463)"; + ahead = "[ \${count} ](fg:#523333 bg:#E5C463)"; + behind = "[ \${count} ](fg:black bg:#E5C463)"; + diverged = "[ ](fg:88 bg:#E5C463)[  ](fg:black bg:#E5C463)[ \${ahead_count} ](fg:black bg:#E5C463)[ \${behind_count} ](fg:black bg:#E5C463)"; + }; + + golang = { + symbol = " "; + style = "bg:#86BBD8"; + format = ''[ $symbol ($version) ]($style)''; + }; + + haskell = { + symbol = " "; + style = "bg:#86BBD8"; + format = ''[ $symbol ($version) ]($style)''; + }; + + nix_shell = { + format = ''[$symbol]($style) ''; + symbol = " "; + }; + + nodejs = { + symbol = ""; + style = "bg:#86BBD8"; + format = ''[ $symbol ($version) ]($style)''; + }; + + php = { + symbol = " "; + }; + + python = { + symbol = " "; + }; + + ruby = { + symbol = " "; + }; + + rust = { + symbol = ""; + style = "bg:#86BBD8"; + format = ''[ $symbol ($version) ]($style)''; + }; + + #terraform = {}; + + time = { + disabled = false; + time_format = "%R"; # Hour:Minute Format + style = "bg:#33658A"; + format = ''[ ♥ $time ]($style)''; + }; +} diff --git a/modules/terminal-life/zsh/default.nix b/modules/terminal-life/zsh/default.nix deleted file mode 100644 index a9f0b97c..00000000 --- a/modules/terminal-life/zsh/default.nix +++ /dev/null @@ -1,123 +0,0 @@ -{ - config, - pkgs, - self, - ... -}: let - psCfg = config.pub-solar; - xdg = config.home-manager.users."${psCfg.user.name}".xdg; -in { - enable = true; - enableAutosuggestions = true; - enableCompletion = true; - dotDir = ".config/zsh"; - - history = { - ignoreDups = true; - expireDuplicatesFirst = true; - ignoreSpace = true; - path = "$HOME/.local/share/zsh/zsh_history"; - save = 10000; - size = 10000; - }; - - loginExtra = '' - [ "$(tty)" = "/dev/tty1" ] && exec ${pkgs.sway-service}/bin/sway-service - ''; - - shellAliases = { - nano = "nvim"; - vi = "nvim"; - vim = "nvim"; - mutt = "neomutt"; - ls = "exa"; - la = "exa --group-directories-first -lag"; - fm = "vifm ."; - vifm = "vifm ."; - wget = "wget --hsts-file=$XDG_CACHE_HOME/wget-hsts"; - irssi = "irssi --config=$XDG_CONFIG_HOME/irssi/config --home=$XDG_DATA_HOME/irssi"; - drone = "DRONE_TOKEN=$(secret-tool lookup drone token) drone"; - no = "manix \"\" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview=\"manix '{}'\" | xargs manix"; - # fix nixos-option - nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat"; - myip = "dig +short myip.opendns.com @208.67.222.222 2>&1"; - }; - plugins = [ - # src gets fetched by nvfetcher, see: ./pkgs/sources.toml - { - # will source ohmyzsh/plugins/z/ - name = "zsh-plugins-z"; - file = "plugins/z/z.plugin.zsh"; - src = pkgs.sources.ohmyzsh.src; - } - { - name = "zsh-powerlevel10k"; - file = "powerlevel10k.zsh-theme"; - src = pkgs.sources.powerlevel10k.src; - } - { - name = "zsh-fast-syntax-highlighting"; - file = "F-Sy-H.plugin.zsh"; - src = pkgs.sources.F-Sy-H.src; - } - { - name = "zsh-nix-shell"; - file = "nix-shell.plugin.zsh"; - src = pkgs.sources.zsh-nix-shell.src; - } - ]; - - initExtra = - '' - bindkey -v - bindkey -v 'jj' vi-cmd-mode - bindkey -a 'i' up-line - bindkey -a 'k' down-line - bindkey -a 'j' backward-char - bindkey -a 'h' vi-insert - bindkey '^[[H' beginning-of-line - bindkey '^[[F' end-of-line - bindkey '^R' history-incremental-pattern-search-backward - bindkey '^ ' autosuggest-accept - bindkey '^q' push-line-or-edit - - bindkey '^R' fzf-history-widget - - # ArrowUp/Down start searching history with current input - autoload -U up-line-or-beginning-search - autoload -U down-line-or-beginning-search - zle -N up-line-or-beginning-search - zle -N down-line-or-beginning-search - bindkey "^[[A" up-line-or-beginning-search - bindkey "^[[B" down-line-or-beginning-search - bindkey "^P" up-line-or-beginning-search - bindkey "^N" down-line-or-beginning-search - - # MAKE CTRL+S WORK IN VIM - stty -ixon - stty erase '^?' - - precmd () { - DIR_NAME=$(pwd | sed "s|^$HOME|~|g") - echo -e -n "\e]2;$DIR_NAME\e\\" - - if [ $(date +%d%m) = '0104' ]; then - if [ $? -eq 0 ]; then - echo "Success! That was a great command! I can't wait to see what amazing stuff you'll be up to next." - fi - fi - } - - # If a command is not found, show me where it is - source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh - '' - + builtins.readFile ./base16.zsh - + builtins.readFile ./p10k.zsh - + '' - source ${pkgs.fzf}/share/fzf/key-bindings.zsh - source ${pkgs.fzf}/share/fzf/completion.zsh - source ${pkgs.git-bug}/share/zsh/site-functions/git-bug - eval "$(direnv hook zsh)" - '' - + builtins.readFile ./fzf.zsh; -} diff --git a/modules/terminal-life/zsh/fzf.zsh b/modules/terminal-life/zsh/fzf.zsh deleted file mode 100644 index 78b0fb86..00000000 --- a/modules/terminal-life/zsh/fzf.zsh +++ /dev/null @@ -1,58 +0,0 @@ -# Use ~~ as the trigger sequence instead of the default ** -export FZF_COMPLETION_TRIGGER='~~' - -# Options to fzf command -export FZF_COMPLETION_OPTS='--border --info=inline' - -__fzfcmd() { - echo "fzf" -} - -# ctrl+r - Paste the selected command from history into the command line -fzf-history-widget() { - local selected num - setopt localoptions noglobsubst noposixbuiltins pipefail HIST_FIND_NO_DUPS 2> /dev/null - - selected=( $(fc -rl 1 | - FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS --query=${(qqq)LBUFFER} +m" $(__fzfcmd)) ) - local ret=$? - if [ -n "$selected" ]; then - num=$selected[1] - if [ -n "$num" ]; then - zle vi-fetch-history -n $num - fi - fi - zle redisplay - typeset -f zle-line-init >/dev/null && zle zle-line-init - return $ret -} -zle -N fzf-history-widget -bindkey '^R' fzf-history-widget - -# Use fd (https://github.com/sharkdp/fd) instead of the default find -# command for listing path candidates. -# - The first argument to the function ($1) is the base path to start traversal -# - See the source code (completion.{bash,zsh}) for the details. -_fzf_compgen_path() { - fd --hidden --follow --exclude ".git" . "$1" -} - -# Use fd to generate the list for directory completion -_fzf_compgen_dir() { - fd --type d --hidden --follow --exclude ".git" . "$1" -} - -# (EXPERIMENTAL) Advanced customization of fzf options via _fzf_comprun function -# - The first argument to the function is the name of the command. -# - You should make sure to pass the rest of the arguments to fzf. -_fzf_comprun() { - local command=$1 - shift - - case "$command" in - cd) fzf "$@" --preview 'tree -C {} | head -200' ;; - export|unset) fzf "$@" --preview "eval 'echo \$'{}" ;; - ssh) fzf "$@" --preview 'dig {}' ;; - *) fzf "$@" ;; - esac -} diff --git a/modules/terminal-life/zsh/p10k.zsh b/modules/terminal-life/zsh/p10k.zsh deleted file mode 100644 index 90734313..00000000 --- a/modules/terminal-life/zsh/p10k.zsh +++ /dev/null @@ -1,943 +0,0 @@ -# Generated by Powerlevel10k configuration wizard on 2020-04-18 at 01:15 CEST. -# Based on romkatv/powerlevel10k/config/p10k-classic.zsh, checksum 30399. -# Wizard options: powerline, classic, unicode, darkest, 24h time, angled separators, -# sharp heads, sharp tails, 1 line, compact, concise, transient_prompt, -# instant_prompt=verbose. -# Type `p10k configure` to generate another config. -# -# Config for Powerlevel10k with classic powerline prompt style. Type `p10k configure` to generate -# your own config based on it. -# -# Tip: Looking for a nice color? Here's a one-liner to print colormap. -# -# for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done - -# Temporarily change options. -'builtin' 'local' '-a' 'p10k_config_opts' -[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases') -[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob') -[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand') -'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' - -() { - emulate -L zsh -o extended_glob - - # Unset all configuration options. This allows you to apply configuration changes without - # restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`. - unset -m 'POWERLEVEL9K_*' - - # Zsh >= 5.1 is required. - autoload -Uz is-at-least && is-at-least 5.1 || return - - # The list of segments shown on the left. Fill it with the most important segments. - typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( - ssh - context - dir # current directory - vcs # git status - # prompt_char # prompt symbol - ) - - # The list of segments shown on the right. Fill it with less important segments. - # Right prompt on the last prompt line (where you are typing your commands) gets - # automatically hidden when the input line reaches it. Right prompt above the - # last prompt line gets hidden if it would overlap with left prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( - vi_mode # vi mode (you don't need this if you've enabled prompt_char) - status # exit code of the last command - command_execution_time # duration of the last command - background_jobs # presence of background jobs - direnv # direnv status (https://direnv.net/) - vim_shell # vim shell indicator (:sh) - triton # show the current triton profile - nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) - watson - # kubecontext # current kubernetes context (https://kubernetes.io/) - # terraform # terraform workspace (https://www.terraform.io) - # aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) - # aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) - # azure # azure account name (https://docs.microsoft.com/en-us/cli/azure) - # gcloud # google cloud cli account and project (https://cloud.google.com/) - # google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production) - # context # user@hostname - # ranger # ranger shell (https://github.com/ranger/ranger) - # nnn # nnn shell (https://github.com/jarun/nnn) - # midnight_commander # midnight commander shell (https://midnight-commander.org/) - # vpn_ip # virtual private network indicator - # load # CPU load - # disk_usage # disk usage - # ram # free RAM - # swap # used swap - # todo # todo items (https://github.com/todotxt/todo.txt-cli) - # timewarrior # timewarrior tracking status (https://timewarrior.net/) - # taskwarrior # taskwarrior task count (https://taskwarrior.org/) - # time # current time - # ip # ip address and bandwidth usage for a specified network interface - # public_ip # public IP address - # proxy # system-wide http/https/ftp proxy - # battery # internal battery - # wifi # wifi speed - # example # example user-defined segment (see prompt_example function below) - ) - - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND="black" - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND="yellow" - typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING="" - typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING="CMD" - - # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you. - typeset -g POWERLEVEL9K_MODE=powerline - # When set to `moderate`, some icons will have an extra space after them. This is meant to avoid - # icon overlap when using non-monospace fonts. When set to `none`, spaces are not added. - typeset -g POWERLEVEL9K_ICON_PADDING=none - - # When set to true, icons appear before content on both sides of the prompt. When set - # to false, icons go after content. If empty or not set, icons go before content in the left - # prompt and after content in the right prompt. - # - # You can also override it for a specific segment: - # - # POWERLEVEL9K_STATUS_ICON_BEFORE_CONTENT=false - # - # Or for a specific segment in specific state: - # - # POWERLEVEL9K_DIR_NOT_WRITABLE_ICON_BEFORE_CONTENT=false - typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT= - - # Add an empty line before each prompt. - typeset -g POWERLEVEL9K_PROMPT_ON_NEWLINE=true - typeset -g POWERLEVEL9K_RPROMPT_ON_NEWLINE=false - - # Connect left prompt lines with these symbols. You'll probably want to use the same color - # as POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND below. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='' - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX='%238F' - typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='%238F❯ ' - # Connect right prompt lines with these symbols. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX='%238F' - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX='%238F' - typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX='%238F' - - # Filler between left and right prompt on the first prompt line. You can set it to ' ', '·' or - # '─'. The last two make it easier to see the alignment between left and right prompt and to - # separate prompt from command output. You might want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false - # for more compact prompt if using using this option. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_BACKGROUND= - if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then - # The color of the filler. You'll probably want to match the color of POWERLEVEL9K_MULTILINE - # ornaments defined above. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=238 - # Start filler from the edge of the screen if there are no left segments on the first line. - typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}' - # End filler on the edge of the screen if there are no right segments on the first line. - typeset -g POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='%{%}' - fi - - # Default background color. - typeset -g POWERLEVEL9K_BACKGROUND=none - - # Separator between same-color segments on the left. - typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='%242F\uE0B1' - # Separator between same-color segments on the right. - typeset -g POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='%242F\uE0B3' - # Separator between different-color segments on the left. - typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0B0' - # Separator between different-color segments on the right. - typeset -g POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0B2' - # The right end of left prompt. - typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B0' - # The left end of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B2' - # The left end of left prompt. - typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B2' - # The right end of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B0' - # Left prompt terminator for lines without any segments. - typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= - - #################################[ os_icon: os identifier ]################################## - # OS identifier color. - typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=255 - # Custom icon. - # typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='⭐' - - ################################[ prompt_char: prompt symbol ]################################ - # Transparent background. - typeset -g POWERLEVEL9K_PROMPT_CHAR_BACKGROUND= - # Green prompt symbol if the last command succeeded. - typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=1 - # Red prompt symbol if the last command failed. - typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=17 - # Default prompt symbol. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯' - # Prompt symbol in command vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮' - # Prompt symbol in visual vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='Ⅴ' - # Prompt symbol in overwrite vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶' - typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true - # No line terminator if prompt_char is the last segment. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= - # No line introducer if prompt_char is the first segment. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= - # No surrounding whitespace. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_{LEFT,RIGHT}_WHITESPACE= - - ##################################[ dir: current directory ]################################## - typeset -g POWERLEVEL9K_{ETC,FOLDER,HOME,HOME_SUB}_ICON= - typeset -g POWERLEVEL9K_DIR_{ETC,HOME,HOME_SUBFOLDER,DEFAULT,NOT_WRITABLE}_BACKGROUND=1 - typeset -g POWERLEVEL9K_DIR_{ETC,HOME,HOME_SUBFOLDER,DEFAULT,NOT_WRITABLE}_FOREGROUND=0 - typeset -g POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_VISUAL_IDENTIFIER_COLOR=17 - - typeset -g POWERLEVEL9K_DIR_{ETC,DEFAULT}_BACKGROUND=15 - typeset -g POWERLEVEL9K_DIR_{HOME,HOME_SUBFOLDER}_BACKGROUND=1 - typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_BACKGROUND=1 - - # If directory is too long, shorten some of its segments to the shortest possible unique - # prefix. The shortened directory can be tab-completed to the original. - typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique - # Color of the shortened directory segments. - typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=0 - # Color of the anchor directory segments. Anchor segments are never shortened. The first - # segment is always an anchor. - typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=0 - # Display anchor directory segments in bold. - typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=false - # Don't shorten directories that contain any of these files. They are anchors. - local anchor_files=( - .bzr - .citc - .git - .hg - .node-version - .python-version - .go-version - .ruby-version - .lua-version - .java-version - .perl-version - .php-version - .tool-version - .shorten_folder_marker - .svn - .terraform - CVS - Cargo.toml - composer.json - go.mod - package.json - stack.yaml - ) - typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(${(j:|:)anchor_files})" - # If set to true, remove everything before the last (deepest) subdirectory that contains files - # matching $POWERLEVEL9K_SHORTEN_FOLDER_MARKER. For example, when the current directory is - # /foo/bar/git_repo/baz, prompt will display git_repo/baz. This assumes that /foo/bar/git_repo - # contains a marker (.git) and other directories don't. - typeset -g POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=false - # Don't shorten this many last directory segments. They are anchors. - typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 - # Shorten directory if it's longer than this even if there is space for it. The value can - # be either absolute (e.g., '80') or a percentage of terminal width (e.g, '50%'). If empty, - # directory will be shortened only when prompt doesn't fit or when other parameters demand it - # (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below). - # If set to `0`, directory will always be shortened to its minimum length. - typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80 - # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this - # many columns for typing commands. - typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40 - # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least - # COLUMNS * POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT * 0.01 columns for typing commands. - typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50 - # If set to true, embed a hyperlink into the directory. Useful for quickly - # opening a directory in the file manager simply by clicking the link. - # Can also be handy when the directory is shortened, as it allows you to see - # the full directory that was used in previous commands. - typeset -g POWERLEVEL9K_DIR_HYPERLINK=false - - # Enable special styling for non-writable directories. - typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true - # Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE - # above must be set to true for this parameter to have effect. - typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='∅' - - #####################################[ vcs: git status ]###################################### - # Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon. - typeset -g POWERLEVEL9K_VCS_BRANCH_ICON= - - # Untracked files icon. It's really a question mark, your font isn't broken. - # Change the value of this parameter to show a different icon. - typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?' - - # Formatter for Git status. - # - # Example output: master ⇣42⇡42 *42 merge ~42 +42 !42 ?42. - # - # You can edit the function to customize how Git status looks. - # - # VCS_STATUS_* parameters are set by gitstatus plugin. See reference: - # https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh. - function my_git_formatter() { - emulate -L zsh - - if [[ -n $P9K_CONTENT ]]; then - # If P9K_CONTENT is not empty, use it. It's either "loading" or from vcs_info (not from - # gitstatus plugin). VCS_STATUS_* parameters are not available in this case. - typeset -g my_git_format=$P9K_CONTENT - return - fi - - if (( $1 )); then - # Styling for up-to-date Git status. - local meta='%0F' # grey foreground - local clean='%0F' # green foreground - local modified='%0F' # yellow foreground - local untracked='%0F' # blue foreground - local conflicted='%0F' # red foreground - else - # Styling for incomplete and stale Git status. - local meta='%0F' # grey foreground - local clean='%0F' # grey foreground - local modified='%0F' # grey foreground - local untracked='%0F' # grey foreground - local conflicted='%0F' # grey foreground - fi - - local res - local where # branch or tag - if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then - res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}" - where=${(V)VCS_STATUS_LOCAL_BRANCH} - elif [[ -n $VCS_STATUS_TAG ]]; then - res+="${meta}#" - where=${(V)VCS_STATUS_TAG} - fi - - # If local branch name or tag is at most 32 characters long, show it in full. - # Otherwise show the first 12 … the last 12. - # Tip: To always show local branch name in full without truncation, delete the next line. - (( $#where > 32 )) && where[13,-13]="…" - res+="${clean}${where//\%/%%}" # escape % - - # Display the current Git commit if there is no branch or tag. - # Tip: To always display the current Git commit, remove `[[ -z $where ]] &&` from the next line. - [[ -z $where ]] && res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}" - - # Show tracking branch name if it differs from local branch. - if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then - res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape % - fi - - # ⇣42 if behind the remote. - (( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}⇣${VCS_STATUS_COMMITS_BEHIND}" - # ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42. - (( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" " - (( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}⇡${VCS_STATUS_COMMITS_AHEAD}" - # ⇠42 if behind the push remote. - (( VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" ${clean}⇠${VCS_STATUS_PUSH_COMMITS_BEHIND}" - (( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" " - # ⇢42 if ahead of the push remote; no leading space if also behind: ⇠42⇢42. - (( VCS_STATUS_PUSH_COMMITS_AHEAD )) && res+="${clean}⇢${VCS_STATUS_PUSH_COMMITS_AHEAD}" - # *42 if have stashes. - (( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}" - # 'merge' if the repo is in an unusual state. - [[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}" - # ~42 if have merge conflicts. - (( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}" - # +42 if have staged changes. - (( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}" - # !42 if have unstaged changes. - (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}" - # ?42 if have untracked files. It's really a question mark, your font isn't broken. - # See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon. - # Remove the next line if you don't want to see untracked files at all. - (( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}" - # "─" if the number of unstaged files is unknown. This can happen due to - # POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY (see below) being set to a non-negative number lower - # than the number of files in the Git index, or due to bash.showDirtyState being set to false - # in the repository config. The number of staged and untracked files may also be unknown - # in this case. - (( VCS_STATUS_HAS_UNSTAGED == -1 )) && res+=" ${modified}─" - - typeset -g my_git_format=$res - } - functions -M my_git_formatter 2>/dev/null - - # Don't count the number of unstaged, untracked and conflicted files in Git repositories with - # more than this many files in the index. Negative value means infinity. - # - # If you are working in Git repositories with tens of millions of files and seeing performance - # sagging, try setting POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY to a number lower than the output - # of `git ls-files | wc -l`. Alternatively, add `bash.showDirtyState = false` to the repository's - # config: `git config bash.showDirtyState false`. - typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1 - - # Don't show Git status in prompt for repositories whose workdir matches this pattern. - # For example, if set to '~', the Git repository at $HOME/.git will be ignored. - # Multiple patterns can be combined with '|': '~|~/some/dir'. - typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~' - - # Disable the default Git status formatting. - typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true - # Install our own Git status formatter. - typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}' - typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter(0)))+${my_git_format}}' - # Enable counters for staged, unstaged, etc. - typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1 - - # Icon color. - typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_COLOR=4 - typeset -g POWERLEVEL9K_VCS_LOADING_VISUAL_IDENTIFIER_COLOR=4 - # Custom icon. - typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION= - # Custom prefix. - # typeset -g POWERLEVEL9K_VCS_PREFIX='%244Fon ' - - # Show status of repositories of these types. You can add svn and/or hg if you are - # using them. If you do, your prompt may become slow even when your current directory - # isn't in an svn or hg reposotiry. - typeset -g POWERLEVEL9K_VCS_BACKENDS=(git) - - # These settings are used for respositories other than Git or when gitstatusd fails and - # Powerlevel10k has to fall back to using vcs_info. - typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=0 - typeset -g POWERLEVEL9K_VCS_CLEAN_BACKGROUND=2 - typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=0 - typeset -g POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND=3 - typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=0 - typeset -g POWERLEVEL9K_VCS_MODIFIED_BACKGROUND=3 - - ##########################[ status: exit code of the last command ]########################### - # Enable OK_PIPE, ERROR_PIPE and ERROR_SIGNAL status states to allow us to enable, disable and - # style them independently from the regular OK and ERROR state. - typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true - - # Status on success. No content, just an icon. No need to show it if prompt_char is enabled as - # it will signify success by turning green. - typeset -g POWERLEVEL9K_STATUS_OK=true - typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=70 - typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION='✔' - - # Status when some part of a pipe command fails but the overall exit status is zero. It may look - # like this: 1|0. - typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=70 - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='✔' - - # Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as - # it will signify error by turning red. - typeset -g POWERLEVEL9K_STATUS_ERROR=true - typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=160 - typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='✘' - - # Status when the last command was terminated by a signal. - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=160 - # Use terse signal names: "INT" instead of "SIGINT(2)". - typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION='✘' - - # Status when some part of a pipe command fails and the overall exit status is also non-zero. - # It may look like this: 1|0. - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=160 - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION='✘' - - ###################[ command_execution_time: duration of the last command ]################### - # Show duration of the last command if takes longer than this many seconds. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 - # Show this many fractional digits. Zero means round to seconds. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 - # Execution time color. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=0 - # Duration format: 1d 2h 3m 4s. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' - # Custom icon. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION= - # Custom prefix. - # typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='%244Ftook ' - - #######################[ background_jobs: presence of background jobs ]####################### - # Don't show the number of background jobs. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false - # Background jobs color. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=37 - # Custom icon. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='≡' - - #######################[ direnv: direnv status (https://direnv.net/) ]######################## - # Direnv color. - typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=178 - # Custom icon. - # typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ asdf: asdf version manager (https://github.com/asdf-vm/asdf) ]############### - # Default asdf color. Only used to display tools for which there is no color override (see below). - typeset -g POWERLEVEL9K_ASDF_FOREGROUND=66 - - # There are four parameters that can be used to hide asdf tools. Each parameter describes - # conditions under which a tool gets hidden. Parameters can hide tools but not unhide them. If at - # least one parameter decides to hide a tool, that tool gets hidden. If no parameter decides to - # hide a tool, it gets shown. - # - # Special note on the difference between POWERLEVEL9K_ASDF_SOURCES and - # POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW. Consider the effect of the following commands: - # - # asdf local python 3.8.1 - # asdf global python 3.8.1 - # - # After running both commands the current python version is 3.8.1 and its source is "local" as - # it takes precedence over "global". If POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW is set to false, - # it'll hide python version in this case because 3.8.1 is the same as the global version. - # POWERLEVEL9K_ASDF_SOURCES will hide python version only if the value of this parameter doesn't - # contain "local". - - # Hide tool versions that don't come from one of these sources. - # - # Available sources: - # - # - shell `asdf current` says "set by ASDF_${TOOL}_VERSION environment variable" - # - local `asdf current` says "set by /some/not/home/directory/file" - # - global `asdf current` says "set by /home/username/file" - # - # Note: If this parameter is set to (shell local global), it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SOURCES. - typeset -g POWERLEVEL9K_ASDF_SOURCES=(shell local global) - - # If set to false, hide tool versions that are the same as global. - # - # Note: The name of this parameter doesn't reflect its meaning at all. - # Note: If this parameter is set to true, it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_PROMPT_ALWAYS_SHOW. - typeset -g POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW=false - - # If set to false, hide tool versions that are equal to "system". - # - # Note: If this parameter is set to true, it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_SYSTEM. - typeset -g POWERLEVEL9K_ASDF_SHOW_SYSTEM=true - - # If set to non-empty value, hide tools unless there is a file matching the specified file pattern - # in the current directory, or its parent diretory, or its grandparent directory, and so on. - # - # Note: If this parameter is set to empty value, it won't hide tools. - # Note: SHOW_ON_UPGLOB isn't specific to asdf. It works with all prompt segments. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_ON_UPGLOB. - # - # Example: Hide nodejs version when there is no package.json and no *.js files in the current - # directory, in `..`, in `../..` and so on. - # - # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.js|package.json' - typeset -g POWERLEVEL9K_ASDF_SHOW_ON_UPGLOB= - - # Ruby version from asdf. - typeset -g POWERLEVEL9K_ASDF_RUBY_FOREGROUND=168 - # typeset -g POWERLEVEL9K_ASDF_RUBY_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_RUBY_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Python version from asdf. - typeset -g POWERLEVEL9K_ASDF_PYTHON_FOREGROUND=37 - # typeset -g POWERLEVEL9K_ASDF_PYTHON_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PYTHON_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Go version from asdf. - typeset -g POWERLEVEL9K_ASDF_GOLANG_FOREGROUND=37 - # typeset -g POWERLEVEL9K_ASDF_GOLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_GOLANG_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Node.js version from asdf. - typeset -g POWERLEVEL9K_ASDF_NODEJS_FOREGROUND=70 - # typeset -g POWERLEVEL9K_ASDF_NODEJS_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Rust version from asdf. - typeset -g POWERLEVEL9K_ASDF_RUST_FOREGROUND=37 - # typeset -g POWERLEVEL9K_ASDF_RUST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_RUST_SHOW_ON_UPGLOB='*.foo|*.bar' - - # .NET Core version from asdf. - typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=134 - # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Flutter version from asdf. - typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=38 - # typeset -g POWERLEVEL9K_ASDF_FLUTTER_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_FLUTTER_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Lua version from asdf. - typeset -g POWERLEVEL9K_ASDF_LUA_FOREGROUND=32 - # typeset -g POWERLEVEL9K_ASDF_LUA_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_LUA_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Java version from asdf. - typeset -g POWERLEVEL9K_ASDF_JAVA_FOREGROUND=32 - # typeset -g POWERLEVEL9K_ASDF_JAVA_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_JAVA_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Perl version from asdf. - typeset -g POWERLEVEL9K_ASDF_PERL_FOREGROUND=67 - # typeset -g POWERLEVEL9K_ASDF_PERL_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PERL_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Erlang version from asdf. - typeset -g POWERLEVEL9K_ASDF_ERLANG_FOREGROUND=125 - # typeset -g POWERLEVEL9K_ASDF_ERLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_ERLANG_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Elixir version from asdf. - typeset -g POWERLEVEL9K_ASDF_ELIXIR_FOREGROUND=129 - # typeset -g POWERLEVEL9K_ASDF_ELIXIR_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_ELIXIR_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Postgres version from asdf. - typeset -g POWERLEVEL9K_ASDF_POSTGRES_FOREGROUND=31 - # typeset -g POWERLEVEL9K_ASDF_POSTGRES_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_POSTGRES_SHOW_ON_UPGLOB='*.foo|*.bar' - - # PHP version from asdf. - typeset -g POWERLEVEL9K_ASDF_PHP_FOREGROUND=99 - # typeset -g POWERLEVEL9K_ASDF_PHP_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PHP_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Haskell version from asdf. - typeset -g POWERLEVEL9K_ASDF_HASKELL_FOREGROUND=172 - # typeset -g POWERLEVEL9K_ASDF_HASKELL_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_HASKELL_SHOW_ON_UPGLOB='*.foo|*.bar' - - ###########[ nix_shell ]########### - # # Nix shell color. - typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74 - - # Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line. - typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION='' - - # Custom icon. - typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='nix' - - ###########[ vi_mode: vi mode (you don't need this if you've enabled prompt_char) ]########### - # Text and color for normal (a.k.a. command) vi mode. - typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=CMD - typeset -g POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND=4 - # Text and color for visual vi mode. - typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=VIS - typeset -g POWERLEVEL9K_VI_MODE_VISUAL_FOREGROUND=3 - # Text and color for overtype (a.k.a. overwrite and replace) vi mode. - typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVR - typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_FOREGROUND=2 - # Text and color for insert vi mode. - typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING= - typeset -g POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=7 - - ##################################[ context: user@hostname ]################################## - typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=17 - # Context color in SSH without privileges. - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=7 - # Default context color (no privileges, no SSH). - typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=7 - - # Context format when running with privileges: bold user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%B%n@%m' - # Context format when in SSH without privileges: user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE='%n@%m' - # Default context format (no privileges, no SSH): user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m' - - ###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]### - # Python virtual environment color. - typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=37 - # Don't show Python version next to the virtual environment name. - typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false - # Separate environment name from Python version only with a space. - typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= - # Custom icon. - # typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #####################[ anaconda: conda environment (https://conda.io/) ]###################### - # Anaconda environment color. - typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=37 - # Don't show Python version next to the anaconda environment name. - typeset -g POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=false - # Separate environment name from Python version only with a space. - typeset -g POWERLEVEL9K_ANACONDA_{LEFT,RIGHT}_DELIMITER= - # Custom icon. - # typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################ - # Pyenv color. - typeset -g POWERLEVEL9K_PYENV_FOREGROUND=37 - # Hide python version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PYENV_SOURCES=(shell local global) - # If set to false, hide python version if it's the same as global: - # $(pyenv version-name) == $(pyenv global). - typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide python version if it's equal to "system". - typeset -g POWERLEVEL9K_PYENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ goenv: go environment (https://github.com/syndbg/goenv) ]################ - # Goenv color. - typeset -g POWERLEVEL9K_GOENV_FOREGROUND=37 - # Hide go version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_GOENV_SOURCES=(shell local global) - # If set to false, hide go version if it's the same as global: - # $(goenv version-name) == $(goenv global). - typeset -g POWERLEVEL9K_GOENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide go version if it's equal to "system". - typeset -g POWERLEVEL9K_GOENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_GOENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ nodenv: node.js version from nodenv (https://github.com/nodenv/nodenv) ]########## - # Nodenv color. - typeset -g POWERLEVEL9K_NODENV_FOREGROUND=70 - # Hide node version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_NODENV_SOURCES=(shell local global) - # If set to false, hide node version if it's the same as global: - # $(nodenv version-name) == $(nodenv global). - typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide node version if it's equal to "system". - typeset -g POWERLEVEL9K_NODENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_NODENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]############### - # Nvm color. - typeset -g POWERLEVEL9K_NVM_FOREGROUND=70 - # Custom icon. - # typeset -g POWERLEVEL9K_NVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ############[ nodeenv: node.js environment (https://github.com/ekalinin/nodeenv) ]############ - # Nodeenv color. - typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=70 - # Don't show Node version next to the environment name. - typeset -g POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false - # Separate environment name from Node version only with a space. - typeset -g POWERLEVEL9K_NODEENV_{LEFT,RIGHT}_DELIMITER= - # Custom icon. - # typeset -g POWERLEVEL9K_NODEENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##############################[ node_version: node.js version ]############################### - # Node version color. - typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=70 - # Show node version only when in a directory tree containing package.json. - typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_NODE_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######################[ go_version: go version (https://golang.org) ]######################## - # Go version color. - typeset -g POWERLEVEL9K_GO_VERSION_FOREGROUND=37 - # Show go version only when in a go project subdirectory. - typeset -g POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_GO_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #################[ rust_version: rustc version (https://www.rust-lang.org) ]################## - # Rust version color. - typeset -g POWERLEVEL9K_RUST_VERSION_FOREGROUND=37 - # Show rust version only when in a rust project subdirectory. - typeset -g POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_RUST_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ dotnet_version: .NET version (https://dotnet.microsoft.com) ]################ - # .NET version color. - typeset -g POWERLEVEL9K_DOTNET_VERSION_FOREGROUND=134 - # Show .NET version only when in a .NET project subdirectory. - typeset -g POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_DOTNET_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #####################[ php_version: php version (https://www.php.net/) ]###################### - # PHP version color. - typeset -g POWERLEVEL9K_PHP_VERSION_FOREGROUND=99 - # Show PHP version only when in a PHP project subdirectory. - typeset -g POWERLEVEL9K_PHP_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_PHP_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ laravel_version: laravel php framework version (https://laravel.com/) ]########### - # Laravel version color. - typeset -g POWERLEVEL9K_LARAVEL_VERSION_FOREGROUND=161 - # Custom icon. - # typeset -g POWERLEVEL9K_LARAVEL_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ####################[ java_version: java version (https://www.java.com/) ]#################### - # Java version color. - typeset -g POWERLEVEL9K_JAVA_VERSION_FOREGROUND=32 - # Show java version only when in a java project subdirectory. - typeset -g POWERLEVEL9K_JAVA_VERSION_PROJECT_ONLY=true - # Show brief version. - typeset -g POWERLEVEL9K_JAVA_VERSION_FULL=false - # Custom icon. - # typeset -g POWERLEVEL9K_JAVA_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###[ package: name@version from package.json (https://docs.npmjs.com/files/package.json) ]#### - # Package color. - typeset -g POWERLEVEL9K_PACKAGE_FOREGROUND=117 - # Package format. The following parameters are available within the expansion. - # - # - P9K_PACKAGE_NAME The value of `name` field in package.json. - # - P9K_PACKAGE_VERSION The value of `version` field in package.json. - # - # typeset -g POWERLEVEL9K_PACKAGE_CONTENT_EXPANSION='${P9K_PACKAGE_NAME//\%/%%}@${P9K_PACKAGE_VERSION//\%/%%}' - # Custom icon. - # typeset -g POWERLEVEL9K_PACKAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]############## - # Rbenv color. - typeset -g POWERLEVEL9K_RBENV_FOREGROUND=168 - # Hide ruby version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_RBENV_SOURCES=(shell local global) - # If set to false, hide ruby version if it's the same as global: - # $(rbenv version-name) == $(rbenv global). - typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide ruby version if it's equal to "system". - typeset -g POWERLEVEL9K_RBENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######################[ rvm: ruby version from rvm (https://rvm.io) ]######################## - # Rvm color. - typeset -g POWERLEVEL9K_RVM_FOREGROUND=168 - # Don't show @gemset at the end. - typeset -g POWERLEVEL9K_RVM_SHOW_GEMSET=false - # Don't show ruby- at the front. - typeset -g POWERLEVEL9K_RVM_SHOW_PREFIX=false - # Custom icon. - # typeset -g POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ fvm: flutter version management (https://github.com/leoafarias/fvm) ]############ - # Fvm color. - typeset -g POWERLEVEL9K_FVM_FOREGROUND=38 - # Custom icon. - # typeset -g POWERLEVEL9K_FVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ luaenv: lua version from luaenv (https://github.com/cehoffman/luaenv) ]########### - # Lua color. - typeset -g POWERLEVEL9K_LUAENV_FOREGROUND=32 - # Hide lua version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_LUAENV_SOURCES=(shell local global) - # If set to false, hide lua version if it's the same as global: - # $(luaenv version-name) == $(luaenv global). - typeset -g POWERLEVEL9K_LUAENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide lua version if it's equal to "system". - typeset -g POWERLEVEL9K_LUAENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_LUAENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ jenv: java version from jenv (https://github.com/jenv/jenv) ]################ - # Java color. - typeset -g POWERLEVEL9K_JENV_FOREGROUND=32 - # Hide java version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_JENV_SOURCES=(shell local global) - # If set to false, hide java version if it's the same as global: - # $(jenv version-name) == $(jenv global). - typeset -g POWERLEVEL9K_JENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide java version if it's equal to "system". - typeset -g POWERLEVEL9K_JENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_JENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ plenv: perl version from plenv (https://github.com/tokuhirom/plenv) ]############ - # Perl color. - typeset -g POWERLEVEL9K_PLENV_FOREGROUND=67 - # Hide perl version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PLENV_SOURCES=(shell local global) - # If set to false, hide perl version if it's the same as global: - # $(plenv version-name) == $(plenv global). - typeset -g POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide perl version if it's equal to "system". - typeset -g POWERLEVEL9K_PLENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ############[ phpenv: php version from phpenv (https://github.com/phpenv/phpenv) ]############ - # PHP color. - typeset -g POWERLEVEL9K_PHPENV_FOREGROUND=99 - # Hide php version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PHPENV_SOURCES=(shell local global) - # If set to false, hide php version if it's the same as global: - # $(phpenv version-name) == $(phpenv global). - typeset -g POWERLEVEL9K_PHPENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide php version if it's equal to "system". - typeset -g POWERLEVEL9K_PHPENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]########### - # Haskell color. - typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=172 - # Hide haskell version if it doesn't come from one of these sources. - # - # shell: version is set by STACK_YAML - # local: version is set by stack.yaml up the directory tree - # global: version is set by the implicit global project (~/.stack/global-project/stack.yaml) - typeset -g POWERLEVEL9K_HASKELL_STACK_SOURCES=(shell local) - # If set to false, hide haskell version if it's the same as in the implicit global project. - typeset -g POWERLEVEL9K_HASKELL_STACK_ALWAYS_SHOW=true - # Custom icon. - # typeset -g POWERLEVEL9K_HASKELL_STACK_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # Example of a user-defined prompt segment. Function prompt_example will be called on every - # prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or - # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and orange text greeting the user. - # - # Type `p10k help segment` for documentation and a more sophisticated example. - function prompt_watson() { - local watson_status=$(watson status) - local noproject="No project started." - if [ "$watson_status" != "$noproject" ]; then - p10k segment -i "祥" -f yellow -t "$(echo $watson_status | awk '{print $2,$3}')" - else - p10k segment -i "⏾" -f red -t "" - fi - } - - function prompt_triton() { - local triton_profile=$(echo $TRITON_PROFILE) - if [ "$triton_profile" != "" ]; then - p10k segment -f yellow -t "$(echo "✚" "$triton_profile")" - fi - } - - # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt - # when accepting a command line. Supported values: - # - # - off: Don't change prompt when accepting a command line. - # - always: Trim down prompt when accepting a command line. - # - same-dir: Trim down prompt when accepting a command line unless this is the first command - # typed after changing current working directory. - typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always - - # Instant prompt mode. - # - # - off: Disable instant prompt. Choose this if you've tried instant prompt and found - # it incompatible with your zsh configuration files. - # - quiet: Enable instant prompt and don't print warnings when detecting console output - # during zsh initialization. Choose this if you've read and understood - # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt. - # - verbose: Enable instant prompt and print a warning when detecting console output during - # zsh initialization. Choose this if you've never tried instant prompt, haven't - # seen the warning, or if you are unsure what this all means. - typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose - - # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. - # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload - # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you - # really need it. - typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=false - - # If p10k is already loaded, reload configuration. - # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true. - (( ! $+functions[p10k] )) || p10k reload -} - -# Tell `p10k configure` which file it should overwrite. -typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a} - -(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} -'builtin' 'unset' 'p10k_config_opts' diff --git a/overlays/blesh.nix b/overlays/blesh.nix new file mode 100644 index 00000000..f3c93d73 --- /dev/null +++ b/overlays/blesh.nix @@ -0,0 +1,5 @@ +final: prev: { + blesh = prev.blesh.overrideAttrs (oldAttrs: rec { + inherit (prev.sources.blesh-nvfetcher) version src; + }); +} diff --git a/pkgs/_sources/generated.nix b/pkgs/_sources/generated.nix index 2d455cc8..dfe616d8 100644 --- a/pkgs/_sources/generated.nix +++ b/pkgs/_sources/generated.nix @@ -1,17 +1,19 @@ # This file was generated by nvfetcher, please do not modify it manually. { fetchgit, fetchurl, fetchFromGitHub, dockerTools }: { - F-Sy-H = { - pname = "F-Sy-H"; - version = "899f68b52b6b86a36cd8178eb0e9782d4aeda714"; + blesh-nvfetcher = { + pname = "blesh-nvfetcher"; + version = "f16c0d807c8e1fe26fa5d990b561829382cbdc72"; src = fetchFromGitHub { - owner = "z-shell"; - repo = "F-Sy-H"; - rev = "899f68b52b6b86a36cd8178eb0e9782d4aeda714"; - fetchSubmodules = false; - sha256 = "sha256-zhaXjrNL0amxexbZm4Kr5Y/feq1+2zW0O6eo9iZhmi0="; + owner = "akinomyoga"; + repo = "ble.sh"; + rev = "f16c0d807c8e1fe26fa5d990b561829382cbdc72"; + fetchSubmodules = true; + deepClone = false; + leaveDotGit = true; + sha256 = "sha256-+tcM1z9uD7WXA7CfHmTbcPRcZfmXZ+Y7y6Bj4QA3f+4="; }; - date = "2023-01-25"; + date = "2023-06-12"; }; instant-nvim-nvfetcher = { pname = "instant-nvim-nvfetcher"; @@ -37,30 +39,6 @@ }; date = "2021-04-20"; }; - ohmyzsh = { - pname = "ohmyzsh"; - version = "cb8b677488c7a20278917af58dfccd72cd40e1b1"; - src = fetchFromGitHub { - owner = "ohmyzsh"; - repo = "ohmyzsh"; - rev = "cb8b677488c7a20278917af58dfccd72cd40e1b1"; - fetchSubmodules = false; - sha256 = "sha256-c7tGTEdE8e1qD83Nxzno1VLAFV5gKoB4TJes4aVa2mY="; - }; - date = "2023-06-11"; - }; - powerlevel10k = { - pname = "powerlevel10k"; - version = "944f52fc430259ff49f497f3516a3ddfb45a0a6b"; - src = fetchFromGitHub { - owner = "romkatv"; - repo = "powerlevel10k"; - rev = "944f52fc430259ff49f497f3516a3ddfb45a0a6b"; - fetchSubmodules = false; - sha256 = "sha256-a2HTHvvI6aQXe/tzvd0P1IGWFFo64fMeKNX3TxMvCcc="; - }; - date = "2023-06-11"; - }; rnix-lsp-nvfetcher = { pname = "rnix-lsp-nvfetcher"; version = "95d40673fe43642e2e1144341e86d0036abd95d9"; @@ -133,16 +111,16 @@ }; date = "2022-07-03"; }; - zsh-nix-shell = { - pname = "zsh-nix-shell"; - version = "227d284ab2dc2f5153826974e0094a1990b1b5b9"; + waybar-nvfetcher = { + pname = "waybar-nvfetcher"; + version = "41164905351436db3a124207261f9dd759c6fa1b"; src = fetchFromGitHub { - owner = "chisui"; - repo = "zsh-nix-shell"; - rev = "227d284ab2dc2f5153826974e0094a1990b1b5b9"; + owner = "Alexays"; + repo = "Waybar"; + rev = "41164905351436db3a124207261f9dd759c6fa1b"; fetchSubmodules = false; - sha256 = "sha256-SrGvHsAJCxzi69CKNKKvItYUaAP7CKwRntsprVHBs4Y="; + sha256 = "sha256-aogiOj4pe2AJYxQFh8Dw6xQ2Tb6v4W9zwbGX4t2mStI="; }; - date = "2023-05-29"; + date = "2023-06-27"; }; } diff --git a/pkgs/sources.toml b/pkgs/sources.toml index 5ec5e936..ac9d5e1a 100644 --- a/pkgs/sources.toml +++ b/pkgs/sources.toml @@ -3,22 +3,6 @@ src.git = "https://github.com/mlvzk/manix" fetch.github = "mlvzk/manix" -[ohmyzsh] -src.git = "https://github.com/ohmyzsh/ohmyzsh" -fetch.github = "ohmyzsh/ohmyzsh" - -[powerlevel10k] -src.git = "https://github.com/romkatv/powerlevel10k" -fetch.github = "romkatv/powerlevel10k" - -[F-Sy-H] -src.git = "https://github.com/z-shell/F-Sy-H" -fetch.github = "z-shell/F-Sy-H" - -[zsh-nix-shell] -src.git = "https://github.com/chisui/zsh-nix-shell" -fetch.github = "chisui/zsh-nix-shell" - [rnix-lsp-nvfetcher] src.git = "https://github.com/nix-community/rnix-lsp" fetch.github = "nix-community/rnix-lsp" @@ -46,3 +30,13 @@ fetch.github = "zeekay/vim-beautify" [vim-apprentice-nvfetcher] src.git = "https://github.com/romainl/Apprentice" fetch.github = "romainl/Apprentice" + +[waybar-nvfetcher] +src.git = "https://github.com/Alexays/Waybar" +fetch.github = "Alexays/Waybar" + +[blesh-nvfetcher] +src.git = "https://github.com/akinomyoga/ble.sh" +fetch.github = "akinomyoga/ble.sh" +git.fetchSubmodules = true +git.leaveDotGit = true diff --git a/pkgs/sway-launcher.nix b/pkgs/sway-launcher.nix index aed2cd1e..abc7f443 100644 --- a/pkgs/sway-launcher.nix +++ b/pkgs/sway-launcher.nix @@ -1,7 +1,6 @@ self: with self; '' - #!/usr/bin/env zsh - # terminal application launcher for sway, using fzf + #!/usr/bin/env bash # original command: # Based on: https://github.com/swaywm/sway/issues/1367 # bindsym $altkey+space exec termite --name=launcher -e \ @@ -12,7 +11,7 @@ with self; '' # Get shell command list # This may include the occasional non-executable file - command_list=$({ whence -wm '*' | sed 's/:[^:]*$//' }) + command_list=$({ compgen -c | sed 's/:[^:]*$//'; }) # read existing command history if [ -f "$HIST_FILE" ]; then diff --git a/modules/terminal-life/zsh/base16.zsh b/profiles/base-user/.local/share/scripts/base16.sh similarity index 69% rename from modules/terminal-life/zsh/base16.zsh rename to profiles/base-user/.local/share/scripts/base16.sh index 3686b98d..ee33516b 100644 --- a/modules/terminal-life/zsh/base16.zsh +++ b/profiles/base-user/.local/share/scripts/base16.sh @@ -3,28 +3,28 @@ # Base16 Shell template by Chris Kempson (http://chriskempson.com) # Burn scheme by Benjamin Bädorf -color00="1a/18/1a" # Base 00 - Black -color01="f8/5e/84" # Base 08 - Red -color02="9e/cd/6f" # Base 0B - Green -color03="e5/c4/63" # Base 0A - Yellow -color04="7a/cc/d7" # Base 0D - Blue -color05="ab/9d/f2" # Base 0E - Magenta -color06="ef/90/62" # Base 0C - Cyan -color07="e3/e1/e4" # Base 05 - White -color08="94/94/94" # Base 03 - Bright Black -color09=$color01 # Base 08 - Bright Red -color10=$color02 # Base 0B - Bright Green -color11=$color03 # Base 0A - Bright Yellow -color12=$color04 # Base 0D - Bright Blue -color13=$color05 # Base 0E - Bright Magenta -color14=$color06 # Base 0C - Bright Cyan -color15="ff/5f/5f" # Base 07 - Bright White -color16="df/59/23" # Base 09 -color17="d7/00/00" # Base 0F -color18="2d/2a/2e" # Base 01 -color19="30/30/30" # Base 02 -color20="d3/d1/d4" # Base 04 -color21="30/30/30" # Base 06 +color00="1a/18/1a" # Base 00 - Black +color01="f8/5e/84" # Base 08 - Red +color02="9e/cd/6f" # Base 0B - Green +color03="e5/c4/63" # Base 0A - Yellow +color04="7a/cc/d7" # Base 0D - Blue +color05="ab/9d/f2" # Base 0E - Magenta +color06="ef/90/62" # Base 0C - Cyan +color07="e3/e1/e4" # Base 05 - White +color08="94/94/94" # Base 03 - Bright Black +color09=$color01 # Base 08 - Bright Red +color10=$color02 # Base 0B - Bright Green +color11=$color03 # Base 0A - Bright Yellow +color12=$color04 # Base 0D - Bright Blue +color13=$color05 # Base 0E - Bright Magenta +color14=$color06 # Base 0C - Bright Cyan +color15="ff/5f/5f" # Base 07 - Bright White +color16="df/59/23" # Base 09 +color17="d7/00/00" # Base 0F +color18="2d/2a/2e" # Base 01 +color19="30/30/30" # Base 02 +color20="d3/d1/d4" # Base 04 +color21="30/30/30" # Base 06 color_foreground="e3/e1/e4" # Base 05 color_background="1a/18/1a" # Base 00 @@ -50,16 +50,16 @@ else fi # 16 color space -put_template 0 $color00 -put_template 1 $color01 -put_template 2 $color02 -put_template 3 $color03 -put_template 4 $color04 -put_template 5 $color05 -put_template 6 $color06 -put_template 7 $color07 -put_template 8 $color08 -put_template 9 $color09 +put_template 0 $color00 +put_template 1 $color01 +put_template 2 $color02 +put_template 3 $color03 +put_template 4 $color04 +put_template 5 $color05 +put_template 6 $color06 +put_template 7 $color07 +put_template 8 $color08 +put_template 9 $color09 put_template 10 $color10 put_template 11 $color11 put_template 12 $color12 diff --git a/profiles/base-user/default.nix b/profiles/base-user/default.nix index 92e297d0..a2c82d97 100644 --- a/profiles/base-user/default.nix +++ b/profiles/base-user/default.nix @@ -31,7 +31,6 @@ in { if psCfg.user.password != null then psCfg.user.password else ""; - shell = pkgs.zsh; openssh.authorizedKeys.keys = if psCfg.user.publicKeys != null then psCfg.user.publicKeys diff --git a/profiles/base-user/home.nix b/profiles/base-user/home.nix index 9c964515..1da6ace5 100644 --- a/profiles/base-user/home.nix +++ b/profiles/base-user/home.nix @@ -26,7 +26,6 @@ in { fonts.fontconfig.enable = mkForce true; programs.dircolors.enable = true; - programs.dircolors.enableZshIntegration = true; home.file."xinitrc".source = ./.xinitrc; @@ -72,6 +71,8 @@ in { # docker run -it --name caddy-json-schema registry.greenbaum.cloud/gc/caddy-l4:2.5.2 caddy json-schema -output /srv/caddy_schema.json xdg.dataFile."nvim/json-schemas/caddy_schema.json".source = .local/share/nvim/json-schemas/caddy_schema.json; xdg.dataFile."nvim/templates/.keep".text = ""; + xdg.dataFile."scripts/.keep".text = ""; + xdg.dataFile."scripts/base16.sh".source = .local/share/scripts/base16.sh; xdg.dataFile."shell.nix.tmpl" = { text = '' let diff --git a/tests/first-test.nix b/tests/first-test.nix index a1da457d..248dd638 100644 --- a/tests/first-test.nix +++ b/tests/first-test.nix @@ -8,7 +8,7 @@ nodes.test-machine = {suites ? null, ...}: { imports = suites.iso; - home-manager.users.pub-solar.programs.zsh.shellAliases = { + home-manager.users.pub-solar.programs.bash.shellAliases = { test-x11 = "glinfo | tee /tmp/test-x11.out && touch /tmp/test-x11-exit-ok"; test-wayland = "wayland-info | tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok"; }; From c30c1700f41bb585fa3c0b7983cae74191f2f1d7 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 13:14:08 +0200 Subject: [PATCH 33/46] bash: replace $USER with ~ in PROMPT_COMMAND --- modules/terminal-life/bash/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index 9528aee9..c8d4eace 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -19,7 +19,7 @@ in { # Run when initializing an interactive shell initExtra = '' # Show current directory at the top in Alacritty - PROMPT_COMMAND='echo -e -n "\e]2;$(basename "$PWD")\e\\"' + PROMPT_COMMAND='echo -e -n "\e]2;$(basename "$PWD" | sed "s/${psCfg.user.name}/~/")\e\\"' # If a command is not found, show me where it is source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh From ea69c1d12c7404db08ce63b44626afe18820d496 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 02:50:01 +0200 Subject: [PATCH 34/46] neovim: use nixd as nix language server --- modules/terminal-life/nvim/default.nix | 4 ++-- modules/terminal-life/nvim/lsp.vim | 2 +- overlays/overrides.nix | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/terminal-life/nvim/default.nix b/modules/terminal-life/nvim/default.nix index 1afb5088..a2a2171a 100644 --- a/modules/terminal-life/nvim/default.nix +++ b/modules/terminal-life/nvim/default.nix @@ -25,6 +25,7 @@ in { ansible-language-server ccls gopls + nixd nodejs nodePackages.bash-language-server nodePackages.dockerfile-language-server-nodejs @@ -37,9 +38,8 @@ in { nodePackages.yaml-language-server python3Packages.python-lsp-server python3Full - solargraph - rnix-lsp rust-analyzer + solargraph terraform-ls universal-ctags ]; diff --git a/modules/terminal-life/nvim/lsp.vim b/modules/terminal-life/nvim/lsp.vim index 399e52e4..fb28b954 100644 --- a/modules/terminal-life/nvim/lsp.vim +++ b/modules/terminal-life/nvim/lsp.vim @@ -122,9 +122,9 @@ lua < Date: Sun, 2 Jul 2023 14:49:47 +0200 Subject: [PATCH 35/46] devshell: stash only unstaged changes in pre-commit hook --- shell/hooks/pre-commit.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/shell/hooks/pre-commit.sh b/shell/hooks/pre-commit.sh index 45efec25..558167eb 100755 --- a/shell/hooks/pre-commit.sh +++ b/shell/hooks/pre-commit.sh @@ -8,8 +8,18 @@ else fi # Stash only unstaged changes, keeping staged changes +# We have to stash two times, because: +# --keep-index also stashes the staged changes. +# The staged changes end up in both the stage AND the stash. +# https://overflow.hostux.net/questions/7650797/how-to-stash-only-unstaged-changes-in-git#60875082 old_stash=$(git rev-parse --quiet --verify refs/stash) -git stash push --quiet --keep-index -m 'Unstaged changes before pre-commit hook' +git stash push --quiet --staged --message "Staged changes before pre-commit hook" +git stash push --quiet --message "Unstaged changes before pre-commit hook" +if git stash show "stash@{1}" 2>/dev/null; then + git stash pop --quiet --index "stash@{1}" +else + git stash pop --quiet --index "stash@{0}" +fi new_stash=$(git rev-parse --quiet --verify refs/stash) diff="git diff-index --name-only --cached $against --diff-filter d" From 3d2aed46ab63ea090341995f505e17e76b75e3ca Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 15:16:02 +0200 Subject: [PATCH 36/46] neovim: trim final newline when copying to clipboard --- modules/terminal-life/nvim/clipboard.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/terminal-life/nvim/clipboard.vim b/modules/terminal-life/nvim/clipboard.vim index 7467dcc0..ee9cd4c3 100644 --- a/modules/terminal-life/nvim/clipboard.vim +++ b/modules/terminal-life/nvim/clipboard.vim @@ -5,8 +5,8 @@ let g:clipboard = { \ 'name': 'wayland-strip-carriage', \ 'copy': { - \ '+': 'wl-copy --foreground --type text/plain', - \ '*': 'wl-copy --foreground --type text/plain --primary', + \ '+': 'wl-copy --foreground --type text/plain --trim-newline', + \ '*': 'wl-copy --foreground --type text/plain --primary --trim-newline', \ }, \ 'paste': { \ '+': {-> systemlist('wl-paste --no-newline | tr -d "\r"')}, From 442ba900689be21ae3bdf4a510299b98cbff3935 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:15:15 +0200 Subject: [PATCH 37/46] chore: delete unused files --- modules/compat/default.nix | 12 ---- profiles/base-user/.gitignore | 111 ---------------------------------- 2 files changed, 123 deletions(-) delete mode 100644 modules/compat/default.nix delete mode 100644 profiles/base-user/.gitignore diff --git a/modules/compat/default.nix b/modules/compat/default.nix deleted file mode 100644 index 5c2dab36..00000000 --- a/modules/compat/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: -with lib; { - # Both things below are for - # https://github.com/NixOS/nixpkgs/issues/124215 - documentation.info.enable = lib.mkForce false; - nix.settings.extra-sandbox-paths = ["/bin/sh=${pkgs.bash}/bin/sh"]; -} diff --git a/profiles/base-user/.gitignore b/profiles/base-user/.gitignore deleted file mode 100644 index cd8e2eed..00000000 --- a/profiles/base-user/.gitignore +++ /dev/null @@ -1,111 +0,0 @@ -* - -!*.nix -!/.gitignore - -!/.zshrc -!/.Xdefaults -!/.Xresources -!/.xinitrc -!/.config - -!/assets -!/assets/wallpaper.jpg - -!/.config/dircolors - -!/.config/xmodmap - -!/.config/environment.d -!/.config/environment.d/profile.conf -!/.config/environment.d/drone.conf -!/.config/environment.d/restic.conf - -!/.config/user-dirs.dirs -!/.config/user-dirs.locale - -!/.config/gtk-2.0 -!/.config/gtk-2.0/gtkrc - -!/.config/gtk-3.0 -!/.config/gtk-3.0/settings.ini - -!/.config/xsettingsd -!/.config/xsettingsd/xsettingsd.conf - -!/.config/mako -!/.config/mako/config - -!/.config/alacritty -!/.config/alacritty/alacritty.yml - -!/.config/git -!/.config/git/config - -!/.config/vifm -!/.config/vifm/vifmrc -!/.config/vifm/scripts -!/.config/vifm/colors -!/.config/vifm/colors/base16.vifm - -!/.config/nvim -!/.config/nvim/init.vim -!/.config/nvim/clipboard.vim -!/.config/nvim/lsp.vim -!/.config/nvim/quickfixopenall.vim -!/.config/nvim/ui.vim - -!/.config/mimeapps.list - -!/.config/libinput-gestures.conf - -!/.config/sway -!/.config/sway/config -!/.config/sway/config.d -!/.config/sway/config.d/applications.conf -!/.config/sway/config.d/autostart.conf -!/.config/sway/config.d/colorscheme.conf -!/.config/sway/config.d/custom-keybindings.conf -!/.config/sway/config.d/gaps.conf -!/.config/sway/config.d/input-defaults.conf -!/.config/sway/config.d/systemd.conf -!/.config/sway/config.d/theme.conf -!/.config/sway/config.d/biolimo -!/.config/sway/config.d/biolimo/screens.conf -!/.config/sway/config.d/biolimo/inputs.conf -!/.config/sway/config.d/chocolatebar -!/.config/sway/config.d/chocolatebar/screens.conf - -!/.config/waybar -!/.config/waybar/colorscheme.css -!/.config/waybar/config -!/.config/waybar/style.css - -!/.config/mutt -!/.config/mutt/muttrc -!/.config/mutt/base16.muttrc -!/.config/mutt/mailcap - -!/.config/offlineimap -!/.config/offlineimap/functions.py - -!/.local -!/.local/bin -!/.local/bin/install-base -!/.local/bin/swaylock-bg -!/.local/bin/sway-launcher -!/.local/bin/sway-service -!/.local/bin/toggle-kbd-layout -!/.local/bin/wcwd -!/.local/bin/vifmrun -!/.local/bin/vifmimg -!/.local/bin/s -!/.local/bin/windows -!/.local/bin/import-gtk-settings -!/.local/bin/mailto-mutt -!/.local/bin/setup-host-conf -!/.local/bin/steam-xdg - -!/.local/share -!/.local/share/applications -!/.local/share/applications/userapp-Firefox.desktop From ead398b8350374189bba8bd087f5bcdc783e9d44 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:16:11 +0200 Subject: [PATCH 38/46] bash: use latest ble.sh version Use fzf for completion again Fix starship with newest ble.sh version, eval a second time after ble.sh --- modules/terminal-life/bash/default.nix | 8 +++++++- modules/terminal-life/fzf/default.nix | 5 +---- overlays/blesh.nix | 27 ++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index c8d4eace..3d0c7311 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -34,7 +34,7 @@ in { # Syntax highlighting, auto suggestions, vim modes, etc. # https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs - source "$(blesh-share)" --attach=none + source "$(blesh-share)"/ble.sh --attach=none # ctrl + space to accept autocomplete suggestion ble-bind -m 'auto_complete' -f 'C-@' 'auto_complete/insert-on-end' # Meta (Alt) + Backspace to delete a word @@ -59,6 +59,7 @@ in { } blehook/eval-after-load complete my/complete-load-hook + bleopt exec_elapsed_mark= bleopt exec_errexit_mark= bleopt filename_ls_colors="$LS_COLORS" @@ -84,6 +85,11 @@ in { fi # end of .bashrc + # Somehow we need to ensure starship starts later than ble.sh + # (possible packaging issue?) + # https://github.com/akinomyoga/ble.sh/issues/333 + eval "$(${pkgs.starship}/bin/starship init bash)" + [[ ''${BLE_VERSION-} ]] && ble-attach ''; diff --git a/modules/terminal-life/fzf/default.nix b/modules/terminal-life/fzf/default.nix index 88e60592..372e768d 100644 --- a/modules/terminal-life/fzf/default.nix +++ b/modules/terminal-life/fzf/default.nix @@ -10,8 +10,5 @@ "--color=fg:#d3d1d4,header:#7accd7,info:#e5c463,pointer:#ef9062" "--color=marker:#ef9062,fg+:#303030,prompt:#e5c463,hl+:#7accd7" ]; - # Use ble.sh for completions, see - # modules/terminal-life/bash/default.nix -> bleopt complete_menu_style=desc - # and https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion - enableBashIntegration = false; + enableBashIntegration = true; } diff --git a/overlays/blesh.nix b/overlays/blesh.nix index f3c93d73..f29c29ec 100644 --- a/overlays/blesh.nix +++ b/overlays/blesh.nix @@ -1,5 +1,32 @@ final: prev: { blesh = prev.blesh.overrideAttrs (oldAttrs: rec { inherit (prev.sources.blesh-nvfetcher) version src; + + dontBuild = false; + buildInputs = [prev.git]; + patchPhase = '' + substituteInPlace GNUmakefile \ + --replace "git submodule update --init --recursive" "" + ''; + nativeCheckInputs = oldAttrs.nativeCheckInputs ++ [prev.busybox]; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/share/blesh/lib" + + cat <"$out/share/blesh/lib/_package.sh" + _ble_base_package_type=nix + + function ble/base/package:nix/update { + echo "Ble.sh is installed by Nix. You can update it there." >&2 + return 1 + } + EOF + + make install INSDIR=$out/share/blesh + + runHook postInstall + ''; }); } From 62933459b96b9a6220f2dcc513f7a963664b6ad2 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:17:34 +0200 Subject: [PATCH 39/46] sway: add explanatory comment to launcher script --- pkgs/sway-launcher.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/sway-launcher.nix b/pkgs/sway-launcher.nix index abc7f443..8eddd857 100644 --- a/pkgs/sway-launcher.nix +++ b/pkgs/sway-launcher.nix @@ -1,6 +1,7 @@ self: with self; '' #!/usr/bin/env bash + # terminal application launcher for sway, using fzf # original command: # Based on: https://github.com/swaywm/sway/issues/1367 # bindsym $altkey+space exec termite --name=launcher -e \ From c73a49d4d2197c47d930946a5541b0751fcbeb16 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:18:05 +0200 Subject: [PATCH 40/46] nvfetcher: clean up unsused waybar entry --- pkgs/sources.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkgs/sources.toml b/pkgs/sources.toml index ac9d5e1a..929cecbc 100644 --- a/pkgs/sources.toml +++ b/pkgs/sources.toml @@ -31,10 +31,6 @@ fetch.github = "zeekay/vim-beautify" src.git = "https://github.com/romainl/Apprentice" fetch.github = "romainl/Apprentice" -[waybar-nvfetcher] -src.git = "https://github.com/Alexays/Waybar" -fetch.github = "Alexays/Waybar" - [blesh-nvfetcher] src.git = "https://github.com/akinomyoga/ble.sh" fetch.github = "akinomyoga/ble.sh" From ef0d7ca68d058709a395cae0cee093789e4c3aca Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:18:40 +0200 Subject: [PATCH 41/46] base-user: add to video group, less should use our keybindings --- profiles/base-user/default.nix | 5 +++-- profiles/base-user/home.nix | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/profiles/base-user/default.nix b/profiles/base-user/default.nix index a2c82d97..bd8815b0 100644 --- a/profiles/base-user/default.nix +++ b/profiles/base-user/default.nix @@ -21,11 +21,12 @@ in { isNormalUser = true; description = psCfg.user.description; extraGroups = [ - "wheel" "input" - "networkmanager" "lp" + "networkmanager" "scanner" + "video" + "wheel" ]; initialHashedPassword = if psCfg.user.password != null diff --git a/profiles/base-user/home.nix b/profiles/base-user/home.nix index 1da6ace5..52ee6fd5 100644 --- a/profiles/base-user/home.nix +++ b/profiles/base-user/home.nix @@ -27,6 +27,16 @@ in { programs.dircolors.enable = true; + programs.less = { + enable = true; + keys = '' + k forw-line + i back-line + K forw-scroll + I back-scroll + ''; + }; + home.file."xinitrc".source = ./.xinitrc; xdg.enable = true; From 002e6970edeff0a8d5afba4ed9629a13749f6fa5 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:28:52 +0200 Subject: [PATCH 42/46] flake: update lock file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated input 'darwin': 'github:LnL7/nix-darwin/7c16d31383a90e0e72ace0c35d2d66a18f90fb4f' (2023-06-09) → 'github:LnL7/nix-darwin/b06bab83bdf285ea0ae3c8e145a081eb95959047' (2023-07-02) • Updated input 'deploy': 'github:serokell/deploy-rs/65211db63ba1199f09b4c9f27e5eba5ec50d76ac' (2023-06-05) → 'github:serokell/deploy-rs/724463b5a94daa810abfc64a4f87faef4e00f984' (2023-06-14) • Updated input 'home': 'github:nix-community/home-manager/e753d659c64c7d158433d87ef7d6151ca1d1817a' (2023-06-12) → 'github:nix-community/home-manager/07c347bb50994691d7b0095f45ebd8838cf6bc38' (2023-06-27) • Updated input 'latest': 'github:nixos/nixpkgs/75a5ebf473cd60148ba9aec0d219f72e5cf52519' (2023-06-11) → 'github:nixos/nixpkgs/645ff62e09d294a30de823cb568e9c6d68e92606' (2023-07-01) • Updated input 'nixos': 'github:nixos/nixpkgs/d3bb401dcfc5a46ce51cdfb5762e70cc75d082d2' (2023-06-10) → 'github:nixos/nixpkgs/b72aa95f7f096382bff3aea5f8fde645bca07422' (2023-06-30) • Updated input 'nixos-hardware': 'github:nixos/nixos-hardware/2a807ad6e8dc458db08588b78cc3c0f0ec4ff321' (2023-06-11) → 'github:nixos/nixos-hardware/429f232fe1dc398c5afea19a51aad6931ee0fb89' (2023-06-15) • Updated input 'nvfetcher': 'github:berberman/nvfetcher/c5ae2cb436a04f4590306589e71638d023a33bd4' (2023-05-27) → 'github:berberman/nvfetcher/44196458acc2c28c32e456c50277d6148e71e708' (2023-06-22) • Updated input 'nvfetcher/flake-utils': 'github:numtide/flake-utils/cfacdce06f30d2b68473a46042957675eebb3401' (2023-04-11) → 'github:numtide/flake-utils/abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c' (2023-06-19) --- flake.lock | 69 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 24 deletions(-) diff --git a/flake.lock b/flake.lock index f1d08d5c..b50347fc 100644 --- a/flake.lock +++ b/flake.lock @@ -30,11 +30,11 @@ ] }, "locked": { - "lastModified": 1686307493, - "narHash": "sha256-R4VEFnDn7nRmNxAu1LwNbjns5DPM8IBsvnrWmZ8ymPs=", + "lastModified": 1688307440, + "narHash": "sha256-7PTjbN+/+b799YN7Tk2SS5Vh8A0L3gBo8hmB7Y0VXug=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "7c16d31383a90e0e72ace0c35d2d66a18f90fb4f", + "rev": "b06bab83bdf285ea0ae3c8e145a081eb95959047", "type": "github" }, "original": { @@ -54,11 +54,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1685948350, - "narHash": "sha256-1FldJ059so0X/rScdbIiOlQbjjSNCCTdj2cUr5pHU4A=", + "lastModified": 1686747123, + "narHash": "sha256-XUQK9kwHpTeilHoad7L4LjMCCyY13Oq383CoFADecRE=", "owner": "serokell", "repo": "deploy-rs", - "rev": "65211db63ba1199f09b4c9f27e5eba5ec50d76ac", + "rev": "724463b5a94daa810abfc64a4f87faef4e00f984", "type": "github" }, "original": { @@ -202,11 +202,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1687171271, + "narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c", "type": "github" }, "original": { @@ -222,11 +222,11 @@ ] }, "locked": { - "lastModified": 1686582345, - "narHash": "sha256-z4wLfa++k1d7Y/tQpQYub1D0K0OO9Wju0FZ8U53KUE0=", + "lastModified": 1687871164, + "narHash": "sha256-bBFlPthuYX322xOlpJvkjUBz0C+MOBjZdDOOJJ+G2jU=", "owner": "nix-community", "repo": "home-manager", - "rev": "e753d659c64c7d158433d87ef7d6151ca1d1817a", + "rev": "07c347bb50994691d7b0095f45ebd8838cf6bc38", "type": "github" }, "original": { @@ -236,13 +236,34 @@ "type": "github" } }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1682203081, + "narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "latest": { "locked": { - "lastModified": 1686501370, - "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", + "lastModified": 1688231357, + "narHash": "sha256-ZOn16X5jZ6X5ror58gOJAxPfFLAQhZJ6nOUeS4tfFwo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", + "rev": "645ff62e09d294a30de823cb568e9c6d68e92606", "type": "github" }, "original": { @@ -254,11 +275,11 @@ }, "nixos": { "locked": { - "lastModified": 1686431482, - "narHash": "sha256-oPVQ/0YP7yC2ztNsxvWLrV+f0NQ2QAwxbrZ+bgGydEM=", + "lastModified": 1688109178, + "narHash": "sha256-BSdeYp331G4b1yc7GIRgAnfUyaktW2nl7k0C577Tttk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d3bb401dcfc5a46ce51cdfb5762e70cc75d082d2", + "rev": "b72aa95f7f096382bff3aea5f8fde645bca07422", "type": "github" }, "original": { @@ -270,11 +291,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1686452266, - "narHash": "sha256-zLKiX0iu6jZFeZDpR1gE6fNyMr8eiM8GLnj9SoUCjFs=", + "lastModified": 1686838567, + "narHash": "sha256-aqKCUD126dRlVSKV6vWuDCitfjFrZlkwNuvj5LtjRRU=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "2a807ad6e8dc458db08588b78cc3c0f0ec4ff321", + "rev": "429f232fe1dc398c5afea19a51aad6931ee0fb89", "type": "github" }, "original": { @@ -310,11 +331,11 @@ ] }, "locked": { - "lastModified": 1685158767, - "narHash": "sha256-vgyu3jsnGDDAEYg4y/oFk2IaTCXUlce0ZaLtQprhmFk=", + "lastModified": 1687440270, + "narHash": "sha256-aOAXvfVn+MBSkU+xlQEiyoGpRaF6NvQdpWIhw5OH/Dc=", "owner": "berberman", "repo": "nvfetcher", - "rev": "c5ae2cb436a04f4590306589e71638d023a33bd4", + "rev": "44196458acc2c28c32e456c50277d6148e71e708", "type": "github" }, "original": { From 6bc4cd72e94622ff51464d44eb604c27784ca40e Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:29:27 +0200 Subject: [PATCH 43/46] nvfetcher: bump sources From be42efff5074d3d67f2f48f4eb6bda82f33167bc Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:37:07 +0200 Subject: [PATCH 44/46] nvfetcher: update sources --- pkgs/_sources/generated.nix | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/pkgs/_sources/generated.nix b/pkgs/_sources/generated.nix index dfe616d8..4a9c9654 100644 --- a/pkgs/_sources/generated.nix +++ b/pkgs/_sources/generated.nix @@ -3,17 +3,17 @@ { blesh-nvfetcher = { pname = "blesh-nvfetcher"; - version = "f16c0d807c8e1fe26fa5d990b561829382cbdc72"; + version = "1afc616b890e487926897e5b3e3a33e0ad833cb3"; src = fetchFromGitHub { owner = "akinomyoga"; repo = "ble.sh"; - rev = "f16c0d807c8e1fe26fa5d990b561829382cbdc72"; + rev = "1afc616b890e487926897e5b3e3a33e0ad833cb3"; fetchSubmodules = true; deepClone = false; leaveDotGit = true; - sha256 = "sha256-+tcM1z9uD7WXA7CfHmTbcPRcZfmXZ+Y7y6Bj4QA3f+4="; + sha256 = "sha256-gDxx7nDleS2HWIJWc208gcTzuRUEu/JCyepTuOJDAGo="; }; - date = "2023-06-12"; + date = "2023-06-29"; }; instant-nvim-nvfetcher = { pname = "instant-nvim-nvfetcher"; @@ -111,16 +111,4 @@ }; date = "2022-07-03"; }; - waybar-nvfetcher = { - pname = "waybar-nvfetcher"; - version = "41164905351436db3a124207261f9dd759c6fa1b"; - src = fetchFromGitHub { - owner = "Alexays"; - repo = "Waybar"; - rev = "41164905351436db3a124207261f9dd759c6fa1b"; - fetchSubmodules = false; - sha256 = "sha256-aogiOj4pe2AJYxQFh8Dw6xQ2Tb6v4W9zwbGX4t2mStI="; - }; - date = "2023-06-27"; - }; } From b2d0c80f79df6483edde0419063f8b7c39189e9d Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 17:56:17 +0200 Subject: [PATCH 45/46] flake: fix broken deploy-rs usage Still doesn't use deploy-rs from nixpkgs because of usage in digga: https://github.com/divnix/digga/blob/main/src/generators.nix#L77 --- flake.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 5394598d..d6cf85a8 100644 --- a/flake.nix +++ b/flake.nix @@ -65,11 +65,10 @@ nixos = { imports = [(digga.lib.importOverlays ./overlays)]; overlays = [ - deploy.overlay (self: super: { deploy-rs = { inherit (inputs.nixos.legacyPackages.x86_64-linux) deploy-rs; - lib = super.deploy-rs.lib; + lib = inputs.deploy.lib.x86_64-linux; }; }) ]; @@ -171,7 +170,7 @@ # profilesOrder = ["system" "direnv"]; # profiles.direnv = { # user = "bartender"; - # path = self.channels.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.bartender; + # path = self.pkgs.x86_64-linux.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.bartender; # }; #}; }; From 3c3abec2380b1e9f8a96242e29027b6c4cf49450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Thu, 13 Jul 2023 16:59:22 +0200 Subject: [PATCH 46/46] fix: move pre-commit treefmt hook into CI The logic inside the hook was rather broken, causing confusing merges, stashes, and aborts. Unfortunately `treefmt` does not provide a pure lint option that checks without writing the changes. So instead, we do this in CI. --- .drone.yml | 4 +++- .editorconfig | 3 +++ CONTRIBUTING.md | 13 +++++++---- shell/hooks/pre-commit.sh | 49 ++++----------------------------------- 4 files changed, 20 insertions(+), 49 deletions(-) diff --git a/.drone.yml b/.drone.yml index 35f2e30d..f83a5264 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,6 +15,8 @@ steps: commands: - 'echo DEBUG: Using NIX_FLAGS: $NIX_FLAGS' - nix $$NIX_FLAGS develop --command nix flake show + - nix $$NIX_FLAGS develop --command treefmt --fail-on-change + - nix $$NIX_FLAGS develop --command editorconfig-checker - nix $$NIX_FLAGS build ".#nixosConfigurations.PubSolarOS.config.system.build.toplevel" --- @@ -147,6 +149,6 @@ volumes: --- kind: signature -hmac: 6aee0ffe22111bb629c0a79940bfbc3fa75f68c5ed5c4bba68abf6797b87a7ab +hmac: a116f78a0b22188052893bdb46aa40f8de66438826c10ced362ea183d7644d67 ... diff --git a/.editorconfig b/.editorconfig index 96e5188b..91e0b45f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,6 +15,9 @@ end_of_line = unset insert_final_newline = unset trim_trailing_whitespace = unset indent_size = unset +charset = unset +indent_style = unset +indent_size = unset [{.*,secrets}/**] end_of_line = unset diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8283019b..07957e7c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,28 +1,33 @@ # Quick branch overview + We work with several branches in this repo. This document aims to explain how to contribute changes to the existing branches. ### `main` branch + - Changes to `modules` and `profiles` should go [the main branch](https://git.pub.solar/pub-solar/os/src/branch/main) - Changes can get accepted via: Pull Request - Branch protected from direct `git push` ### `infra` branch + - Changes to the [pub.solar](https://pub.solar) infrastructure should be merged [into this branch](https://git.pub.solar/pub-solar/os/src/branch/infra) - Changes can get accepted via: Pull Request - Branch protected from direct `git push` ### `momo/main` branch + - Changes to the [Momo](https://momo.koeln) infrastructure should be merged [into this branch](https://git.pub.solar/pub-solar/os/src/branch/momo/main) - Changes can get accepted via: Pull Request - Deployment of changes is [automatic via CI pipeline](https://git.pub.solar/pub-solar/os/src/commit/43bd7421509f7cc9ba06d7c740f3f536a4a2af76/.drone.yml#L20-L38) - Branch protected from direct `git push` ### `$USER` branches + - User's custom hosts and changes can be worked on in these branches - Direct `git push` possible - Examples: - - [hensoko](https://git.pub.solar/pub-solar/os/src/branch/hensoko) - - [b12f](https://git.pub.solar/pub-solar/os/src/branch/b12f) - - [axeman](https://git.pub.solar/pub-solar/os/src/branch/axeman) - - [teutat3s](https://git.pub.solar/pub-solar/os/src/branch/teutat3s) + - [hensoko](https://git.pub.solar/pub-solar/os/src/branch/hensoko) + - [b12f](https://git.pub.solar/pub-solar/os/src/branch/b12f) + - [axeman](https://git.pub.solar/pub-solar/os/src/branch/axeman) + - [teutat3s](https://git.pub.solar/pub-solar/os/src/branch/teutat3s) diff --git a/shell/hooks/pre-commit.sh b/shell/hooks/pre-commit.sh index 558167eb..27fff872 100755 --- a/shell/hooks/pre-commit.sh +++ b/shell/hooks/pre-commit.sh @@ -1,48 +1,9 @@ #!/usr/bin/env bash -if git rev-parse --verify HEAD >/dev/null 2>&1; then - against=HEAD -else - # Initial commit: diff against an empty tree object - against=$(${git}/bin/git hash-object -t tree /dev/null) -fi - -# Stash only unstaged changes, keeping staged changes -# We have to stash two times, because: -# --keep-index also stashes the staged changes. -# The staged changes end up in both the stage AND the stash. -# https://overflow.hostux.net/questions/7650797/how-to-stash-only-unstaged-changes-in-git#60875082 -old_stash=$(git rev-parse --quiet --verify refs/stash) -git stash push --quiet --staged --message "Staged changes before pre-commit hook" -git stash push --quiet --message "Unstaged changes before pre-commit hook" -if git stash show "stash@{1}" 2>/dev/null; then - git stash pop --quiet --index "stash@{1}" -else - git stash pop --quiet --index "stash@{0}" -fi -new_stash=$(git rev-parse --quiet --verify refs/stash) - -diff="git diff-index --name-only --cached $against --diff-filter d" - -mapfile -t all_files < <($diff) - -# Format staged files -if ((${#all_files[@]} != 0)); then - treefmt "${all_files[@]}" && - git add "${all_files[@]}" -fi - -# If unstaged changes were stashed re-apply to working tree -if [ "$old_stash" != "$new_stash" ]; then - git stash pop --quiet -fi - # Check editorconfig -if ((${#all_files[@]} != 0)); then - if ! editorconfig-checker -- "${all_files[@]}"; then - printf "%b\n" \ - "\nCode is not aligned with .editorconfig" \ - "Review the output and commit your fixes" >&2 - exit 1 - fi +if ! editorconfig-checker; then + printf "%b\n" \ + "\nCode is not aligned with .editorconfig" \ + "Review the output and commit your fixes" >&2 + exit 1 fi