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

27
flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1772963539,
"narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9dcb002ca1690658be4a04645215baea8b95f31d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View file

@ -30,7 +30,21 @@
forFlakeOutputs = true;
};
mkDefault = p: if p ? raganything then p.raganything else p.${builtins.head (lib.attrNames p)};
flakePythonPackages =
system:
import ./pkgs {
pkgs = pkgsFinal system;
prev = pkgsPrev system;
lib = (pkgsPrev system).lib;
forPythonScope = true;
};
mkDefault =
p:
let
directNames = lib.filter (name: lib.isDerivation p.${name}) (lib.attrNames p);
in
if p ? raganything then p.raganything else p.${builtins.head directNames};
in
{
overlays.default = overlay;
@ -42,5 +56,12 @@
in
p // { default = mkDefault p; }
);
legacyPackages = forAllSystems (
system:
{
python3Packages = flakePythonPackages system;
}
);
};
}

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