Nix : Use flake.nix in current dir for shell.

This commit is contained in:
Dmitry Voronin 2024-02-06 14:02:26 +03:00
parent 8ece0ebe85
commit 7da7d567a0

View file

@ -60,13 +60,17 @@ function nix_clean() {
_is_root && nix-store --gc
}
# Spawn shell with specified nix environment. `Main` is default.
# Spawn shell with specified nix environment.
# Uses flake.nix in current dir by default.
# Usage: nix_shell [NAME]
function nix_shell() {
local name="${1,,}"
[[ "${name}" = "" ]] && name="main"
NIX_SHELL="${name}" nix develop -f ~/.config/linux/shell/"${name^}".nix
if [[ "${name}" = "" ]]; then
NIX_SHELL=$(parse_alnum "${PWD##*/}") nix develop -f ./flake.nix
else
NIX_SHELL="${name}" nix develop -f ~/.config/linux/shell/"${name^}".nix
fi
}
alias shell="nix_shell"