Open sandangel opened 2 years ago
Try
let
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
ref = "refs/heads/master";
#rev = "..."; # recommended to pin a commit
}) { };
customPython = mach-nix.mkPython {
requirements = ''
pynvim
python-lsp-black
python-lsp-server
pylsp-mypy
'';
};
in
customPython
That got me a 'pylsp' binary..
I tried that already. pysql is executable, but that won't work for neovim because python runtime need to be aware of those python packages:
I'm not exactly sure what you're aiming for, but perhaps you get what you want by changing mkPython
to mkPythonShell
and then use nix-shell
?
@bjornfor hi, thanks for your help. I'm trying to set up the neovim lsp for python. I want to install the lsp server packages using nix, but they are old. so I thought I could use mach-nix to install newer version. but apperently it doesn't work with mach-nix because neovim python need to reference them as its site packages, basically the nix venv version of python.
So you want neovim from nixpkgs to be built with a custom python from mach-nix?
not neccessary, just the pkgs.python3 from nixpkgs need to be aware of python packages from mach-nix. or if mach-nix also installing python, I need to configure neovim to point to that python.
I looked a bit into it and found the nixpkgs expressions for neovim to be written in such a way that providing a mach-nix customPython to it wasn't that straight forward.
I'm not sure whether this interface mismatch is an issue in mach-nix or nixpkgs :-)
you can always config neovim python with vim.g.python3_host_prog = vim.env.HOME .. '/.nix-profile/bin/python'
. It's just that python need to be aware of site packages installed by mach-nix. I still can not figure out.
Then point to a customPython from mach-nix instead of $HOME/.nix-profile/bin/python
?
@bjornfor where is that python though . I need the path
For a quick hack, run command -v python3
when you're in your working mach-nix python env. That'll give you the path.
For a quick hack, run
command -v python3
when you're in your working mach-nix python env. That'll give you the path.
Better: Use something like https://github.com/DavHau/mach-nix/issues/493#issuecomment-1188151209 as starting point and run nix-build
to get the store path.
I got /nix/store/10nbcgpi5vgbadacrd1b8aw0gfgpk293-python3-3.10.5/bin/python
, but I want to have something like "${customPython.pkgs}/bin/python"
in my nvim config instead of hard coding.
I got
/nix/store/10nbcgpi5vgbadacrd1b8aw0gfgpk293-python3-3.10.5/bin/python
, but I want to have something like"${customPython.pkgs}/bin/python"
in my nvim config instead of hard coding.
"${customPython.pkgs}/bin/python"
-> "${import ./your-mach-nix-python-file.nix}/bin/python"
?
Hi, some python nixpkgs is old. I'm trying to use
mach-nix
to install that package from official registries (like pip) instead.what I tried so far:
but I don't get the pylsp binary installed. This code is working:
but of course the version is older.