I’ve tried just about every type of setup I can find for a nix shell with python.
I don’t want to purely use nixpkgs for a lack of some packages and broken packages. I’m trying to use pyside6, but not everything in pyside6 is provided by the package, e.g. tools like uic.
Attempting to use a venv as normal leads to a disconnect between the env and system with libstdc++.so.6 unable to be found. There are a various different flakes I’ve tried to use like the-nix-way/dev-templates#python and others from forum discussions which add stdenv.cc.cc.lib to no avail.
I think the farthest I’ve gotten is with poetry/poetry2nix, where auto-patchelf warns about missing libQt6 libraries. Running with nix run fails to ‘find all the required dependencies’ even when adding qt6.qtbase or qt6.full to the packages. This is that flake, taken from the poetry2nix github with an added devshell:
{
description = "Python application packaged using poetry2nix";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
poetry2nix.url = "github:nix-community/poetry2nix";
};
outputs = { self, nixpkgs, poetry2nix }:
let
system = "x86_64-linux"; # Adjust for your system
pkgs = nixpkgs.legacyPackages.${system};
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication;
in {
packages.${system}.default = mkPoetryApplication {
projectDir = ./.;
};
apps.${system}.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/app";
};
devShells.${system}.default = pkgs.mkShell {
packages = [ pkgs.poetry ];
buildInputs = [ pkgs.qt6.qtbase pkgs.qt6.full pkgs.qt6.wrapQtAppsHook ];
};
};
}
It seems kind of hopeless to get it working on NixOS. Does anyone have a working setup I could use for inspiration, or any other tips? I love the nix paradigm, but I’m honestly considering distrohopping with all of the trouble.
From this page it seems you need libclang 13+, then you need to set the LLVM_INSTALL_DIR appropriately. There’s
llvmPackages_13.libclang
in nixpkgs, and some later versions too.Unfortunately this will probably not fix your missing qt lib issues. Dumb thing to try there, only have full, not both full and qtbase.
I only tried adding
qt6.full
because of the missing libs. Withoutqtbase
, though, the shell fails to build withwrapQtAppsHook qtHostPathHook: qtPluginPrefix is unset. hint: add qt6.qtbase to buildInputs
I would assume the full package would basically be like base plus more, but I don’t know lol