From 2e82170f0689000d50ba5409fb139863f59ffd92 Mon Sep 17 00:00:00 2001 From: Charles Hall Date: Fri, 14 Feb 2025 10:41:18 -0800 Subject: [PATCH] rely on function autocalling Instead of the current behavior of always trying to call the expression as a function, or alternatively, trying to implement autocalling manually with `builtins.isFunction`. --- direnvrc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/direnvrc b/direnvrc index 5e214a87..ada02d52 100644 --- a/direnvrc +++ b/direnvrc @@ -492,11 +492,9 @@ use_nix() { if [[ -n $packages ]]; then extra_args+=("--expr" "with import {}; mkShell { buildInputs = [ $packages ]; }") else - # figure out what attribute we should build - if [[ -z $attribute ]]; then - extra_args+=("--file" "$nixfile") - else - extra_args+=("--expr" "(import ${nixfile} {}).${attribute}") + extra_args+=("--file" "$nixfile") + if [[ -n $attribute ]]; then + extra_args+=("$attribute") fi fi