haslersn / any-nix-shell

fish and zsh support for the nix run and nix-shell environments of the Nix package manager
MIT License
253 stars 17 forks source link

Support for Xonsh #18

Closed amacfie closed 1 year ago

amacfie commented 1 year ago

Great tool, thank you to the devs. If scripts for the xonsh shell could be added that would be useful.

amacfie commented 1 year ago

Until the pull request is merged, xonsh users can add this to their xonsh config file (assumes current version of any-nix-shell is installed)

aliases["nix-shell"] = "@($(which .any-nix-shell-wrapper)) xonsh @($args)"
def __nix(args):
    if args and args[0] == "run":
        @($(which .any-nix-wrapper)) xonsh @(args)
    else:
        @($(which -s nix)) @(args)
aliases["nix"] = __nix
$RIGHT_PROMPT = lambda: $(@($(which nix-shell-info)))