From d8e92e2705e1e411a46d23720e533bb34604ec1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 27 Sep 2022 10:23:17 +0200 Subject: nix: add support for path correctly --- shellrc.d/nix | 13 ++++++++----- 1 file 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 -- cgit v1.2.3