From 90947cf469bb15dbcee18fc7c6274420d7cf3c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 6 May 2024 12:38:59 +0200 Subject: pkgs/dev: Fix usage with new version of nix --- pkgs/dev/default.nix | 4 +++- pkgs/dev/dev.sh | 11 +++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkgs/dev/default.nix b/pkgs/dev/default.nix index dfc0cd7..959be0c 100644 --- a/pkgs/dev/default.nix +++ b/pkgs/dev/default.nix @@ -12,7 +12,7 @@ with lib; let ) devShells); in - stdenvNoCC.mkDerivation rec { + stdenvNoCC.mkDerivation { name = "personal-devshells"; src = ./.; @@ -22,4 +22,6 @@ in --prefix PATH : ${lib.makeBinPath [bash nix]} \ --set DEV_SHELLS "${shells}" ''; + + meta.mainProgram = "dev"; } diff --git a/pkgs/dev/dev.sh b/pkgs/dev/dev.sh index adf70f8..8546b85 100755 --- a/pkgs/dev/dev.sh +++ b/pkgs/dev/dev.sh @@ -1,18 +1,17 @@ #!/usr/bin/env bash set -eu -target="${1:-}" -shift +target="${1:-.}" +[[ $# -eq 0 ]] || shift declare -a nixargs -known_shells="$(tr ':' '\n' <<<"${DEV_SHELLS:-}")" -while IFS='=' read name drv res; do +while IFS='=' read -r name drv _; do if [ "$target" == "$name" ]; then - target="$drv" + target="$drv^*" # Note: no network should be needed as this should be available nixargs+=("--offline") break fi -done <<<"$known_shells" +done < <(tr ':' '\n' <<<"${DEV_SHELLS:-}") exec nix "${nixargs[@]}" develop "$target" -c zsh "$@" -- cgit v1.2.3