fixed python packages AGAIN

This commit is contained in:
TheK0tYaRa 2026-03-11 02:29:01 +02:00
parent 702ce20cf6
commit 0ade2c3962
3 changed files with 85 additions and 2 deletions

View file

@ -3,10 +3,12 @@
prev,
lib,
forFlakeOutputs ? false,
forPythonScope ? false,
...
}:
let
dirs = path: lib.attrNames (lib.filterAttrs (_: t: t == "directory") (builtins.readDir path));
pythonPackagesDir = ./by-category/pythonPackages;
packagesFromTree =
base: callPackage:
@ -48,5 +50,38 @@ let
};
overlayAttrs = byNamePkgs // byCategoryPkgs;
directFlakePackages = lib.filterAttrs (_: lib.isDerivation) overlayAttrs;
flakePythonPackages =
let
pyPkgs = if pkgs ? python313Packages then pkgs.python313Packages else pkgs.python3Packages;
treePkgs =
if builtins.pathExists pythonPackagesDir then
removeAttrs (packagesFromTree pythonPackagesDir pyPkgs.callPackage) [
"python-packages"
]
else
{ };
prefabPkgs =
if builtins.pathExists (pythonPackagesDir + "/prefab-builder.nix") then
prev.lib.customisation.callPackagesWith (
pyPkgs
// {
lib = prev.lib;
pkgs = prev;
pyPkgs = pyPkgs;
fetchFromGitHub = prev.fetchFromGitHub;
fetchPypi = prev.fetchPypi;
}
) (pythonPackagesDir + "/prefab-builder.nix") { }
else
{ };
in
treePkgs // prefabPkgs;
in
if forFlakeOutputs then lib.filterAttrs (_: lib.isDerivation) overlayAttrs else overlayAttrs
if forPythonScope then
flakePythonPackages
else if forFlakeOutputs then
directFlakePackages
else
overlayAttrs