# If you see this output, you probably forgot to pipe it into `source`: # nix-your-shell nu | save nix-your-shell.nu def _nix_your_shell (command: string, args: list) { if not (which {{ executable }} | is-empty) { {%- if extra_args %} {#- If you squint hard enough, JSON lists are just Nu lists #} let args = {{ extra_args | tojson }} ++ ["--"] ++ $args {%- else %} let args = ["--"] ++ $args {%- endif %} run-external {{ executable }} nu $command ...$args } else { run-external $command ...$args } } def --wrapped nix-shell (...args) { _nix_your_shell nix-shell $args } def --wrapped nix (...args) { _nix_your_shell nix $args }