aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-09-27 10:23:17 +0200
committerKarel Kočí <cynerd@email.cz>2022-09-27 10:23:17 +0200
commitd8e92e2705e1e411a46d23720e533bb34604ec1a (patch)
tree2699923d18e3dc512b089a42ca1b47b4abf5c345
parent7a90b467f6ac04afc0a2ee581f451d319613070e (diff)
downloadshellrc-d8e92e2705e1e411a46d23720e533bb34604ec1a.tar.gz
shellrc-d8e92e2705e1e411a46d23720e533bb34604ec1a.tar.bz2
shellrc-d8e92e2705e1e411a46d23720e533bb34604ec1a.zip
nix: add support for path correctly
-rw-r--r--shellrc.d/nix13
1 files changed, 8 insertions, 5 deletions
diff --git a/shellrc.d/nix b/shellrc.d/nix
index e3357a6..bf26cd5 100644
--- a/shellrc.d/nix
+++ b/shellrc.d/nix
@@ -4,12 +4,15 @@ if command -v nix >/dev/null; then
dev() {
local target="$1"
local flake dev
- IFS='#' read flake dev <<<"$target"
- if [ -z "$dev" ]; then
- dev="$flake"
- flake="personal"
- if [ -z "$dev" ]; then
+ if [[ "${target#*"#"}" != "$target" ]]; then
+ IFS='#' read flake dev <<<"$target"
+ else
+ if [ -e "$target" ]; then
+ flake="$target"
dev="default"
+ else
+ flake="personal"
+ dev="${target:-default}"
fi
fi
nix develop "$flake#$dev" -c zsh