From f6f259214b1b00e18dd14f5a66d65b06842e6349 Mon Sep 17 00:00:00 2001 From: Andreas Schmid Date: Sat, 11 Dec 2021 09:22:31 +0100 Subject: [PATCH] add nix version 2.4 compatibility Signed-off-by: Andreas Schmid --- , | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/, b/, index 875fa30..df35659 100755 --- a/, +++ b/, @@ -40,5 +40,15 @@ fi if [[ -n $install ]]; then nix-env -iA "nixpkgs.${attr%%.*}" else - nix run "nixpkgs.${attr}" -c "${argv0}" "$@" + nix_version_greater_or_equal() { + local nix_version + nix_version=$(nix --version | cut -f3 -d ' ') + printf '%s\n%s' "$1" "$nix_version" | sort -C -V + } + + if nix_version_greater_or_equal "2.4"; then + nix --extra-experimental-features 'nix-command flakes' shell "nixpkgs#${attr}" -c "${argv0}" "$@" + else + nix run "nixpkgs.${attr}" -c "${argv0}" "$@" + fi fi