Added nix support

This commit is contained in:
Dreaded_X 2024-04-16 02:50:45 +02:00
parent 5574cc866a
commit 302888261f
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4
2 changed files with 24 additions and 0 deletions

View File

@ -43,6 +43,7 @@ tools.servers = {
}, },
taplo = {}, taplo = {},
neocmake = {}, neocmake = {},
nil_ls = {},
} }
-- https://github.com/stevearc/conform.nvim -- https://github.com/stevearc/conform.nvim
@ -58,6 +59,7 @@ tools.formatters = require("util.conform").assign_formatters({
lua = { "stylua" }, lua = { "stylua" },
json = { "jq" }, json = { "jq" },
toml = { "taplo" }, toml = { "taplo" },
nix = { "nixfmt" },
-- ["*"] = { "codespell" }, -- ["*"] = { "codespell" },
["_"] = { "trim_whitespace", "trim_newlines" }, ["_"] = { "trim_whitespace", "trim_newlines" },
}) })

View File

@ -232,6 +232,27 @@ prompt_virtualenv() {
fi fi
} }
# nix-shell: currently running nix-shell
prompt_nix_shell() {
if [[ -n "$IN_NIX_SHELL" ]]; then
if [[ -n $NIX_SHELL_PACKAGES ]]; then
local package_names=""
local packages=($NIX_SHELL_PACKAGES)
for package in $packages; do
package_names+=" ${package##*.}"
done
prompt_segment magenta black "$package_names"
elif [[ -n $name ]]; then
local cleanName=${name#interactive-}
cleanName=${cleanName#lorri-keep-env-hack-}
cleanName=${cleanName%-environment}
prompt_segment magenta black "$cleanName"
else # This case is only reached if the nix-shell plugin isn't installed or failed in some way
prompt_segment magenta black "nix-shell"
fi
fi
}
# Status: # Status:
# - was there an error # - was there an error
# - am I root # - am I root
@ -262,6 +283,7 @@ build_prompt() {
prompt_status prompt_status
prompt_context prompt_context
prompt_virtualenv prompt_virtualenv
prompt_nix_shell
prompt_aws prompt_aws
prompt_dir prompt_dir
prompt_git prompt_git