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