From 5926cd356d28a6652934a2fdae111f71bddb6246 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 5 Sep 2023 11:15:33 +0000 Subject: [PATCH] home: direnv: allow impure 'use pkgs' This makes it easier to use non-free or insecure packages. --- home/direnv/lib/nix.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/home/direnv/lib/nix.sh b/home/direnv/lib/nix.sh index b0c2dae..e05025b 100644 --- a/home/direnv/lib/nix.sh +++ b/home/direnv/lib/nix.sh @@ -9,6 +9,8 @@ use_pkgs() { # Use user-provided default value, or fallback to nixpkgs local DEFAULT_FLAKE="${DIRENV_DEFAULT_FLAKE:-nixpkgs}" + # Additional args that should be forwarded to `nix` + local args=() # Allow changing the default flake through a command line switch while true; do @@ -17,6 +19,10 @@ use_pkgs() { DEFAULT_FLAKE="$2" shift 2 ;; + -i|--impure) + args+=(--impure) + shift + ;; --) shift break @@ -39,5 +45,5 @@ use_pkgs() { done # shellcheck disable=2154 - direnv_load nix shell "${packages[@]}" --command "$direnv" dump + direnv_load nix shell "${args[@]}" "${packages[@]}" --command "$direnv" dump }