From c4ffe02cf7e79923ff9ac6d215a614c450ec9935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Tue, 25 Apr 2023 19:56:36 +0100 Subject: [PATCH] use autogenerated theme --- config/home-manager/.p10k.zsh | 545 ++++++++--------- config/home-manager/base.nix | 2 + config/nutty-noon.nix | 1 + config/programs/sway.nix | 26 - config/programs/theming.nix | 125 ++-- config/services/wordpress.nix | 10 +- flake.lock | 49 ++ flake.nix | 10 + modules/wordpress.nix | 1030 +++++++++++++++++---------------- 9 files changed, 933 insertions(+), 865 deletions(-) diff --git a/config/home-manager/.p10k.zsh b/config/home-manager/.p10k.zsh index c662eac9..d4267f6f 100644 --- a/config/home-manager/.p10k.zsh +++ b/config/home-manager/.p10k.zsh @@ -1,12 +1,12 @@ -# Generated by Powerlevel10k configuration wizard on 2022-01-15 at 15:57 UTC. -# Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh. -# Wizard options: nerdfont-complete + powerline, small icons, rainbow, unicode, -# 24h time, round separators, sharp heads, flat tails, 2 lines, dotted, full frame, -# light-ornaments, sparse, many icons, fluent, transient_prompt, instant_prompt=verbose. +# Generated by Powerlevel10k configuration wizard on 2023-04-25 at 19:48 +01. +# Based on romkatv/powerlevel10k/config/p10k-classic.zsh. +# Wizard options: nerdfont-complete + powerline, small icons, classic, unicode, +# lightest, 24h time, angled separators, sharp heads, round tails, 2 lines, dotted, +# full frame, sparse, many icons, fluent, transient_prompt, instant_prompt=verbose. # Type `p10k configure` to generate another config. # -# Config for Powerlevel10k with powerline prompt style with colorful background. -# Type `p10k configure` to generate your own config based on it. +# 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. # @@ -27,7 +27,7 @@ unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' # Zsh >= 5.1 is required. - autoload -Uz is-at-least && is-at-least 5.1 || return + [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return # The list of segments shown on the left. Fill it with the most important segments. typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( @@ -72,20 +72,24 @@ luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv) jenv # java version from jenv (https://github.com/jenv/jenv) plenv # perl version from plenv (https://github.com/tokuhirom/plenv) + perlbrew # perl version from perlbrew (https://github.com/gugod/App-perlbrew) phpenv # php version from phpenv (https://github.com/phpenv/phpenv) scalaenv # scala version from scalaenv (https://github.com/scalaenv/scalaenv) haskell_stack # haskell version from stack (https://haskellstack.org/) kubecontext # current kubernetes context (https://kubernetes.io/) terraform # terraform workspace (https://www.terraform.io) + # terraform_version # terraform version (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) + toolbox # toolbox name (https://github.com/containers/toolbox) context # user@hostname nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) ranger # ranger shell (https://github.com/ranger/ranger) nnn # nnn shell (https://github.com/jarun/nnn) + lf # lf shell (https://github.com/gokcehan/lf) xplr # xplr shell (https://github.com/sayanarijit/xplr) vim_shell # vim shell indicator (:sh) midnight_commander # midnight commander shell (https://midnight-commander.org/) @@ -99,9 +103,10 @@ todo # todo items (https://github.com/todotxt/todo.txt-cli) timewarrior # timewarrior tracking status (https://timewarrior.net/) taskwarrior # taskwarrior task count (https://taskwarrior.org/) + # cpu_arch # CPU architecture time # current time # =========================[ Line #2 ]========================= - newline + newline # \n # ip # ip address and bandwidth usage for a specified network interface # public_ip # public IP address # proxy # system-wide http/https/ftp proxy @@ -134,54 +139,56 @@ # 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='%242F╭─' - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX='%242F├─' - typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='%242F╰─' + typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='%244F╭─' + typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX='%244F├─' + typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='%244F╰─' # Connect right prompt lines with these symbols. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX='%242F─╮' - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX='%242F─┤' - typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX='%242F─╯' + typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX='%244F─╮' + typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX='%244F─┤' + typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX='%244F─╯' # 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. + # for more compact prompt if using this option. typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR='·' typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_BACKGROUND= typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_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=242 + typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=244 # 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=240 + # Separator between same-color segments on the left. - typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='\uE0B5' + typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='%250F\uE0B1' # Separator between same-color segments on the right. - typeset -g POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='\uE0B7' + typeset -g POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='%250F\uE0B3' # Separator between different-color segments on the left. - typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0B4' + typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0B0' # Separator between different-color segments on the right. - typeset -g POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0B6' + 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='' + typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B6' # The right end of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL='' + typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B4' # 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=232 - typeset -g POWERLEVEL9K_OS_ICON_BACKGROUND=7 + typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=255 # Custom icon. # typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='⭐' @@ -209,20 +216,18 @@ typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_{LEFT,RIGHT}_WHITESPACE= ##################################[ dir: current directory ]################################## - # Current directory background color. - typeset -g POWERLEVEL9K_DIR_BACKGROUND=4 - # Default current directory foreground color. - typeset -g POWERLEVEL9K_DIR_FOREGROUND=254 + # Default current directory color. + typeset -g POWERLEVEL9K_DIR_FOREGROUND=31 # 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 # Replace removed segment suffixes with this symbol. typeset -g POWERLEVEL9K_SHORTEN_DELIMITER= # Color of the shortened directory segments. - typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=250 + typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=103 # Color of the anchor directory segments. Anchor segments are never shortened. The first # segment is always an anchor. - typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=255 + typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=39 # Display anchor directory segments in bold. typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true # Don't shorten directories that contain any of these files. They are anchors. @@ -319,24 +324,21 @@ # # # Styling for WORK. # typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_BACKGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=254 - # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=250 - # typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=255 + # typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=31 + # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103 + # typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=39 # # # Styling for WORK_NOT_WRITABLE. # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_BACKGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=254 - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=250 - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=255 + # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=31 + # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=103 + # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=39 # # # Styling for WORK_NON_EXISTENT. # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_BACKGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_FOREGROUND=254 - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_SHORTENED_FOREGROUND=250 - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_ANCHOR_FOREGROUND=255 + # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_FOREGROUND=31 + # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_SHORTENED_FOREGROUND=103 + # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_ANCHOR_FOREGROUND=39 # # If a styling parameter isn't explicitly defined for some class, it falls back to the classless # parameter. For example, if POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND is not set, it falls @@ -345,17 +347,10 @@ # typeset -g POWERLEVEL9K_DIR_CLASSES=() # Custom prefix. - # typeset -g POWERLEVEL9K_DIR_PREFIX='in ' + # typeset -g POWERLEVEL9K_DIR_PREFIX='%250Fin ' #####################################[ vcs: git status ]###################################### - # Version control system colors. - typeset -g POWERLEVEL9K_VCS_CLEAN_BACKGROUND=2 - typeset -g POWERLEVEL9K_VCS_MODIFIED_BACKGROUND=3 - typeset -g POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND=2 - typeset -g POWERLEVEL9K_VCS_CONFLICTED_BACKGROUND=3 - typeset -g POWERLEVEL9K_VCS_LOADING_BACKGROUND=8 - - # Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon. + # Branch icon. Set this parameter to '\UE0A0 ' for the popular Powerline branch icon. typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='\uF126 ' # Untracked files icon. It's really a question mark, your font isn't broken. @@ -380,12 +375,21 @@ return fi - # Styling for different parts of Git status. - local meta='%7F' # white foreground - local clean='%0F' # black foreground - local modified='%0F' # black foreground - local untracked='%0F' # black foreground - local conflicted='%1F' # red foreground + if (( $1 )); then + # Styling for up-to-date Git status. + local meta='%250F' # grey foreground + local clean='%76F' # green foreground + local modified='%178F' # yellow foreground + local untracked='%39F' # blue foreground + local conflicted='%196F' # red foreground + else + # Styling for incomplete and stale Git status. + local meta='%244F' # grey foreground + local clean='%244F' # grey foreground + local modified='%244F' # grey foreground + local untracked='%244F' # grey foreground + local conflicted='%244F' # grey foreground + fi local res @@ -478,20 +482,30 @@ # 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()))+${my_git_format}}' + 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=76 + typeset -g POWERLEVEL9K_VCS_LOADING_VISUAL_IDENTIFIER_COLOR=244 # Custom icon. # typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION='⭐' # Custom prefix. - typeset -g POWERLEVEL9K_VCS_PREFIX='on ' + typeset -g POWERLEVEL9K_VCS_PREFIX='%250Fon ' # 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 repositories other than Git or when gitstatusd fails and + # Powerlevel10k has to fall back to using vcs_info. + typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=76 + typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=76 + typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=178 + ##########################[ 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. @@ -500,76 +514,66 @@ # 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='✔' - typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=2 - typeset -g POWERLEVEL9K_STATUS_OK_BACKGROUND=0 # 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='✔' - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=2 - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_BACKGROUND=0 # 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='✘' - typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=3 - typeset -g POWERLEVEL9K_STATUS_ERROR_BACKGROUND=1 # 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='✘' - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=3 - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_BACKGROUND=1 # 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='✘' - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=3 - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_BACKGROUND=1 ###################[ command_execution_time: duration of the last command ]################### - # Execution time color. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=0 - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND=3 # Show duration of the last command if takes at least 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=248 # 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='took ' + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='%250Ftook ' #######################[ background_jobs: presence of background jobs ]####################### - # Background jobs color. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=6 - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_BACKGROUND=0 # 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=3 - typeset -g POWERLEVEL9K_DIRENV_BACKGROUND=0 + 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). - # Tip: Override these parameters for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_FOREGROUND and - # POWERLEVEL9K_ASDF_${TOOL}_BACKGROUND. - typeset -g POWERLEVEL9K_ASDF_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_BACKGROUND=7 + # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_FOREGROUND. + 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 @@ -627,105 +631,88 @@ typeset -g POWERLEVEL9K_ASDF_SHOW_ON_UPGLOB= # Ruby version from asdf. - typeset -g POWERLEVEL9K_ASDF_RUBY_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_RUBY_BACKGROUND=1 + 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=0 - typeset -g POWERLEVEL9K_ASDF_PYTHON_BACKGROUND=4 + 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=0 - typeset -g POWERLEVEL9K_ASDF_GOLANG_BACKGROUND=4 + 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=0 - typeset -g POWERLEVEL9K_ASDF_NODEJS_BACKGROUND=2 + 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=0 - typeset -g POWERLEVEL9K_ASDF_RUST_BACKGROUND=208 + 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=0 - typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_BACKGROUND=5 + 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=0 - typeset -g POWERLEVEL9K_ASDF_FLUTTER_BACKGROUND=4 + 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=0 - typeset -g POWERLEVEL9K_ASDF_LUA_BACKGROUND=4 + 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=1 - typeset -g POWERLEVEL9K_ASDF_JAVA_BACKGROUND=7 + 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=0 - typeset -g POWERLEVEL9K_ASDF_PERL_BACKGROUND=4 + 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=0 - typeset -g POWERLEVEL9K_ASDF_ERLANG_BACKGROUND=1 + 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=0 - typeset -g POWERLEVEL9K_ASDF_ELIXIR_BACKGROUND=5 + 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=0 - typeset -g POWERLEVEL9K_ASDF_POSTGRES_BACKGROUND=6 + 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=0 - typeset -g POWERLEVEL9K_ASDF_PHP_BACKGROUND=5 + 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=0 - typeset -g POWERLEVEL9K_ASDF_HASKELL_BACKGROUND=3 + 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' # Julia version from asdf. - typeset -g POWERLEVEL9K_ASDF_JULIA_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_JULIA_BACKGROUND=2 + typeset -g POWERLEVEL9K_ASDF_JULIA_FOREGROUND=70 # typeset -g POWERLEVEL9K_ASDF_JULIA_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_JULIA_SHOW_ON_UPGLOB='*.foo|*.bar' ##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]########### # NordVPN connection indicator color. - typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=7 - typeset -g POWERLEVEL9K_NORDVPN_BACKGROUND=4 + typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=39 # Hide NordVPN connection indicator when not connected. typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_CONTENT_EXPANSION= typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_VISUAL_IDENTIFIER_EXPANSION= @@ -734,43 +721,43 @@ #################[ ranger: ranger shell (https://github.com/ranger/ranger) ]################## # Ranger shell color. - typeset -g POWERLEVEL9K_RANGER_FOREGROUND=3 - typeset -g POWERLEVEL9K_RANGER_BACKGROUND=0 + typeset -g POWERLEVEL9K_RANGER_FOREGROUND=178 # Custom icon. # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' ######################[ nnn: nnn shell (https://github.com/jarun/nnn) ]####################### # Nnn shell color. - typeset -g POWERLEVEL9K_NNN_FOREGROUND=0 - typeset -g POWERLEVEL9K_NNN_BACKGROUND=6 + typeset -g POWERLEVEL9K_NNN_FOREGROUND=72 # Custom icon. # typeset -g POWERLEVEL9K_NNN_VISUAL_IDENTIFIER_EXPANSION='⭐' + ######################[ lf: lf shell (https://github.com/gokcehan/lf) ]####################### + # lf shell color. + typeset -g POWERLEVEL9K_LF_FOREGROUND=72 + # Custom icon. + # typeset -g POWERLEVEL9K_LF_VISUAL_IDENTIFIER_EXPANSION='⭐' + ##################[ xplr: xplr shell (https://github.com/sayanarijit/xplr) ]################## # xplr shell color. - typeset -g POWERLEVEL9K_XPLR_FOREGROUND=0 - typeset -g POWERLEVEL9K_XPLR_BACKGROUND=6 + typeset -g POWERLEVEL9K_XPLR_FOREGROUND=72 # Custom icon. # typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐' ###########################[ vim_shell: vim shell indicator (:sh) ]########################### # Vim shell indicator color. - typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=0 - typeset -g POWERLEVEL9K_VIM_SHELL_BACKGROUND=2 + typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34 # Custom icon. # typeset -g POWERLEVEL9K_VIM_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' ######[ midnight_commander: midnight commander shell (https://midnight-commander.org/) ]###### # Midnight Commander shell color. - typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_FOREGROUND=3 - typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_BACKGROUND=0 + typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_FOREGROUND=178 # Custom icon. # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐' #[ nix_shell: nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) ]## # Nix shell color. - typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=0 - typeset -g POWERLEVEL9K_NIX_SHELL_BACKGROUND=4 + 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= @@ -780,12 +767,9 @@ ##################################[ disk_usage: disk usage ]################################## # Colors for different levels of disk usage. - typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=3 - typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_BACKGROUND=0 - typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=0 - typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_BACKGROUND=3 - typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=7 - typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_BACKGROUND=1 + typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35 + typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=220 + typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=160 # Thresholds for different levels of disk usage (percentage points). typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90 typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95 @@ -795,32 +779,31 @@ # typeset -g POWERLEVEL9K_DISK_USAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' ###########[ vi_mode: vi mode (you don't need this if you've enabled prompt_char) ]########### - # Foreground color. - typeset -g POWERLEVEL9K_VI_MODE_FOREGROUND=0 # Text and color for normal (a.k.a. command) vi mode. typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL - typeset -g POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND=2 + typeset -g POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND=106 # Text and color for visual vi mode. typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=VISUAL - typeset -g POWERLEVEL9K_VI_MODE_VISUAL_BACKGROUND=4 + typeset -g POWERLEVEL9K_VI_MODE_VISUAL_FOREGROUND=68 # Text and color for overtype (a.k.a. overwrite and replace) vi mode. typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERTYPE - typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_BACKGROUND=3 + typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_FOREGROUND=172 # Text and color for insert vi mode. typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING= - typeset -g POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=8 + typeset -g POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=66 + + # Custom icon. + # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' ######################################[ ram: free RAM ]####################################### # RAM color. - typeset -g POWERLEVEL9K_RAM_FOREGROUND=0 - typeset -g POWERLEVEL9K_RAM_BACKGROUND=3 + typeset -g POWERLEVEL9K_RAM_FOREGROUND=66 # Custom icon. # typeset -g POWERLEVEL9K_RAM_VISUAL_IDENTIFIER_EXPANSION='⭐' #####################################[ swap: used swap ]###################################### # Swap color. - typeset -g POWERLEVEL9K_SWAP_FOREGROUND=0 - typeset -g POWERLEVEL9K_SWAP_BACKGROUND=3 + typeset -g POWERLEVEL9K_SWAP_FOREGROUND=96 # Custom icon. # typeset -g POWERLEVEL9K_SWAP_VISUAL_IDENTIFIER_EXPANSION='⭐' @@ -828,21 +811,17 @@ # Show average CPU load over this many last minutes. Valid values are 1, 5 and 15. typeset -g POWERLEVEL9K_LOAD_WHICH=5 # Load color when load is under 50%. - typeset -g POWERLEVEL9K_LOAD_NORMAL_FOREGROUND=0 - typeset -g POWERLEVEL9K_LOAD_NORMAL_BACKGROUND=2 + typeset -g POWERLEVEL9K_LOAD_NORMAL_FOREGROUND=66 # Load color when load is between 50% and 70%. - typeset -g POWERLEVEL9K_LOAD_WARNING_FOREGROUND=0 - typeset -g POWERLEVEL9K_LOAD_WARNING_BACKGROUND=3 + typeset -g POWERLEVEL9K_LOAD_WARNING_FOREGROUND=178 # Load color when load is over 70%. - typeset -g POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=0 - typeset -g POWERLEVEL9K_LOAD_CRITICAL_BACKGROUND=1 + typeset -g POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=166 # Custom icon. # typeset -g POWERLEVEL9K_LOAD_VISUAL_IDENTIFIER_EXPANSION='⭐' ################[ todo: todo items (https://github.com/todotxt/todo.txt-cli) ]################ # Todo color. - typeset -g POWERLEVEL9K_TODO_FOREGROUND=0 - typeset -g POWERLEVEL9K_TODO_BACKGROUND=8 + typeset -g POWERLEVEL9K_TODO_FOREGROUND=110 # Hide todo when the total number of tasks is zero. typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_TOTAL=true # Hide todo when the number of tasks after filtering is zero. @@ -866,9 +845,7 @@ ###########[ timewarrior: timewarrior tracking status (https://timewarrior.net/) ]############ # Timewarrior color. - typeset -g POWERLEVEL9K_TIMEWARRIOR_FOREGROUND=255 - typeset -g POWERLEVEL9K_TIMEWARRIOR_BACKGROUND=8 - + typeset -g POWERLEVEL9K_TIMEWARRIOR_FOREGROUND=110 # If the tracked task is longer than 24 characters, truncate and append "…". # Tip: To always display tasks without truncation, delete the following parameter. # Tip: To hide task names and display just the icon when time tracking is enabled, set the @@ -880,8 +857,7 @@ ##############[ taskwarrior: taskwarrior task count (https://taskwarrior.org/) ]############## # Taskwarrior color. - typeset -g POWERLEVEL9K_TASKWARRIOR_FOREGROUND=0 - typeset -g POWERLEVEL9K_TASKWARRIOR_BACKGROUND=6 + typeset -g POWERLEVEL9K_TASKWARRIOR_FOREGROUND=74 # Taskwarrior segment format. The following parameters are available within the expansion. # @@ -899,19 +875,27 @@ # Custom icon. # typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' + ################################[ cpu_arch: CPU architecture ]################################ + # CPU architecture color. + typeset -g POWERLEVEL9K_CPU_ARCH_FOREGROUND=172 + + # Hide the segment when on a specific CPU architecture. + # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_CONTENT_EXPANSION= + # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_VISUAL_IDENTIFIER_EXPANSION= + + # Custom icon. + # typeset -g POWERLEVEL9K_CPU_ARCH_VISUAL_IDENTIFIER_EXPANSION='⭐' + ##################################[ context: user@hostname ]################################## # Context color when running with privileges. - typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1 - typeset -g POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=0 + typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178 # Context color in SSH without privileges. - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=3 - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_BACKGROUND=0 + typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=180 # Default context color (no privileges, no SSH). - typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=3 - typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=0 + typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=180 - # Context format when running with privileges: user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%n@%m' + # 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. @@ -924,12 +908,11 @@ # Custom icon. # typeset -g POWERLEVEL9K_CONTEXT_VISUAL_IDENTIFIER_EXPANSION='⭐' # Custom prefix. - typeset -g POWERLEVEL9K_CONTEXT_PREFIX='with ' + typeset -g POWERLEVEL9K_CONTEXT_PREFIX='%250Fwith ' ###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]### # Python virtual environment color. - typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_VIRTUALENV_BACKGROUND=4 + 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 # If set to "false", won't show virtualenv if pyenv is already shown. @@ -942,8 +925,7 @@ #####################[ anaconda: conda environment (https://conda.io/) ]###################### # Anaconda environment color. - typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=0 - typeset -g POWERLEVEL9K_ANACONDA_BACKGROUND=4 + typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=37 # Anaconda segment format. The following parameters are available within the expansion. # @@ -976,8 +958,7 @@ ################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################ # Pyenv color. - typeset -g POWERLEVEL9K_PYENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_PYENV_BACKGROUND=4 + 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: @@ -1003,8 +984,7 @@ ################[ goenv: go environment (https://github.com/syndbg/goenv) ]################ # Goenv color. - typeset -g POWERLEVEL9K_GOENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_GOENV_BACKGROUND=4 + 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: @@ -1017,8 +997,7 @@ ##########[ nodenv: node.js version from nodenv (https://github.com/nodenv/nodenv) ]########## # Nodenv color. - typeset -g POWERLEVEL9K_NODENV_FOREGROUND=2 - typeset -g POWERLEVEL9K_NODENV_BACKGROUND=0 + 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: @@ -1031,15 +1010,13 @@ ##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]############### # Nvm color. - typeset -g POWERLEVEL9K_NVM_FOREGROUND=0 - typeset -g POWERLEVEL9K_NVM_BACKGROUND=5 + 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=2 - typeset -g POWERLEVEL9K_NODEENV_BACKGROUND=0 + 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. @@ -1049,8 +1026,7 @@ ##############################[ node_version: node.js version ]############################### # Node version color. - typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=7 - typeset -g POWERLEVEL9K_NODE_VERSION_BACKGROUND=2 + 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. @@ -1058,8 +1034,7 @@ #######################[ go_version: go version (https://golang.org) ]######################## # Go version color. - typeset -g POWERLEVEL9K_GO_VERSION_FOREGROUND=255 - typeset -g POWERLEVEL9K_GO_VERSION_BACKGROUND=2 + 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. @@ -1067,8 +1042,7 @@ #################[ rust_version: rustc version (https://www.rust-lang.org) ]################## # Rust version color. - typeset -g POWERLEVEL9K_RUST_VERSION_FOREGROUND=0 - typeset -g POWERLEVEL9K_RUST_VERSION_BACKGROUND=208 + 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. @@ -1076,8 +1050,7 @@ ###############[ dotnet_version: .NET version (https://dotnet.microsoft.com) ]################ # .NET version color. - typeset -g POWERLEVEL9K_DOTNET_VERSION_FOREGROUND=7 - typeset -g POWERLEVEL9K_DOTNET_VERSION_BACKGROUND=5 + 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. @@ -1085,8 +1058,7 @@ #####################[ php_version: php version (https://www.php.net/) ]###################### # PHP version color. - typeset -g POWERLEVEL9K_PHP_VERSION_FOREGROUND=0 - typeset -g POWERLEVEL9K_PHP_VERSION_BACKGROUND=5 + 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. @@ -1094,15 +1066,35 @@ ##########[ laravel_version: laravel php framework version (https://laravel.com/) ]########### # Laravel version color. - typeset -g POWERLEVEL9K_LARAVEL_VERSION_FOREGROUND=1 - typeset -g POWERLEVEL9K_LARAVEL_VERSION_BACKGROUND=7 + 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=0 - typeset -g POWERLEVEL9K_RBENV_BACKGROUND=1 + 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: @@ -1113,36 +1105,9 @@ # Custom icon. # typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - ####################[ java_version: java version (https://www.java.com/) ]#################### - # Java version color. - typeset -g POWERLEVEL9K_JAVA_VERSION_FOREGROUND=1 - typeset -g POWERLEVEL9K_JAVA_VERSION_BACKGROUND=7 - # 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=0 - typeset -g POWERLEVEL9K_PACKAGE_BACKGROUND=6 - - # 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='⭐' - #######################[ rvm: ruby version from rvm (https://rvm.io) ]######################## # Rvm color. - typeset -g POWERLEVEL9K_RVM_FOREGROUND=0 - typeset -g POWERLEVEL9K_RVM_BACKGROUND=240 + 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. @@ -1152,15 +1117,13 @@ ###########[ fvm: flutter version management (https://github.com/leoafarias/fvm) ]############ # Fvm color. - typeset -g POWERLEVEL9K_FVM_FOREGROUND=0 - typeset -g POWERLEVEL9K_FVM_BACKGROUND=4 + 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=0 - typeset -g POWERLEVEL9K_LUAENV_BACKGROUND=4 + 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: @@ -1173,8 +1136,7 @@ ###############[ jenv: java version from jenv (https://github.com/jenv/jenv) ]################ # Java color. - typeset -g POWERLEVEL9K_JENV_FOREGROUND=1 - typeset -g POWERLEVEL9K_JENV_BACKGROUND=7 + 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: @@ -1187,8 +1149,7 @@ ###########[ plenv: perl version from plenv (https://github.com/tokuhirom/plenv) ]############ # Perl color. - typeset -g POWERLEVEL9K_PLENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_PLENV_BACKGROUND=4 + 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: @@ -1199,24 +1160,32 @@ # Custom icon. # typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐' + ###########[ perlbrew: perl version from perlbrew (https://github.com/gugod/App-perlbrew) ]############ + # Perlbrew color. + typeset -g POWERLEVEL9K_PERLBREW_FOREGROUND=67 + # Show perlbrew version only when in a perl project subdirectory. + typeset -g POWERLEVEL9K_PERLBREW_PROJECT_ONLY=true + # Don't show "perl-" at the front. + typeset -g POWERLEVEL9K_PERLBREW_SHOW_PREFIX=false + # Custom icon. + # typeset -g POWERLEVEL9K_PERLBREW_VISUAL_IDENTIFIER_EXPANSION='⭐' + ############[ phpenv: php version from phpenv (https://github.com/phpenv/phpenv) ]############ # PHP color. - typeset -g POWERLEVEL9K_PHPENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_PHPENV_BACKGROUND=5 + 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". + # 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='⭐' #######[ scalaenv: scala version from scalaenv (https://github.com/scalaenv/scalaenv) ]####### # Scala color. - typeset -g POWERLEVEL9K_SCALAENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_SCALAENV_BACKGROUND=1 + typeset -g POWERLEVEL9K_SCALAENV_FOREGROUND=160 # Hide scala version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_SCALAENV_SOURCES=(shell local global) # If set to false, hide scala version if it's the same as global: @@ -1229,9 +1198,7 @@ ##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]########### # Haskell color. - typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=0 - typeset -g POWERLEVEL9K_HASKELL_STACK_BACKGROUND=3 - + 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 @@ -1266,22 +1233,26 @@ # # You can define different colors, icons and content expansions for different classes: # - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_FOREGROUND=2 - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_BACKGROUND=0 + # typeset -g POWERLEVEL9K_TERRAFORM_TEST_FOREGROUND=28 # typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( # '*prod*' PROD # These values are examples that are unlikely # '*test*' TEST # to match your needs. Customize them as needed. '*' OTHER) - typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=4 - typeset -g POWERLEVEL9K_TERRAFORM_OTHER_BACKGROUND=0 + typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=38 # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' + #############[ terraform_version: terraform version (https://www.terraform.io) ]############## + # Terraform version color. + typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=38 + # Custom icon. + # typeset -g POWERLEVEL9K_TERRAFORM_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' + #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# - # Show kubecontext only when the the command you are typing invokes one of these tools. + # Show kubecontext only when the command you are typing invokes one of these tools. # Tip: Remove the next line to always show kubecontext. - typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|fluxctl|stern' + typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern|kubeseal|skaffold|kubent' # Kubernetes context classes for the purpose of using different colors, icons and expansions with # different contexts. @@ -1306,16 +1277,14 @@ # # You can define different colors, icons and content expansions for different classes: # - # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=0 - # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_BACKGROUND=2 + # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=28 # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=( # '*prod*' PROD # These values are examples that are unlikely # '*test*' TEST # to match your needs. Customize them as needed. '*' DEFAULT) - typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=7 - typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_BACKGROUND=5 + typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=134 # typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' # Use POWERLEVEL9K_KUBECONTEXT_CONTENT_EXPANSION to specify the content displayed by kubecontext @@ -1365,10 +1334,10 @@ POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}' # Custom prefix. - typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='at ' + typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%250Fat ' #[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]# - # Show aws only when the the command you are typing invokes one of these tools. + # Show aws only when the command you are typing invokes one of these tools. # Tip: Remove the next line to always show aws. typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|terraform|pulumi|terragrunt' @@ -1399,8 +1368,7 @@ # '*prod*' PROD # These values are examples that are unlikely # '*test*' TEST # to match your needs. Customize them as needed. '*' DEFAULT) - typeset -g POWERLEVEL9K_AWS_DEFAULT_FOREGROUND=7 - typeset -g POWERLEVEL9K_AWS_DEFAULT_BACKGROUND=1 + typeset -g POWERLEVEL9K_AWS_DEFAULT_FOREGROUND=208 # typeset -g POWERLEVEL9K_AWS_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' # AWS segment format. The following parameters are available within the expansion. @@ -1411,28 +1379,25 @@ #[ aws_eb_env: aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) ]# # AWS Elastic Beanstalk environment color. - typeset -g POWERLEVEL9K_AWS_EB_ENV_FOREGROUND=2 - typeset -g POWERLEVEL9K_AWS_EB_ENV_BACKGROUND=0 + typeset -g POWERLEVEL9K_AWS_EB_ENV_FOREGROUND=70 # Custom icon. # typeset -g POWERLEVEL9K_AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ##########[ azure: azure account name (https://docs.microsoft.com/en-us/cli/azure) ]########## - # Show azure only when the the command you are typing invokes one of these tools. + # Show azure only when the command you are typing invokes one of these tools. # Tip: Remove the next line to always show azure. typeset -g POWERLEVEL9K_AZURE_SHOW_ON_COMMAND='az|terraform|pulumi|terragrunt' # Azure account name color. - typeset -g POWERLEVEL9K_AZURE_FOREGROUND=7 - typeset -g POWERLEVEL9K_AZURE_BACKGROUND=4 + typeset -g POWERLEVEL9K_AZURE_FOREGROUND=32 # Custom icon. # typeset -g POWERLEVEL9K_AZURE_VISUAL_IDENTIFIER_EXPANSION='⭐' ##########[ gcloud: google cloud account and project (https://cloud.google.com/) ]########### - # Show gcloud only when the the command you are typing invokes one of these tools. + # Show gcloud only when the command you are typing invokes one of these tools. # Tip: Remove the next line to always show gcloud. - typeset -g POWERLEVEL9K_GCLOUD_SHOW_ON_COMMAND='gcloud|gcs' - # Google cloud color. - typeset -g POWERLEVEL9K_GCLOUD_FOREGROUND=7 - typeset -g POWERLEVEL9K_GCLOUD_BACKGROUND=4 + typeset -g POWERLEVEL9K_GCLOUD_SHOW_ON_COMMAND='gcloud|gcs|gsutil' + # Google cloud color. + typeset -g POWERLEVEL9K_GCLOUD_FOREGROUND=32 # Google cloud format. Change the value of POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION and/or # POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION if the default is too verbose or not informative @@ -1469,7 +1434,7 @@ # typeset -g POWERLEVEL9K_GCLOUD_VISUAL_IDENTIFIER_EXPANSION='⭐' #[ google_app_cred: google application credentials (https://cloud.google.com/docs/authentication/production) ]# - # Show google_app_cred only when the the command you are typing invokes one of these tools. + # Show google_app_cred only when the command you are typing invokes one of these tools. # Tip: Remove the next line to always show google_app_cred. typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_SHOW_ON_COMMAND='terraform|pulumi|terragrunt' @@ -1503,8 +1468,7 @@ # '*:*prod*:*' PROD # These values are examples that are unlikely # '*:*test*:*' TEST # to match your needs. Customize them as needed. '*' DEFAULT) - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_FOREGROUND=7 - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_BACKGROUND=4 + typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_FOREGROUND=32 # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' # Use POWERLEVEL9K_GOOGLE_APP_CRED_CONTENT_EXPANSION to specify the content displayed by @@ -1523,17 +1487,25 @@ # Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced by '%%'. typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_CONTENT_EXPANSION='${P9K_GOOGLE_APP_CRED_PROJECT_ID//\%/%%}' + ##############[ toolbox: toolbox name (https://github.com/containers/toolbox) ]############### + # Toolbox color. + typeset -g POWERLEVEL9K_TOOLBOX_FOREGROUND=178 + # Don't display the name of the toolbox if it matches fedora-toolbox-*. + typeset -g POWERLEVEL9K_TOOLBOX_CONTENT_EXPANSION='${P9K_TOOLBOX_NAME:#fedora-toolbox-*}' + # Custom icon. + # typeset -g POWERLEVEL9K_TOOLBOX_VISUAL_IDENTIFIER_EXPANSION='⭐' + # Custom prefix. + typeset -g POWERLEVEL9K_TOOLBOX_PREFIX='%250Fin ' + ###############################[ public_ip: public IP address ]############################### # Public IP color. - typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=7 - typeset -g POWERLEVEL9K_PUBLIC_IP_BACKGROUND=0 + typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=94 # Custom icon. # typeset -g POWERLEVEL9K_PUBLIC_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' ########################[ vpn_ip: virtual private network indicator ]######################### # VPN IP color. - typeset -g POWERLEVEL9K_VPN_IP_FOREGROUND=0 - typeset -g POWERLEVEL9K_VPN_IP_BACKGROUND=6 + typeset -g POWERLEVEL9K_VPN_IP_FOREGROUND=81 # When on VPN, show just an icon without the IP address. # Tip: To display the private IP address when on VPN, remove the next line. typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION= @@ -1549,8 +1521,7 @@ ###########[ ip: ip address and bandwidth usage for a specified network interface ]########### # IP color. - typeset -g POWERLEVEL9K_IP_BACKGROUND=4 - typeset -g POWERLEVEL9K_IP_FOREGROUND=0 + typeset -g POWERLEVEL9K_IP_FOREGROUND=38 # The following parameters are accessible within the expansion: # # Parameter | Meaning @@ -1563,7 +1534,7 @@ # P9K_IP_TX_BYTES_DELTA | number of bytes sent since last prompt # P9K_IP_RX_RATE | receive rate (since last prompt) # P9K_IP_TX_RATE | send rate (since last prompt) - typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='${P9K_IP_RX_RATE:+⇣$P9K_IP_RX_RATE }${P9K_IP_TX_RATE:+⇡$P9K_IP_TX_RATE }$P9K_IP_IP' + typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='${P9K_IP_RX_RATE:+%70F⇣$P9K_IP_RX_RATE }${P9K_IP_TX_RATE:+%215F⇡$P9K_IP_TX_RATE }%38F$P9K_IP_IP' # Show information for the first network interface whose name matches this regular expression. # Run `ifconfig` or `ip -4 a show` to see the names of all network interfaces. typeset -g POWERLEVEL9K_IP_INTERFACE='[ew].*' @@ -1572,36 +1543,33 @@ #########################[ proxy: system-wide http/https/ftp proxy ]########################## # Proxy color. - typeset -g POWERLEVEL9K_PROXY_FOREGROUND=4 - typeset -g POWERLEVEL9K_PROXY_BACKGROUND=0 + typeset -g POWERLEVEL9K_PROXY_FOREGROUND=68 # Custom icon. # typeset -g POWERLEVEL9K_PROXY_VISUAL_IDENTIFIER_EXPANSION='⭐' ################################[ battery: internal battery ]################################# # Show battery in red when it's below this level and not connected to power supply. typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20 - typeset -g POWERLEVEL9K_BATTERY_LOW_FOREGROUND=1 + typeset -g POWERLEVEL9K_BATTERY_LOW_FOREGROUND=160 # Show battery in green when it's charging or fully charged. - typeset -g POWERLEVEL9K_BATTERY_{CHARGING,CHARGED}_FOREGROUND=2 + typeset -g POWERLEVEL9K_BATTERY_{CHARGING,CHARGED}_FOREGROUND=70 # Show battery in yellow when it's discharging. - typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=3 + typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=178 # Battery pictograms going from low to high level of charge. typeset -g POWERLEVEL9K_BATTERY_STAGES='\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578' # Don't show the remaining time to charge/discharge. typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false - typeset -g POWERLEVEL9K_BATTERY_BACKGROUND=0 #####################################[ wifi: wifi speed ]##################################### # WiFi color. - typeset -g POWERLEVEL9K_WIFI_FOREGROUND=0 - typeset -g POWERLEVEL9K_WIFI_BACKGROUND=4 + typeset -g POWERLEVEL9K_WIFI_FOREGROUND=68 # Custom icon. # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='⭐' # Use different colors and icons depending on signal strength ($P9K_WIFI_BARS). # # # Wifi colors and icons for different signal strength levels (low to high). - # typeset -g my_wifi_fg=(0 0 0 0 0) # <-- change these values + # typeset -g my_wifi_fg=(68 68 68 68 68) # <-- change these values # typeset -g my_wifi_icon=('WiFi' 'WiFi' 'WiFi' 'WiFi' 'WiFi') # <-- change these values # # typeset -g POWERLEVEL9K_WIFI_CONTENT_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}$P9K_WIFI_LAST_TX_RATE Mbps' @@ -1620,8 +1588,7 @@ ####################################[ time: current time ]#################################### # Current time color. - typeset -g POWERLEVEL9K_TIME_FOREGROUND=0 - typeset -g POWERLEVEL9K_TIME_BACKGROUND=7 + typeset -g POWERLEVEL9K_TIME_FOREGROUND=66 # Format for the current time: 09:51:02. See `man 3 strftime`. typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}' # If set to true, time will update when you hit enter. This way prompts for the past @@ -1631,16 +1598,15 @@ # Custom icon. # typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION='⭐' # Custom prefix. - typeset -g POWERLEVEL9K_TIME_PREFIX='at ' + typeset -g POWERLEVEL9K_TIME_PREFIX='%250Fat ' # 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 yellow text on red background - # greeting the user. + # 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_example() { - p10k segment -b 1 -f 3 -i '⭐' -t 'hello, %n' + p10k segment -f 208 -i '⭐' -t 'hello, %n' } # User-defined prompt segments may optionally provide an instant_prompt_* function. Its job @@ -1663,8 +1629,7 @@ } # User-defined prompt segments can be customized the same way as built-in segments. - typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=3 - typeset -g POWERLEVEL9K_EXAMPLE_BACKGROUND=1 + # typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208 # typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='⭐' # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt diff --git a/config/home-manager/base.nix b/config/home-manager/base.nix index 813e21c4..af6f5b4d 100644 --- a/config/home-manager/base.nix +++ b/config/home-manager/base.nix @@ -98,4 +98,6 @@ desktop: {pkgs, ...}: { }; home.stateVersion = "22.05"; manual.manpages.enable = false; # broken + + _module.args.bg = "${pkgs.lotte-art}/2022-06-21-sammythetanuki-lotteplushpride.jxl"; } diff --git a/config/nutty-noon.nix b/config/nutty-noon.nix index ea250eb8..5fd759f1 100644 --- a/config/nutty-noon.nix +++ b/config/nutty-noon.nix @@ -121,4 +121,5 @@ "https://cache.nixos.org/" ]; services.tailscale.useRoutingFeatures = "client"; + home-manager.users.darkkirb._module.args.bg = lib.mkForce "${pkgs.lotte-art}/2022-08-12-deathtoaster-funpit-scat.jxl"; } diff --git a/config/programs/sway.nix b/config/programs/sway.nix index e179f778..ec6a2831 100644 --- a/config/programs/sway.nix +++ b/config/programs/sway.nix @@ -28,27 +28,6 @@ ${pkgs.sway-contrib.grimshot}/bin/grimshot "$@" ${pkgs.sway}/bin/swaymsg mode default ''; - bg-full-res = "${pkgs.lotte-art}/2022-06-21-sammythetanuki-lotteplushpride.jxl"; - bg-1440p = pkgs.stdenvNoCC.mkDerivation { - name = "wayland-background-1440p.png"; - nativeBuildInputs = [pkgs.imagemagick pkgs.libjxl]; - src = pkgs.emptyDirectory; - buildPhase = '' - djxl ${bg-full-res} bg-full-res.png - convert bg-full-res.png -resize 2560x1440 $out - ''; - installPhase = "true"; - }; - bg-1080p = pkgs.stdenvNoCC.mkDerivation { - name = "wayland-background-1080p.png"; - nativeBuildInputs = [pkgs.imagemagick pkgs.libjxl]; - src = pkgs.emptyDirectory; - buildPhase = '' - djxl ${bg-full-res} bg-full-res.png - convert bg-full-res.png -resize 1920x1080 $out - ''; - installPhase = "true"; - }; in { imports = [ ./wl-clipboard.nix @@ -68,21 +47,16 @@ in { }; }; output = { - "eDP-1" = { - bg = "${bg-1080p} fill"; - }; "DP-1" = { mode = "2560x1440@74.971Hz"; position = "0 0"; subpixel = "rgb"; adaptive_sync = "on"; - bg = "${bg-1440p} fill"; }; "HDMI-A-1" = { mode = "1920x1080@60Hz"; position = "2560 0"; subpixel = "rgb"; - bg = "${bg-1080p} fill"; }; }; keybindings = let diff --git a/config/programs/theming.nix b/config/programs/theming.nix index 3d261507..d7424c4a 100644 --- a/config/programs/theming.nix +++ b/config/programs/theming.nix @@ -1,12 +1,33 @@ { pkgs, config, + colorpickle, + bg, ... }: let theme = import ../../extra/theme.nix; inherit (config.lib.formats.rasi) mkLiteral; - rasiColor = c: mkLiteral (theme.cssColor c); + color = n: + config.environment.graphical.colors.main."${builtins.toString n}"; + color' = n: mkLiteral (color n); + bgPng = pkgs.stdenv.mkDerivation { + name = "bg.png"; + src = pkgs.emptyDirectory; + nativeBuildInputs = [pkgs.imagemagick]; + buildPhase = '' + convert ${bg} $out + ''; + installPhase = "true"; + }; in { + imports = [ + colorpickle.nixosModules.default + ]; + environment.graphical.colorschemes.main = { + image = bgPng; + #params = ["--lighten" "0.1"]; + }; + wayland.windowManager.sway.config.output."*".bg = "${bgPng} fill"; dconf.settings."org/gnome/desktop/interface" = { gtk-theme = "Breeze-Dark"; icon-theme = "breeze-dark"; @@ -52,27 +73,27 @@ in { ''; }; programs.kitty.settings = with theme; { - background_opacity = "0.9"; - background = cssColor base; - foreground = cssColor text; - cursor = cssColor text; + background_opacity = "0.85"; + background = color 0; + foreground = color 15; + cursor = color 15; selection_background = "#4f414c"; - color0 = cssColor surface1; - color1 = cssColor red; - color2 = cssColor green; - color3 = cssColor yellow; - color4 = cssColor blue; - color5 = cssColor pink; - color6 = cssColor teal; - color7 = cssColor subtext1; - color8 = cssColor surface2; - color9 = cssColor red; - color10 = cssColor green; - color11 = cssColor yellow; - color12 = cssColor blue; - color13 = cssColor pink; - color14 = cssColor teal; - color15 = cssColor subtext0; + color0 = color 0; + color1 = color 9; + color2 = color 10; + color3 = color 11; + color4 = color 12; + color5 = color 13; + color6 = color 14; + color7 = color 7; + color8 = color 8; + color9 = color 9; + color10 = color 10; + color11 = color 11; + color12 = color 12; + color13 = color 13; + color14 = color 14; + color15 = color 15; }; # Taken from https://github.com/jakehamilton/dotfiles/blob/master/waybar/style.css programs.waybar.style = with theme; '' @@ -82,11 +103,12 @@ in { font-size: 14px; min-height: 24px; font-family: "NotoSansDisplay Nerd Font", "Noto Sans Mono CJK JP"; - color: ${cssColor base}; + color: ${color 0}; } window#waybar { background: transparent; + color: ${color 15}; opacity: 0.9; } @@ -107,7 +129,8 @@ in { margin-left: 12px; margin-bottom: 0; border-radius: 24px; - background: ${cssColor surface0}; + background-color: ${color 0}; + color: ${color 15}; transition: none; } @@ -115,17 +138,17 @@ in { transition: none; background: transparent; font-size: 16px; - color: ${cssColor text}; + color: ${color 15}; } #workspaces button.focused { - background: ${cssColor mauve}; - color: ${cssColor base}; + background: ${color 13}; + color: ${color 0}; } #workspaces button:hover { - background: ${cssColor sapphire}; - color: ${cssColor base}; + background: ${color 10}; + color: ${color 0}; } #mpd { @@ -135,13 +158,13 @@ in { padding-right: 16px; margin-bottom: 0; border-radius: 24px; - background: ${cssColor green}; + background: ${color 2}; transition: none; } #mpd.disconnected, #mpd.stopped { - background: ${cssColor red}; + background: ${color 4}; } #network { @@ -152,7 +175,7 @@ in { margin-bottom: 0; border-radius: 24px; transition: none; - background: ${cssColor mauve}; + background: ${color 13}; } #pulseaudio { @@ -163,7 +186,7 @@ in { margin-bottom: 0; border-radius: 24px; transition: none; - background: ${cssColor teal}; + background: ${color 11}; } #temperature, #battery { @@ -174,7 +197,7 @@ in { margin-bottom: 0; border-radius: 24px; transition: none; - background: ${cssColor green}; + background: ${color 2}; } #cpu, #backlight, #battery.warning { @@ -185,7 +208,7 @@ in { margin-bottom: 0; border-radius: 24px; transition: none; - background: ${cssColor yellow}; + background: ${color 14}; } #memory, #battery.critical { @@ -196,7 +219,7 @@ in { margin-bottom: 0; border-radius: 24px; transition: none; - background: ${cssColor red}; + background: ${color 12}; } #clock { @@ -208,19 +231,19 @@ in { margin-bottom: 0; border-radius: 26px; transition: none; - background: ${cssColor surface0}; - color: ${cssColor text}; + background: ${color 0}; + color: ${color 15}; } ''; wayland.windowManager.sway.extraConfig = with theme; '' # target title bg text indicator border - client.focused ${cssColor pink} ${cssColor base} ${cssColor text} ${cssColor rosewater} ${cssColor pink} - client.focused_inactive ${cssColor mauve} ${cssColor base} ${cssColor text} ${cssColor rosewater} ${cssColor mauve} - client.unfocused ${cssColor mauve} ${cssColor base} ${cssColor text} ${cssColor rosewater} ${cssColor mauve} - client.urgent ${cssColor peach} ${cssColor base} ${cssColor peach} ${cssColor overlay0} ${cssColor peach} - client.placeholder ${cssColor overlay0} ${cssColor base} ${cssColor text} ${cssColor overlay0} ${cssColor overlay0} - client.background ${cssColor base} + client.focused ${color 5} ${color 0} ${color 15} ${color 12} ${color 5} + client.focused_inactive ${color 13} ${color 0} ${color 15} ${color 12} ${color 13} + client.unfocused ${color 13} ${color 0} ${color 15} ${color 12} ${color 13} + client.urgent ${color 14} ${color 0} ${color 14} ${color 8} ${color 14} + client.placeholder ${color 8} ${color 0} ${color 15} ${color 8} ${color 8} + client.background ${color 0} seat seat0 xcursor_theme breeze-dark 24 ''; home.packages = with pkgs; [libsForQt5.breeze-icons libsForQt5.qt5ct vanilla-dmz]; @@ -232,14 +255,14 @@ in { }; in { "*" = { - bg-col = rasiColor base; - bg-col-light = rasiColor base; - border-col = rasiColor base; - selected-col = rasiColor base; - blue = rasiColor blue; - fg-col = rasiColor text; - fg-col2 = rasiColor red; - grey = rasiColor overlay0; + bg-col = color' 0; + bg-col-light = color' 0; + border-col = color' 0; + selected-col = color' 0; + blue = color' 1; + fg-col = color' 15; + fg-col2 = color' 12; + grey = color' 8; width = 600; }; element-text = element; diff --git a/config/services/wordpress.nix b/config/services/wordpress.nix index dff31475..71bdbf9f 100644 --- a/config/services/wordpress.nix +++ b/config/services/wordpress.nix @@ -1,5 +1,9 @@ -{lib, pkgs, config, ...}: { - +{ + lib, + pkgs, + config, + ... +}: { imports = [../../modules/wordpress.nix]; services.mysql = { enable = true; @@ -21,7 +25,7 @@ useACMEHost = "chir.rs"; logFormat = lib.mkForce ""; extraConfig = '' - import baseConfig + import baseConfig ''; }; } diff --git a/flake.lock b/flake.lock index ac612203..8293170a 100644 --- a/flake.lock +++ b/flake.lock @@ -257,6 +257,32 @@ "type": "github" } }, + "colorpickle": { + "inputs": { + "naersk": [ + "naersk" + ], + "nixpkgs": [ + "nixpkgs" + ], + "utils": [ + "flake-utils" + ] + }, + "locked": { + "lastModified": 1682020898, + "narHash": "sha256-XYSSFmqIjsvmgusWaOSD/WeaTyH8o83i+qma1BQgARU=", + "owner": "AgathaSorceress", + "repo": "colorpickle", + "rev": "2574b83cb0454a146a0346bf0d6a134d62241e60", + "type": "github" + }, + "original": { + "owner": "AgathaSorceress", + "repo": "colorpickle", + "type": "github" + } + }, "crane": { "inputs": { "flake-compat": "flake-compat_3", @@ -1281,6 +1307,27 @@ "type": "github" } }, + "naersk": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1679567394, + "narHash": "sha256-ZvLuzPeARDLiQUt6zSZFGOs+HZmE+3g4QURc8mkBsfM=", + "owner": "nix-community", + "repo": "naersk", + "rev": "88cd22380154a2c36799fe8098888f0f59861a15", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "naersk", + "type": "github" + } + }, "nix": { "inputs": { "lowdown-src": "lowdown-src", @@ -1903,6 +1950,7 @@ "attic": "attic", "cargo2nix": "cargo2nix", "chir-rs": "chir-rs", + "colorpickle": "colorpickle", "crane": "crane", "dns": "dns", "emanote": "emanote", @@ -1912,6 +1960,7 @@ "home-manager": "home-manager", "hosts-list": "hosts-list", "hydra": "hydra", + "naersk": "naersk", "nix-neovim": "nix-neovim", "nix-packages": "nix-packages", "nixos-config-for-netboot": "nixos-config-for-netboot", diff --git a/flake.nix b/flake.nix index 5449fdf3..df39b2fc 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,12 @@ rec { inputs.nixpkgs.follows = "nixpkgs"; inputs.rust-overlay.follows = "rust-overlay"; }; + colorpickle = { + url = "github:AgathaSorceress/colorpickle"; + inputs.naersk.follows = "naersk"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.utils.follows = "flake-utils"; + }; crane = { url = "github:DarkKirb/crane"; inputs.flake-utils.follows = "flake-utils"; @@ -60,6 +66,10 @@ rec { #inputs.nix.follows = "nix"; #inputs.nixpkgs.follows = "nixpkgs"; }; + naersk = { + url = "github:nix-community/naersk/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; nix-neovim = { url = "github:syberant/nix-neovim"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/modules/wordpress.nix b/modules/wordpress.nix index f659358c..e81a2048 100644 --- a/modules/wordpress.nix +++ b/modules/wordpress.nix @@ -1,92 +1,110 @@ -{ config, pkgs, lib, ... }: - -with lib; - -let +{ + config, + pkgs, + lib, + ... +}: +with lib; let cfg = config.services.wordpress; eachSite = cfg.sites; user = "wordpress"; webserver = config.services.${cfg.webserver}; stateDir = hostName: "/var/lib/wordpress/${hostName}"; - pkg = hostName: cfg: pkgs.stdenv.mkDerivation rec { - pname = "wordpress-${hostName}"; - version = src.version; - src = cfg.package; + pkg = hostName: cfg: + pkgs.stdenv.mkDerivation rec { + pname = "wordpress-${hostName}"; + version = src.version; + src = cfg.package; - installPhase = '' - mkdir -p $out - cp -r * $out/ + installPhase = '' + mkdir -p $out + cp -r * $out/ - # symlink the wordpress config - ln -s ${wpConfig hostName cfg} $out/share/wordpress/wp-config.php - # symlink uploads directory - ln -s ${cfg.uploadsDir} $out/share/wordpress/wp-content/uploads - ln -s ${cfg.fontsDir} $out/share/wordpress/wp-content/fonts + # symlink the wordpress config + ln -s ${wpConfig hostName cfg} $out/share/wordpress/wp-config.php + # symlink uploads directory + ln -s ${cfg.uploadsDir} $out/share/wordpress/wp-content/uploads + ln -s ${cfg.fontsDir} $out/share/wordpress/wp-content/fonts - # https://github.com/NixOS/nixpkgs/pull/53399 - # - # Symlinking works for most plugins and themes, but Avada, for instance, fails to - # understand the symlink, causing its file path stripping to fail. This results in - # requests that look like: https://example.com/wp-content//nix/store/...plugin/path/some-file.js - # Since hard linking directories is not allowed, copying is the next best thing. + # https://github.com/NixOS/nixpkgs/pull/53399 + # + # Symlinking works for most plugins and themes, but Avada, for instance, fails to + # understand the symlink, causing its file path stripping to fail. This results in + # requests that look like: https://example.com/wp-content//nix/store/...plugin/path/some-file.js + # Since hard linking directories is not allowed, copying is the next best thing. - # copy additional plugin(s), theme(s) and language(s) - ${concatStringsSep "\n" (mapAttrsToList (name: theme: "cp -r ${theme} $out/share/wordpress/wp-content/themes/${name}") cfg.themes)} - ${concatStringsSep "\n" (mapAttrsToList (name: plugin: "cp -r ${plugin} $out/share/wordpress/wp-content/plugins/${name}") cfg.plugins)} - ${concatMapStringsSep "\n" (language: "cp -r ${language} $out/share/wordpress/wp-content/languages/") cfg.languages} - ''; - }; + # copy additional plugin(s), theme(s) and language(s) + ${concatStringsSep "\n" (mapAttrsToList (name: theme: "cp -r ${theme} $out/share/wordpress/wp-content/themes/${name}") cfg.themes)} + ${concatStringsSep "\n" (mapAttrsToList (name: plugin: "cp -r ${plugin} $out/share/wordpress/wp-content/plugins/${name}") cfg.plugins)} + ${concatMapStringsSep "\n" (language: "cp -r ${language} $out/share/wordpress/wp-content/languages/") cfg.languages} + ''; + }; - mergeConfig = cfg: { - # wordpress is installed onto a read-only file system - DISALLOW_FILE_EDIT = true; - AUTOMATIC_UPDATER_DISABLED = true; - DB_NAME = cfg.database.name; - DB_HOST = "${cfg.database.host}:${if cfg.database.socket != null then cfg.database.socket else toString cfg.database.port}"; - DB_USER = cfg.database.user; - DB_CHARSET = "utf8"; - # Always set DB_PASSWORD even when passwordFile is not set. This is the - # default Wordpress behaviour. - DB_PASSWORD = if (cfg.database.passwordFile != null) then { _file = cfg.database.passwordFile; } else ""; - } // cfg.settings; + mergeConfig = cfg: + { + # wordpress is installed onto a read-only file system + DISALLOW_FILE_EDIT = true; + AUTOMATIC_UPDATER_DISABLED = true; + DB_NAME = cfg.database.name; + DB_HOST = "${cfg.database.host}:${ + if cfg.database.socket != null + then cfg.database.socket + else toString cfg.database.port + }"; + DB_USER = cfg.database.user; + DB_CHARSET = "utf8"; + # Always set DB_PASSWORD even when passwordFile is not set. This is the + # default Wordpress behaviour. + DB_PASSWORD = + if (cfg.database.passwordFile != null) + then {_file = cfg.database.passwordFile;} + else ""; + } + // cfg.settings; wpConfig = hostName: cfg: let conf_gen = c: mapAttrsToList (k: v: "define('${k}', ${mkPhpValue v});") cfg.mergedConfig; - in pkgs.writeTextFile { - name = "wp-config-${hostName}.php"; - text = '' - - ''; - checkPhase = "${pkgs.php81}/bin/php --syntax-check $target"; - }; + require_once(ABSPATH . 'wp-settings.php'); + ?> + ''; + checkPhase = "${pkgs.php81}/bin/php --syntax-check $target"; + }; mkPhpValue = v: let isHasAttr = s: isAttrs v && hasAttr s v; in - if isString v then escapeShellArg v + if isString v + then escapeShellArg v # NOTE: If any value contains a , (comma) this will not get escaped - else if isList v && any lib.strings.isCoercibleToString v then escapeShellArg (concatMapStringsSep "," toString v) - else if isInt v then toString v - else if isBool v then boolToString v - else if isHasAttr "_file" then "trim(file_get_contents(${lib.escapeShellArg v._file}))" - else if isHasAttr "_raw" then v._raw - else abort "The Wordpress config value ${lib.generators.toPretty {} v} can not be encoded." - ; + else if isList v && any lib.strings.isCoercibleToString v + then escapeShellArg (concatMapStringsSep "," toString v) + else if isInt v + then toString v + else if isBool v + then boolToString v + else if isHasAttr "_file" + then "trim(file_get_contents(${lib.escapeShellArg v._file}))" + else if isHasAttr "_raw" + then v._raw + else abort "The Wordpress config value ${lib.generators.toPretty {} v} can not be encoded."; - secretsVars = [ "AUTH_KEY" "SECURE_AUTH_KEY" "LOGGED_IN_KEY" "NONCE_KEY" "AUTH_SALT" "SECURE_AUTH_SALT" "LOGGED_IN_SALT" "NONCE_SALT" ]; + secretsVars = ["AUTH_KEY" "SECURE_AUTH_KEY" "LOGGED_IN_KEY" "NONCE_KEY" "AUTH_SALT" "SECURE_AUTH_SALT" "LOGGED_IN_SALT" "NONCE_SALT"]; secretsScript = hostStateDir: '' # The match in this line is not a typo, see https://github.com/NixOS/nixpkgs/pull/124839 grep -q "LOOGGED_IN_KEY" "${hostStateDir}/secret-keys.php" && rm "${hostStateDir}/secret-keys.php" @@ -95,265 +113,271 @@ let echo "> "${hostStateDir}/secret-keys.php" ${concatMapStringsSep "\n" (var: '' echo "define('${var}', '`tr -dc a-zA-Z0-9 > "${hostStateDir}/secret-keys.php" - '') secretsVars} + '') + secretsVars} echo "?>" >> "${hostStateDir}/secret-keys.php" chmod 440 "${hostStateDir}/secret-keys.php" fi ''; - siteOpts = { lib, name, config, ... }: - { - options = { - package = mkOption { - type = types.package; - default = pkgs.wordpress; - defaultText = literalExpression "pkgs.wordpress"; - description = lib.mdDoc "Which WordPress package to use."; - }; - - uploadsDir = mkOption { - type = types.path; - default = "/var/lib/wordpress/${name}/uploads"; - description = lib.mdDoc '' - This directory is used for uploads of pictures. The directory passed here is automatically - created and permissions adjusted as required. - ''; - }; - - fontsDir = mkOption { - type = types.path; - default = "/var/lib/wordpress/${name}/fonts"; - description = lib.mdDoc '' - This directory is used to download fonts from a remote location, e.g. - to host google fonts locally. - ''; - }; - - plugins = mkOption { - type = with types; coercedTo - (listOf path) - (l: warn "setting this option with a list is deprecated" - listToAttrs (map (p: nameValuePair (p.name or (throw "${p} does not have a name")) p) l)) - (attrsOf path); - default = {}; - description = lib.mdDoc '' - Path(s) to respective plugin(s) which are copied from the 'plugins' directory. - - ::: {.note} - These plugins need to be packaged before use, see example. - ::: - ''; - example = literalExpression '' - { - inherit (pkgs.wordpressPackages.plugins) embed-pdf-viewer-plugin; - } - ''; - }; - - themes = mkOption { - type = with types; coercedTo - (listOf path) - (l: warn "setting this option with a list is deprecated" - listToAttrs (map (p: nameValuePair (p.name or (throw "${p} does not have a name")) p) l)) - (attrsOf path); - default = { inherit (pkgs.wordpressPackages.themes) twentytwentythree; }; - defaultText = literalExpression "{ inherit (pkgs.wordpressPackages.themes) twentytwentythree; }"; - description = lib.mdDoc '' - Path(s) to respective theme(s) which are copied from the 'theme' directory. - - ::: {.note} - These themes need to be packaged before use, see example. - ::: - ''; - example = literalExpression '' - { - inherit (pkgs.wordpressPackages.themes) responsive-theme; - } - ''; - }; - - languages = mkOption { - type = types.listOf types.path; - default = []; - description = lib.mdDoc '' - List of path(s) to respective language(s) which are copied from the 'languages' directory. - ''; - example = literalExpression '' - [( - # Let's package the German language. - # For other languages try to replace language and country code in the download URL with your desired one. - # Reference https://translate.wordpress.org for available translations and - # codes. - language-de = pkgs.stdenv.mkDerivation { - name = "language-de"; - src = pkgs.fetchurl { - url = "https://de.wordpress.org/wordpress-''${pkgs.wordpress.version}-de_DE.tar.gz"; - # Name is required to invalidate the hash when wordpress is updated - name = "wordpress-''${pkgs.wordpress.version}-language-de" - sha256 = "sha256-dlas0rXTSV4JAl8f/UyMbig57yURRYRhTMtJwF9g8h0="; - }; - installPhase = "mkdir -p $out; cp -r ./wp-content/languages/* $out/"; - }; - )]; - ''; - }; - - database = { - host = mkOption { - type = types.str; - default = "localhost"; - description = lib.mdDoc "Database host address."; - }; - - port = mkOption { - type = types.port; - default = 3306; - description = lib.mdDoc "Database host port."; - }; - - name = mkOption { - type = types.str; - default = "wordpress"; - description = lib.mdDoc "Database name."; - }; - - user = mkOption { - type = types.str; - default = "wordpress"; - description = lib.mdDoc "Database user."; - }; - - passwordFile = mkOption { - type = types.nullOr types.path; - default = null; - example = "/run/keys/wordpress-dbpassword"; - description = lib.mdDoc '' - A file containing the password corresponding to - {option}`database.user`. - ''; - }; - - tablePrefix = mkOption { - type = types.str; - default = "wp_"; - description = lib.mdDoc '' - The $table_prefix is the value placed in the front of your database tables. - Change the value if you want to use something other than wp_ for your database - prefix. Typically this is changed if you are installing multiple WordPress blogs - in the same database. - - See . - ''; - }; - - socket = mkOption { - type = types.nullOr types.path; - default = null; - defaultText = literalExpression "/run/mysqld/mysqld.sock"; - description = lib.mdDoc "Path to the unix socket file to use for authentication."; - }; - - createLocally = mkOption { - type = types.bool; - default = true; - description = lib.mdDoc "Create the database and database user locally."; - }; - }; - - virtualHost = mkOption { - type = types.submodule (import ../web-servers/apache-httpd/vhost-options.nix); - example = literalExpression '' - { - adminAddr = "webmaster@example.org"; - forceSSL = true; - enableACME = true; - } - ''; - description = lib.mdDoc '' - Apache configuration can be done by adapting {option}`services.httpd.virtualHosts`. - ''; - }; - - poolConfig = mkOption { - type = with types; attrsOf (oneOf [ str int bool ]); - default = { - "pm" = "dynamic"; - "pm.max_children" = 32; - "pm.start_servers" = 2; - "pm.min_spare_servers" = 2; - "pm.max_spare_servers" = 4; - "pm.max_requests" = 500; - }; - description = lib.mdDoc '' - Options for the WordPress PHP pool. See the documentation on `php-fpm.conf` - for details on configuration directives. - ''; - }; - - settings = mkOption { - type = types.attrsOf types.anything; - default = {}; - description = lib.mdDoc '' - Structural Wordpress configuration. - Refer to - for details and supported values. - ''; - example = literalExpression '' - { - WP_DEFAULT_THEME = "twentytwentytwo"; - WP_SITEURL = "https://example.org"; - WP_HOME = "https://example.org"; - WP_DEBUG = true; - WP_DEBUG_DISPLAY = true; - WPLANG = "de_DE"; - FORCE_SSL_ADMIN = true; - AUTOMATIC_UPDATER_DISABLED = true; - } - ''; - }; - - mergedConfig = mkOption { - readOnly = true; - default = mergeConfig config; - defaultText = literalExpression '' - { - DISALLOW_FILE_EDIT = true; - AUTOMATIC_UPDATER_DISABLED = true; - } - ''; - description = lib.mdDoc '' - Read only representation of the final configuration. - ''; - }; - - extraConfig = mkOption { - type = types.lines; - default = ""; - description = lib.mdDoc '' - Any additional text to be appended to the wp-config.php - configuration file. This is a PHP script. For configuration - settings, see . - - **Note**: Please pass structured settings via - `services.wordpress.sites.${name}.settings` instead. - ''; - example = '' - @ini_set( 'log_errors', 'Off' ); - @ini_set( 'display_errors', 'On' ); - ''; - }; - + siteOpts = { + lib, + name, + config, + ... + }: { + options = { + package = mkOption { + type = types.package; + default = pkgs.wordpress; + defaultText = literalExpression "pkgs.wordpress"; + description = lib.mdDoc "Which WordPress package to use."; }; - config.virtualHost.hostName = mkDefault name; + uploadsDir = mkOption { + type = types.path; + default = "/var/lib/wordpress/${name}/uploads"; + description = lib.mdDoc '' + This directory is used for uploads of pictures. The directory passed here is automatically + created and permissions adjusted as required. + ''; + }; + + fontsDir = mkOption { + type = types.path; + default = "/var/lib/wordpress/${name}/fonts"; + description = lib.mdDoc '' + This directory is used to download fonts from a remote location, e.g. + to host google fonts locally. + ''; + }; + + plugins = mkOption { + type = with types; + coercedTo + (listOf path) + (l: + warn "setting this option with a list is deprecated" + listToAttrs (map (p: nameValuePair (p.name or (throw "${p} does not have a name")) p) l)) + (attrsOf path); + default = {}; + description = lib.mdDoc '' + Path(s) to respective plugin(s) which are copied from the 'plugins' directory. + + ::: {.note} + These plugins need to be packaged before use, see example. + ::: + ''; + example = literalExpression '' + { + inherit (pkgs.wordpressPackages.plugins) embed-pdf-viewer-plugin; + } + ''; + }; + + themes = mkOption { + type = with types; + coercedTo + (listOf path) + (l: + warn "setting this option with a list is deprecated" + listToAttrs (map (p: nameValuePair (p.name or (throw "${p} does not have a name")) p) l)) + (attrsOf path); + default = {inherit (pkgs.wordpressPackages.themes) twentytwentythree;}; + defaultText = literalExpression "{ inherit (pkgs.wordpressPackages.themes) twentytwentythree; }"; + description = lib.mdDoc '' + Path(s) to respective theme(s) which are copied from the 'theme' directory. + + ::: {.note} + These themes need to be packaged before use, see example. + ::: + ''; + example = literalExpression '' + { + inherit (pkgs.wordpressPackages.themes) responsive-theme; + } + ''; + }; + + languages = mkOption { + type = types.listOf types.path; + default = []; + description = lib.mdDoc '' + List of path(s) to respective language(s) which are copied from the 'languages' directory. + ''; + example = literalExpression '' + [( + # Let's package the German language. + # For other languages try to replace language and country code in the download URL with your desired one. + # Reference https://translate.wordpress.org for available translations and + # codes. + language-de = pkgs.stdenv.mkDerivation { + name = "language-de"; + src = pkgs.fetchurl { + url = "https://de.wordpress.org/wordpress-''${pkgs.wordpress.version}-de_DE.tar.gz"; + # Name is required to invalidate the hash when wordpress is updated + name = "wordpress-''${pkgs.wordpress.version}-language-de" + sha256 = "sha256-dlas0rXTSV4JAl8f/UyMbig57yURRYRhTMtJwF9g8h0="; + }; + installPhase = "mkdir -p $out; cp -r ./wp-content/languages/* $out/"; + }; + )]; + ''; + }; + + database = { + host = mkOption { + type = types.str; + default = "localhost"; + description = lib.mdDoc "Database host address."; + }; + + port = mkOption { + type = types.port; + default = 3306; + description = lib.mdDoc "Database host port."; + }; + + name = mkOption { + type = types.str; + default = "wordpress"; + description = lib.mdDoc "Database name."; + }; + + user = mkOption { + type = types.str; + default = "wordpress"; + description = lib.mdDoc "Database user."; + }; + + passwordFile = mkOption { + type = types.nullOr types.path; + default = null; + example = "/run/keys/wordpress-dbpassword"; + description = lib.mdDoc '' + A file containing the password corresponding to + {option}`database.user`. + ''; + }; + + tablePrefix = mkOption { + type = types.str; + default = "wp_"; + description = lib.mdDoc '' + The $table_prefix is the value placed in the front of your database tables. + Change the value if you want to use something other than wp_ for your database + prefix. Typically this is changed if you are installing multiple WordPress blogs + in the same database. + + See . + ''; + }; + + socket = mkOption { + type = types.nullOr types.path; + default = null; + defaultText = literalExpression "/run/mysqld/mysqld.sock"; + description = lib.mdDoc "Path to the unix socket file to use for authentication."; + }; + + createLocally = mkOption { + type = types.bool; + default = true; + description = lib.mdDoc "Create the database and database user locally."; + }; + }; + + virtualHost = mkOption { + type = types.submodule (import ../web-servers/apache-httpd/vhost-options.nix); + example = literalExpression '' + { + adminAddr = "webmaster@example.org"; + forceSSL = true; + enableACME = true; + } + ''; + description = lib.mdDoc '' + Apache configuration can be done by adapting {option}`services.httpd.virtualHosts`. + ''; + }; + + poolConfig = mkOption { + type = with types; attrsOf (oneOf [str int bool]); + default = { + "pm" = "dynamic"; + "pm.max_children" = 32; + "pm.start_servers" = 2; + "pm.min_spare_servers" = 2; + "pm.max_spare_servers" = 4; + "pm.max_requests" = 500; + }; + description = lib.mdDoc '' + Options for the WordPress PHP pool. See the documentation on `php-fpm.conf` + for details on configuration directives. + ''; + }; + + settings = mkOption { + type = types.attrsOf types.anything; + default = {}; + description = lib.mdDoc '' + Structural Wordpress configuration. + Refer to + for details and supported values. + ''; + example = literalExpression '' + { + WP_DEFAULT_THEME = "twentytwentytwo"; + WP_SITEURL = "https://example.org"; + WP_HOME = "https://example.org"; + WP_DEBUG = true; + WP_DEBUG_DISPLAY = true; + WPLANG = "de_DE"; + FORCE_SSL_ADMIN = true; + AUTOMATIC_UPDATER_DISABLED = true; + } + ''; + }; + + mergedConfig = mkOption { + readOnly = true; + default = mergeConfig config; + defaultText = literalExpression '' + { + DISALLOW_FILE_EDIT = true; + AUTOMATIC_UPDATER_DISABLED = true; + } + ''; + description = lib.mdDoc '' + Read only representation of the final configuration. + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = lib.mdDoc '' + Any additional text to be appended to the wp-config.php + configuration file. This is a PHP script. For configuration + settings, see . + + **Note**: Please pass structured settings via + `services.wordpress.sites.${name}.settings` instead. + ''; + example = '' + @ini_set( 'log_errors', 'Off' ); + @ini_set( 'display_errors', 'On' ); + ''; + }; }; -in -{ - disabledModules = ["services/web-apps/wordpress.nix"]; + + config.virtualHost.hostName = mkDefault name; + }; +in { + disabledModules = ["services/web-apps/wordpress.nix"]; # interface options = { services.wordpress = { - sites = mkOption { type = types.attrsOf (types.submodule siteOpts); default = {}; @@ -361,7 +385,7 @@ in }; webserver = mkOption { - type = types.enum [ "httpd" "nginx" "caddy" ]; + type = types.enum ["httpd" "nginx" "caddy"]; default = "httpd"; description = lib.mdDoc '' Whether to use apache2 or nginx for virtual host management. @@ -373,202 +397,218 @@ in See [](#opt-services.httpd.virtualHosts) for further information. ''; }; - }; }; # implementation - config = mkIf (eachSite != {}) (mkMerge [{ + config = mkIf (eachSite != {}) (mkMerge [ + { + assertions = + (mapAttrsToList (hostName: cfg: { + assertion = cfg.database.createLocally -> cfg.database.user == user; + message = ''services.wordpress.sites."${hostName}".database.user must be ${user} if the database is to be automatically provisioned''; + }) + eachSite) + ++ (mapAttrsToList (hostName: cfg: { + assertion = cfg.database.createLocally -> cfg.database.passwordFile == null; + message = ''services.wordpress.sites."${hostName}".database.passwordFile cannot be specified if services.wordpress.sites."${hostName}".database.createLocally is set to true.''; + }) + eachSite); - assertions = - (mapAttrsToList (hostName: cfg: - { assertion = cfg.database.createLocally -> cfg.database.user == user; - message = ''services.wordpress.sites."${hostName}".database.user must be ${user} if the database is to be automatically provisioned''; - }) eachSite) ++ - (mapAttrsToList (hostName: cfg: - { assertion = cfg.database.createLocally -> cfg.database.passwordFile == null; - message = ''services.wordpress.sites."${hostName}".database.passwordFile cannot be specified if services.wordpress.sites."${hostName}".database.createLocally is set to true.''; - }) eachSite); + services.mysql = mkIf (any (v: v.database.createLocally) (attrValues eachSite)) { + enable = true; + package = mkDefault pkgs.mariadb; + ensureDatabases = mapAttrsToList (hostName: cfg: cfg.database.name) eachSite; + ensureUsers = + mapAttrsToList ( + hostName: cfg: { + name = cfg.database.user; + ensurePermissions = {"${cfg.database.name}.*" = "ALL PRIVILEGES";}; + } + ) + eachSite; + }; + services.phpfpm.pools = + mapAttrs' (hostName: cfg: ( + nameValuePair "wordpress-${hostName}" { + inherit user; + group = webserver.group; + settings = + { + "listen.owner" = webserver.user; + "listen.group" = webserver.group; + } + // cfg.poolConfig; + } + )) + eachSite; + } - services.mysql = mkIf (any (v: v.database.createLocally) (attrValues eachSite)) { - enable = true; - package = mkDefault pkgs.mariadb; - ensureDatabases = mapAttrsToList (hostName: cfg: cfg.database.name) eachSite; - ensureUsers = mapAttrsToList (hostName: cfg: - { name = cfg.database.user; - ensurePermissions = { "${cfg.database.name}.*" = "ALL PRIVILEGES"; }; - } - ) eachSite; - }; + (mkIf (cfg.webserver == "httpd") { + services.httpd = { + enable = true; + extraModules = ["proxy_fcgi"]; + virtualHosts = mapAttrs (hostName: cfg: + mkMerge [ + cfg.virtualHost + { + documentRoot = mkForce "${pkg hostName cfg}/share/wordpress"; + extraConfig = '' + + + + SetHandler "proxy:unix:${config.services.phpfpm.pools."wordpress-${hostName}".socket}|fcgi://localhost/" + + - services.phpfpm.pools = mapAttrs' (hostName: cfg: ( - nameValuePair "wordpress-${hostName}" { - inherit user; + # standard wordpress .htaccess contents + + RewriteEngine On + RewriteBase / + RewriteRule ^index\.php$ - [L] + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule . /index.php [L] + + + DirectoryIndex index.php + Require all granted + Options +FollowSymLinks -Indexes + + + # https://wordpress.org/support/article/hardening-wordpress/#securing-wp-config-php + + Require all denied + + ''; + } + ]) + eachSite; + }; + }) + + { + systemd.tmpfiles.rules = flatten (mapAttrsToList (hostName: cfg: [ + "d '${stateDir hostName}' 0750 ${user} ${webserver.group} - -" + "d '${cfg.uploadsDir}' 0750 ${user} ${webserver.group} - -" + "Z '${cfg.uploadsDir}' 0750 ${user} ${webserver.group} - -" + "d '${cfg.fontsDir}' 0750 ${user} ${webserver.group} - -" + "Z '${cfg.fontsDir}' 0750 ${user} ${webserver.group} - -" + ]) + eachSite); + + systemd.services = mkMerge [ + (mapAttrs' (hostName: cfg: ( + nameValuePair "wordpress-init-${hostName}" { + wantedBy = ["multi-user.target"]; + before = ["phpfpm-wordpress-${hostName}.service"]; + after = optional cfg.database.createLocally "mysql.service"; + script = secretsScript (stateDir hostName); + + serviceConfig = { + Type = "oneshot"; + User = user; + Group = webserver.group; + }; + } + )) + eachSite) + + (optionalAttrs (any (v: v.database.createLocally) (attrValues eachSite)) { + httpd.after = ["mysql.service"]; + }) + ]; + + users.users.${user} = { group = webserver.group; - settings = { - "listen.owner" = webserver.user; - "listen.group" = webserver.group; - } // cfg.poolConfig; - } - )) eachSite; + isSystemUser = true; + }; + } - } - - (mkIf (cfg.webserver == "httpd") { - services.httpd = { - enable = true; - extraModules = [ "proxy_fcgi" ]; - virtualHosts = mapAttrs (hostName: cfg: mkMerge [ cfg.virtualHost { - documentRoot = mkForce "${pkg hostName cfg}/share/wordpress"; - extraConfig = '' - - - - SetHandler "proxy:unix:${config.services.phpfpm.pools."wordpress-${hostName}".socket}|fcgi://localhost/" - - - - # standard wordpress .htaccess contents - - RewriteEngine On - RewriteBase / - RewriteRule ^index\.php$ - [L] - RewriteCond %{REQUEST_FILENAME} !-f - RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule . /index.php [L] - - - DirectoryIndex index.php - Require all granted - Options +FollowSymLinks -Indexes - - - # https://wordpress.org/support/article/hardening-wordpress/#securing-wp-config-php - - Require all denied - - ''; - } ]) eachSite; - }; - }) - - { - systemd.tmpfiles.rules = flatten (mapAttrsToList (hostName: cfg: [ - "d '${stateDir hostName}' 0750 ${user} ${webserver.group} - -" - "d '${cfg.uploadsDir}' 0750 ${user} ${webserver.group} - -" - "Z '${cfg.uploadsDir}' 0750 ${user} ${webserver.group} - -" - "d '${cfg.fontsDir}' 0750 ${user} ${webserver.group} - -" - "Z '${cfg.fontsDir}' 0750 ${user} ${webserver.group} - -" - ]) eachSite); - - systemd.services = mkMerge [ - (mapAttrs' (hostName: cfg: ( - nameValuePair "wordpress-init-${hostName}" { - wantedBy = [ "multi-user.target" ]; - before = [ "phpfpm-wordpress-${hostName}.service" ]; - after = optional cfg.database.createLocally "mysql.service"; - script = secretsScript (stateDir hostName); - - serviceConfig = { - Type = "oneshot"; - User = user; - Group = webserver.group; - }; - })) eachSite) - - (optionalAttrs (any (v: v.database.createLocally) (attrValues eachSite)) { - httpd.after = [ "mysql.service" ]; - }) - ]; - - users.users.${user} = { - group = webserver.group; - isSystemUser = true; - }; - } - - (mkIf (cfg.webserver == "nginx") { - services.nginx = { - enable = true; - virtualHosts = mapAttrs (hostName: cfg: { - serverName = mkDefault hostName; - root = "${pkg hostName cfg}/share/wordpress"; - extraConfig = '' - index index.php; - ''; - locations = { - "/" = { - priority = 200; + (mkIf (cfg.webserver == "nginx") { + services.nginx = { + enable = true; + virtualHosts = + mapAttrs (hostName: cfg: { + serverName = mkDefault hostName; + root = "${pkg hostName cfg}/share/wordpress"; extraConfig = '' - try_files $uri $uri/ /index.php$is_args$args; + index index.php; ''; - }; - "~ \\.php$" = { - priority = 500; - extraConfig = '' - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:${config.services.phpfpm.pools."wordpress-${hostName}".socket}; - fastcgi_index index.php; - include "${config.services.nginx.package}/conf/fastcgi.conf"; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; - # Mitigate https://httpoxy.org/ vulnerabilities - fastcgi_param HTTP_PROXY ""; - fastcgi_intercept_errors off; - fastcgi_buffer_size 16k; - fastcgi_buffers 4 16k; - fastcgi_connect_timeout 300; - fastcgi_send_timeout 300; - fastcgi_read_timeout 300; - ''; - }; - "~ /\\." = { - priority = 800; - extraConfig = "deny all;"; - }; - "~* /(?:uploads|files)/.*\\.php$" = { - priority = 900; - extraConfig = "deny all;"; - }; - "~* \\.(js|css|png|jpg|jpeg|gif|ico)$" = { - priority = 1000; - extraConfig = '' - expires max; - log_not_found off; - ''; - }; - }; - }) eachSite; - }; - }) + locations = { + "/" = { + priority = 200; + extraConfig = '' + try_files $uri $uri/ /index.php$is_args$args; + ''; + }; + "~ \\.php$" = { + priority = 500; + extraConfig = '' + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:${config.services.phpfpm.pools."wordpress-${hostName}".socket}; + fastcgi_index index.php; + include "${config.services.nginx.package}/conf/fastcgi.conf"; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; + # Mitigate https://httpoxy.org/ vulnerabilities + fastcgi_param HTTP_PROXY ""; + fastcgi_intercept_errors off; + fastcgi_buffer_size 16k; + fastcgi_buffers 4 16k; + fastcgi_connect_timeout 300; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + ''; + }; + "~ /\\." = { + priority = 800; + extraConfig = "deny all;"; + }; + "~* /(?:uploads|files)/.*\\.php$" = { + priority = 900; + extraConfig = "deny all;"; + }; + "~* \\.(js|css|png|jpg|jpeg|gif|ico)$" = { + priority = 1000; + extraConfig = '' + expires max; + log_not_found off; + ''; + }; + }; + }) + eachSite; + }; + }) - (mkIf (cfg.webserver == "caddy") { - services.caddy = { - enable = true; - virtualHosts = mapAttrs' (hostName: cfg: ( - nameValuePair "${hostName}" { - extraConfig = '' - root * /${pkg hostName cfg}/share/wordpress - file_server + (mkIf (cfg.webserver == "caddy") { + services.caddy = { + enable = true; + virtualHosts = + mapAttrs' (hostName: cfg: ( + nameValuePair "${hostName}" { + extraConfig = '' + root * /${pkg hostName cfg}/share/wordpress + file_server - php_fastcgi unix/${config.services.phpfpm.pools."wordpress-${hostName}".socket} + php_fastcgi unix/${config.services.phpfpm.pools."wordpress-${hostName}".socket} - @uploads { - path_regexp path /uploads\/(.*)\.php + @uploads { + path_regexp path /uploads\/(.*)\.php + } + rewrite @uploads / + + @wp-admin { + path not ^\/wp-admin/* + } + rewrite @wp-admin {path}/index.php?{query} + ''; } - rewrite @uploads / - - @wp-admin { - path not ^\/wp-admin/* - } - rewrite @wp-admin {path}/index.php?{query} - ''; - } - )) eachSite; - }; - }) - - + )) + eachSite; + }; + }) ]); }