trying stuff

This commit is contained in:
Arthur Wambst 2025-05-06 17:09:26 +02:00
parent feb52fcc07
commit e25cde7310

View File

@ -21,23 +21,16 @@
# Select Python version based on the parameter
python = pkgs.${pythonVersion};
# Define package overrides for specific Python versions
packageOverrides = self: super: {
# Fix Sphinx for Python 3.10
sphinx = if pythonVersion == "python310" then
super.sphinx.overridePythonAttrs (old: {
version = "latest"; # Use a version known to work with Python 3.10
})
else
super.sphinx;
# Add more package overrides as needed
};
# Determine if Python version is 3.11 or higher
isPython311OrHigher =
let
versionStr = builtins.substring 6 10 pythonVersion;
versionNum = builtins.fromJSON (builtins.substring 0 1 versionStr + "." + builtins.substring 1 2 versionStr);
in
versionNum >= 3.11;
# Create Python with package overrides
pythonWithOverrides = python.override {
packageOverrides = packageOverrides;
};
pythonWithOverrides = python;
# Base Python packages that are always included
basePackages = ps: with ps; [
@ -51,11 +44,14 @@
pytest
ipython
# Conditionally include sphinx for Python 3.11+
(if isPython311OrHigher then sphinx else null)
# Add more default packages as needed
];
# Combine base packages with extra packages
allPackages = ps: (basePackages ps) ++ (extraPackages ps);
# Combine base packages with extra packages and filter out nulls
allPackages = ps: builtins.filter (pkg: pkg != null) ((basePackages ps) ++ (extraPackages ps));
# Create the Python environment using the Python with overrides
pythonEnv = pythonWithOverrides.withPackages allPackages;
@ -109,7 +105,7 @@
pythonVersion = mkOption {
type = types.str;
default = "python311";
default = "python313";
description = "Python version to use (e.g., python39, python310, python311)";
};