Nix : Use flake.nix in current dir for shell.
This commit is contained in:
parent
8ece0ebe85
commit
7da7d567a0
|
@ -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"
|
||||
|
||||
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"
|
||||
|
||||
|
|
Reference in a new issue