home: direnv: allow impure 'use pkgs'
This makes it easier to use non-free or insecure packages.
This commit is contained in:
parent
ac93cb0ac8
commit
5926cd356d
|
@ -9,6 +9,8 @@ use_pkgs() {
|
||||||
|
|
||||||
# Use user-provided default value, or fallback to nixpkgs
|
# Use user-provided default value, or fallback to nixpkgs
|
||||||
local DEFAULT_FLAKE="${DIRENV_DEFAULT_FLAKE:-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
|
# Allow changing the default flake through a command line switch
|
||||||
while true; do
|
while true; do
|
||||||
|
@ -17,6 +19,10 @@ use_pkgs() {
|
||||||
DEFAULT_FLAKE="$2"
|
DEFAULT_FLAKE="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
-i|--impure)
|
||||||
|
args+=(--impure)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
|
@ -39,5 +45,5 @@ use_pkgs() {
|
||||||
done
|
done
|
||||||
|
|
||||||
# shellcheck disable=2154
|
# shellcheck disable=2154
|
||||||
direnv_load nix shell "${packages[@]}" --command "$direnv" dump
|
direnv_load nix shell "${args[@]}" "${packages[@]}" --command "$direnv" dump
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue