Open GlassGhost opened 1 year ago
I even did a rm -rf ./env
and a full mach-nix env ./env -r ./requirements.txt
& nix-shell ./env
after a nixos rebuild after putting libkrb5 and krb5 in conf.nix
If you have nix-index package installed you should be able to nix-locate -1 -w libgssapi_krb5.so.2 | grep -v \(
to show the following packages should provide the libraries on the system
libkrb5.out
krb5.out
hyperion-ng.out
and I have libkrb5
and krb5
in my packages in my configuration.nix
and it still doesn't work
(mach-nix user here.)
Can you paste your Nix expression?
I just entered the commands above I listed and have the requirements.txt and it generated my shell.nix file.
I just entered the commands above I listed and have the requirements.txt and it generated my shell.nix file.
Ah, sorry I missed that.
I think what you found is that python packaging metadata doesn't include OS/system library dependencies, so you have to write a Nix expression and add that info manually with an overlay. Example here: https://github.com/DavHau/mach-nix/blob/master/examples.md#example-add-missing-build-inputs.
and I have libkrb5 and krb5 in my packages in my configuration.nix
and it still doesn't work
If you're talking about environment.systemPackages
, then NixOS doesn't generally work that way. If you put libraries there they won't be visible to the rest of the system automatically. That's by design, to avoid dependency hell. That option is for packages -- things to have in $PATH or in desktop launchers.
Anyway, taking your env/python.nix
as base:
with (import ./inputs.nix);
mach-nix.mkPython {
requirements = builtins.readFile ./requirements.txt;
}
and tweak it like this:
with (import ./inputs.nix);
mach-nix.mkPython {
requirements = builtins.readFile ./requirements.txt;
_.pyside2.buildInputs.add = with pkgs; [ libkrb5 ]; # LINE ADDED
}
then it works:
$ cd env && nix-shell --run 'python3 -c "from PySide2 import QtCore, QtGui, QtWidgets"'
(no error, exits successfully)
Thanks works great now!
is there anyway to make mach nix detect and add this lib if the library is in the requirements.txt or is this standard procedure
I added a pull request; https://github.com/DavHau/mach-nix/pull/495
To help others in this situation. I just realized the suggested method to find libs only works on nixos, but I think that should be enough for now.
is there anyway to make mach nix detect and add this lib if the library is in the requirements.txt or is this standard procedure
I think autoPatchelfHook can be told to fail if it's missing libs, but it only works for non-dlopen()
libs. Also, mach-nix contains a list of overrides for packages that has native library dependencies. You can create a PR to make pyside2
require libkrb5
so that it works out of the box. See example here: https://github.com/DavHau/mach-nix/commit/627ca70ac4c44be18329e8ac12635606798148cd.
I think the documentation already covers adding missing libraries. (That's how I learned about it.)
I added a pull request; https://github.com/DavHau/mach-nix/pull/495
To help others in this situation. I just realized the suggested method to find libs only works on nixos, but I think that should be enough for now.
I don't see anything in that PR that makes it NixOS specific.
You can create a PR to make pyside2 require libkrb5 so that it works out of the box. See example here: https://github.com/DavHau/mach-nix/commit/627ca70ac4c44be18329e8ac12635606798148cd.
But note that libkrb5 should be in buildInputs
(not nativeBuildInputs
).
@bjornfor
Ok so I think you're saying the proper way to fix this is to modify /mach_nix/fixes.nix
pyside2.add-native-inputs = { _cond = { prov, ver, ... }: prov == "sdist"; nativeBuildInputs.add = with pkgs; [ libkrb5 libsForQt5.full ]; };
I will try this later, but this does look better?
prov == "sdist"
should be changed to prov != "nixpkgs"
.s/nativeBuildInputs/buildInputs/
Ok I was trying my own clone of mach in directory /home/owner/mach-nix/
and these commands:
nix-env --uninstall mach-nix-master
nix-env -if /home/owner/mach-nix/ -A mach-nix
I tried many different combinations of
pyside2.add-native-inputs = {
_cond = { prov, ver, ... }: prov != "nixpkgs";
buildInputs.add = with pkgs; [ libkrb5 qt5Full ];
};
just trying to help in case anyone else is trying to get it to work with a simple requirements.txt Don't worry about me, I can get it to work is with added custom line in python.nix and yes it was getting errors without the qt5Full I believe pyside2 is qt5 and pyside 6 is qt6
_.pyside2.buildInputs.add = with pkgs; [ libkrb5 qt5Full ]; # LINE that worked in python.nix
Has anyone been using pyside on nixos? I'm trying to run an example from https://github.com/pyside/pyside2-examples
I used
nix-locate -1 -w libgssapi_krb5.so.2
to decide I neededlibkrb5
andkrb5
in my configuration.nix and I'm still getting the error below.