Closed JonathanReeve closed 9 months ago
For the xontrib in nix, looks like the modules just need to be on the $PYTHONPATH, so perhaps we just need to wrap xonsh like we wrap python default.nix wrapper.nix with-packages.nix. Perhaps we could even just use the python wrapper.nix.
I might have a play around with xonsh, and then if you haven't already, try to package stuff for it. Until then, you could try installing xontrib-z into some path, then putting that into your $PYTHONPATH?
Hello, I'm a bot and I thank you in the name of the community for opening this issue.
To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.
The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.
If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.
Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.
This is still relevant, as far I I know.
I actually use this mach-nix overlay: https://github.com/shadowrylander/shadowrylander/blob/system/etc/nixos/shared/global/_overlays/xonsh.nix
Unfortunately at the moment, there seems to be an infinite recursion error with the newPkgs
statement; it works when using a flake, however!
Does anyone successfully solved this? @shadowrylander link is no longer available...
@tex I believe I'm still using the overlay in this issue! Though there still seems to be some problems.
I can confirm than adding package to your $PYTHONPATH
does work. Also from inside the xonsh shell, adding my local pip
site-packages directory to sys.path
does work, which is not ideal. It would be nice to be able to have some sort of wrapper to add xcontrib modules more easily without clashing with NixOS philosophy.
so I'm currently using xonsh like this in my configuration:
{ config, lib, pkgs, ... }: let
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
ref = "refs/tags/3.3.0";
}) {
pkgs = pkgs;
};
pyenv = mach-nix.mkPython {
requirements = ''
xontrib-sh
xxh-xxh
'';
};
xonshrc = pkgs.writeText "xonshrc" ''
$PROMPT = '{BOLD_GREEN}{user}@{hostname}{BOLD_BLUE} {cwd}{NO_COLOR}> '
$XONSH_COLOR_STYLE = 'rrt'
xontrib load sh
'';
xonsh_with_plugins = pkgs.xonsh.overrideAttrs (old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ pyenv.python.pkgs.selectPkgs pyenv.python.pkgs;
});
in {
environment.variables.XONSHRC = builtins.toString xonshrc;
environment.systemPackages = [
xonsh_with_plugins
];
}
this works for me and I can install any plugins/python lib that way
I marked this as stale due to inactivity. → More info
This is still happening to me.
@Lassulus where does this config go for your workaround? I tried to put it into ~/.xonshrc and that resulted in syntax errors so that might not be the right place?
Edit: My issue seems to have been completely different, I somehow didn't have pip installed? hrm
sudo apt install python3-pip
was all I needed to do.
uhm, I posted a nixos config. I would guess you are not on nixos since you are using apt-get?
Oh yes indeed, very sorry about that. I didn't realize what repo I was in, and this issue was highly ranked when I searched Google for this error.
I was trying to do this without mach-nix, but I couldn't figure it out?
{ pkgs, config, ... }:
let
python = pkgs.python311;
pythonPkgs = with python.pkgs; [
(python.pkgs.toPythonModule pkgs.xonsh)
(python.pkgs.buildPythonPackage rec {
pname = "xontrib-prompt-starship";
version = "0.3.4";
src = pkgs.fetchPypi {
inherit pname version;
sha256 = "2106d4e13618891f12657bd44f32ffba48cdeca18239031369de1a6fa4ff152b";
};
doCheck = false;
})
];
in {
home = {
packages = [ (python.withPackages (ps: pythonPkgs)) ];
};
}
But no dice,
@ home-manager switch
...
@ xontrib load starship_prompt
The following xontribs are enabled but not installed:
['starship_prompt']
Please make sure that they are installed correctly by checking https://xonsh.github.io/awesome-xontribs/
There's a way to install xonsh modules introduced by https://github.com/NixOS/nixpkgs/pull/240246. I think this issue can be closed.
Issue description
To install extensions in the xonsh shell, according to the documentation, you run
xontrib z
, wherez
is the name of the extension you want to install. Running that gives:However, running
xpip
fails on NixOS with:/nix/store/drr8qcgiccfc5by09r5zc30flgwh1mbx-python3-3.7.5/bin/python3.7: No module named pip
It'd be great if this command worked as expected. But even better, it'd be great to have the Xontribs (xonsh extensions) installable via nix, too, somehow. You can list them with
pip search xontrib
, so they're just python modules. Someone with more nix-fu than I could probably make an optionprograms.xonsh.plugins
that could install those python modules, such thatprograms.xonsh.plugins = [ z simplejump shedule ];
would install the python modulesxontrib-schedule
,xontrib-simplejump
, andxontrib-z
.Steps to reproduce
xonsh
xpip
, either with or without arguments.Technical details
Please run
nix run nixpkgs.nix-info -c nix-info -m
and paste the result."x86_64-linux"
Linux 5.3.14, NixOS, 20.03pre204199.3140fa89c51 (Markhor)
yes
yes
nix-env (Nix) 2.3.1
"home-manager, nixpkgs-20.03pre203529.e8f2764fe8d"
"nixos-20.03pre204199.3140fa89c51"
/home/jon/.nix-defexpr/channels/nixpkgs