Nix : Shell to spawn nix-shell.
This commit is contained in:
parent
197f7bcb0a
commit
0ced40b4f0
|
@ -71,7 +71,20 @@ function nix_shell() {
|
||||||
|
|
||||||
nix_shell="${name}" nix-shell ~/.config/linux/shell/"${name^}".nix
|
nix_shell="${name}" nix-shell ~/.config/linux/shell/"${name^}".nix
|
||||||
}
|
}
|
||||||
alias shell="nix_shell"
|
alias mkshell="nix_shell"
|
||||||
|
|
||||||
|
# Spawn nix-shell with specified packages.
|
||||||
|
# Usage: shell <PACKAGES>
|
||||||
|
function shell() {
|
||||||
|
local pkgs="${*}"
|
||||||
|
|
||||||
|
if [[ "${pkgs}" = "" ]]; then
|
||||||
|
help shell
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
nix-shell -p "${pkgs}"
|
||||||
|
}
|
||||||
|
|
||||||
# Autocomplete with available hosts.
|
# Autocomplete with available hosts.
|
||||||
function _comp_hosts() {
|
function _comp_hosts() {
|
||||||
|
@ -87,8 +100,7 @@ function _comp_shells() {
|
||||||
local targets=($(ls ~/.config/linux/shell/ | sed -e "s/.nix$//" | tr '[:upper:]' '[:lower:]'))
|
local targets=($(ls ~/.config/linux/shell/ | sed -e "s/.nix$//" | tr '[:upper:]' '[:lower:]'))
|
||||||
|
|
||||||
_autocomplete_first ${targets[@]}
|
_autocomplete_first ${targets[@]}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -F _comp_hosts nix_update nix_upgrade
|
complete -F _comp_hosts nix_update nix_upgrade
|
||||||
complete -F _comp_shells nix_shell shell
|
complete -F _comp_shells nix_shell mkshell
|
||||||
|
|
|
@ -280,6 +280,7 @@ Command|Description
|
||||||
`nix_upgrade [HOSTNAME]`|Upgrade system. Applies after reboot. Optionally force the hostname.
|
`nix_upgrade [HOSTNAME]`|Upgrade system. Applies after reboot. Optionally force the hostname.
|
||||||
`nix_clean`|Free up root space.
|
`nix_clean`|Free up root space.
|
||||||
`nix_shell [NAME]`|Spawn shell with specified nix environment. `Main` is default.
|
`nix_shell [NAME]`|Spawn shell with specified nix environment. `Main` is default.
|
||||||
|
`shell <PACKAGES>`|Spawn nix-shell with specified packages.
|
||||||
|
|
||||||
## Notify.
|
## Notify.
|
||||||
|
|
||||||
|
|
Reference in a new issue