trying
This commit is contained in:
parent
227a920266
commit
17ddcada9a
35
flake.nix
35
flake.nix
@ -21,14 +21,24 @@
|
|||||||
# Select Python version based on the parameter
|
# Select Python version based on the parameter
|
||||||
python = pkgs.${pythonVersion};
|
python = pkgs.${pythonVersion};
|
||||||
|
|
||||||
handlePackageCompatibility = pythonPackages:
|
# Define package overrides for specific Python versions
|
||||||
let
|
packageOverrides = self: super: {
|
||||||
fixSphinx = ps:
|
# Fix Sphinx for Python 3.10
|
||||||
if ps ? sphinx
|
sphinx = if pythonVersion == "python310" then
|
||||||
then ps.sphinx.overridePythonAttrs (old: { version = "7.2.6"; })
|
super.sphinx.overridePythonAttrs (old: {
|
||||||
else ps.sphinx;
|
version = "7.2.6"; # Use a version known to work with Python 3.10
|
||||||
in
|
doCheck = false; # Skip tests to avoid compatibility issues
|
||||||
pythonPackages;
|
})
|
||||||
|
else
|
||||||
|
super.sphinx;
|
||||||
|
|
||||||
|
# Add more package overrides as needed
|
||||||
|
};
|
||||||
|
|
||||||
|
# Create Python with package overrides
|
||||||
|
pythonWithOverrides = python.override {
|
||||||
|
packageOverrides = packageOverrides;
|
||||||
|
};
|
||||||
|
|
||||||
# Base Python packages that are always included
|
# Base Python packages that are always included
|
||||||
basePackages = ps: with ps; [
|
basePackages = ps: with ps; [
|
||||||
@ -48,15 +58,16 @@
|
|||||||
# Combine base packages with extra packages
|
# Combine base packages with extra packages
|
||||||
allPackages = ps: (basePackages ps) ++ (extraPackages ps);
|
allPackages = ps: (basePackages ps) ++ (extraPackages ps);
|
||||||
|
|
||||||
# Create the Python environment
|
# Create the Python environment using the Python with overrides
|
||||||
pythonEnv = python.withPackages allPackages;
|
pythonEnv = pythonWithOverrides.withPackages allPackages;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# The Python environment
|
# The Python environment
|
||||||
package = pythonEnv;
|
package = pythonEnv;
|
||||||
|
|
||||||
# Make the chosen Python version accessible
|
# Make the chosen Python version accessible
|
||||||
inherit python pythonVersion;
|
python = pythonWithOverrides;
|
||||||
|
inherit pythonVersion;
|
||||||
|
|
||||||
# Development shell with the Python environment
|
# Development shell with the Python environment
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
@ -65,7 +76,7 @@
|
|||||||
] ++ extraSystemPackages;
|
] ++ extraSystemPackages;
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
echo "Python $(${python}/bin/python --version)"
|
echo "Python $(${pythonWithOverrides}/bin/python --version)"
|
||||||
echo "Custom Python environment activated!"
|
echo "Custom Python environment activated!"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user