question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Usage with Xonsh Shell

See original GitHub issue

Hello!

Would it be possible to implement a mach-nix.mkXonsh option, which will install optional modules for the xonsh python-based shell? Or instead, could anyone show me how to implement it myself?

Thank you kindly for your consideration!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

2reactions
DavHaucommented, Sep 16, 2020

extra_pkgs is not available for buildPythonPackage/Applicaiton, only for mkPython. So I changed the expression to first build the xonsh package, and then combine it with the extra package using mkPython:

let
  mach-nix = import (builtins.fetchGit {
   url = "https://github.com/DavHau/mach-nix/";
   ref = "refs/tags/2.3.0";
  });
  pkgs = mach-nix.nixpkgs;

  # build the xonsh package similar like in nixpkgs
  xonsh_pkg = with pkgs.xonsh; mach-nix.buildPythonPackage {
    inherit src LC_ALL postPatch passthru;
    add_requirements = ''
      ply
      prompt_toolkit
      pygments

      # add requirements here
      yubico-client
      pipx
      borgmatic

      # add xontribs here
      xontrib-autojump
      xonsh-direnv
      xontrib-powerline2
    '';
  };

  # build environment with xonsh + python packages from arbitrary sources
  xonsh_env = mach-nix.mkPython {
    extra_pkgs = [
      xonsh_pkg
      "https://gitlab.com/picotech/nanotech/nanite/-/archive/master/nanite-master.tar.gz"
    ];
  };

  # wrap it again to set the passthru variable correctly
  xonsh_shell = with pkgs.xonsh; pkgs.buildEnv {
    inherit name passthru;
    paths = [ xonsh_env ];
  };
in
xonsh_shell

BTW, for specifying extras for normal requirements just use the same notation like in pip. For example requests[socks] to get requests with extras socks.

1reaction
DavHaucommented, Sep 16, 2020

Oh yeah. I should update the readme. Thanks

In addition, I’m assuming to just import this file as the package value for config.programs.xonsh.package like before?

Excatly. I didn’t try this myself but I assume this must work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Xonsh Shell — Python-powered shell
The xonsh shell is a Python-powered, cross-platform, Unix-gazing shell language and command ... Xonsh is meant for the daily use of experts and...
Read more >
Xonsh Shell Combines the Best of Bash Shell and Python ...
It combines Python and bash shell in a way that you can run Python commands directly in the shell. You can even combine...
Read more >
Xonsh — a Python-powered shell - Medium
A language that allows us to use Python in the shell and the shell in Python ... The xonsh language has shell primitives...
Read more >
Xonsh - GitHub
The language is a superset of Python 3.6+ with additional shell primitives. xonsh (pronounced conch) is meant for the daily use of experts...
Read more >
Xonsh: a Python and Bash Shell - Fun Tech Projects
Using Bash. Xonsh uses Python first, so an example with ls (the Bash list command):. 1. 2.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found