summaryrefslogtreecommitdiff
path: root/pkgs/default.nix
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2024-07-20 12:01:23 -0600
committerAlejandro Soto <alejandro@34project.org>2024-07-20 12:01:23 -0600
commit76dffd6d973dc10369fcd26214cfafd50ca811d2 (patch)
tree84075208a389a54600b85d4f6995c7d588981060 /pkgs/default.nix
parent77c96b723b24192c4be6cc6e112f0216e79a7383 (diff)
pkgs: add flake overrides for each Python version
Diffstat (limited to '')
-rw-r--r--pkgs/default.nix46
1 files changed, 33 insertions, 13 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix
index 9fd6fd9..a299b8b 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -1,5 +1,5 @@
final: prev:
-let
+with prev.lib; let
inherit (final) callPackage fetchpatch;
in
{
@@ -27,16 +27,36 @@ in
];
};
- override = {
- python3 = prev.python3.override {
- packageOverrides = nextPy: prevPy: {
- cocotb = nextPy.callPackage ./cocotb { inherit (prevPy) cocotb; };
- cocotbext-wishbone = nextPy.callPackage ./cocotb/exts/wishbone.nix { };
- find-libpython = nextPy.callPackage ./find-libpython.nix { };
- hdl-convertor = nextPy.callPackage ./hdl-convertor { };
- hdl-convertor-ast = nextPy.callPackage ./hdl-convertor/ast.nix { };
- iced-x86 = nextPy.callPackage ./iced-x86 { };
- };
- };
- };
+ override =
+ let
+ makePyOverrides = version:
+ let
+ name = "python3${toString version}";
+ in
+ {
+ inherit name;
+
+ value = prev.${name}.override {
+ packageOverrides = nextPy: prevPy: {
+ cocotb = nextPy.callPackage ./cocotb { inherit (prevPy) cocotb; };
+ cocotbext-wishbone = nextPy.callPackage ./cocotb/exts/wishbone.nix { };
+ find-libpython = nextPy.callPackage ./find-libpython.nix { };
+ hdl-convertor = nextPy.callPackage ./hdl-convertor { };
+ hdl-convertor-ast = nextPy.callPackage ./hdl-convertor/ast.nix { };
+ iced-x86 = nextPy.callPackage ./iced-x86 { };
+ };
+ };
+ };
+
+ pyVersionRange' = start: end:
+ let
+ next = end + 1;
+ in
+ if prev ? "python3${toString next}"
+ then pyVersionRange' start next
+ else range start end;
+
+ pyVersionRange = start: pyVersionRange' start start;
+ in
+ listToAttrs (map makePyOverrides (pyVersionRange 9));
}