aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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