trying stuff
This commit is contained in:
parent
0c222f73e1
commit
1f569f6345
40
flake.nix
40
flake.nix
@ -29,18 +29,11 @@
|
||||
in
|
||||
versionNum >= 3.11;
|
||||
|
||||
# Define package overrides for specific Python versions
|
||||
packageOverrides = self: super: {
|
||||
# Remove sphinx for Python versions under 3.11
|
||||
sphinx = null;
|
||||
|
||||
# Add more package overrides as needed
|
||||
};
|
||||
|
||||
# Create Python with package overrides
|
||||
pythonWithOverrides = python.override {
|
||||
packageOverrides = packageOverrides;
|
||||
};
|
||||
# Custom function to filter out sphinx when Python version is < 3.11
|
||||
filterSphinxForOldPython = packages:
|
||||
if isPython311OrHigher
|
||||
then packages
|
||||
else builtins.filter (p: p.pname or "" != "sphinx") packages;
|
||||
|
||||
# Base Python packages that are always included
|
||||
basePackages = ps: with ps; [
|
||||
@ -52,23 +45,30 @@
|
||||
# Development tools
|
||||
black
|
||||
pytest
|
||||
#ipython
|
||||
ipython
|
||||
|
||||
# Include sphinx (will be filtered out later if needed)
|
||||
sphinx
|
||||
|
||||
# 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 if needed
|
||||
allPackages = ps:
|
||||
let
|
||||
combinedPackages = (basePackages ps) ++ (extraPackages ps);
|
||||
in
|
||||
filterSphinxForOldPython combinedPackages;
|
||||
|
||||
# Create the Python environment using the Python with overrides
|
||||
pythonEnv = pythonWithOverrides.withPackages allPackages;
|
||||
# Create the Python environment with filtered packages
|
||||
pythonEnv = python.withPackages allPackages;
|
||||
in
|
||||
{
|
||||
# The Python environment
|
||||
package = pythonEnv;
|
||||
|
||||
# Make the chosen Python version accessible
|
||||
python = pythonWithOverrides;
|
||||
python = python;
|
||||
inherit pythonVersion;
|
||||
|
||||
# Development shell with the Python environment
|
||||
@ -78,7 +78,7 @@
|
||||
] ++ extraSystemPackages;
|
||||
|
||||
shellHook = ''
|
||||
echo "Python $(${pythonWithOverrides}/bin/python --version)"
|
||||
echo "Python $(${python}/bin/python --version)"
|
||||
echo "Custom Python environment activated!"
|
||||
'';
|
||||
};
|
||||
@ -112,7 +112,7 @@
|
||||
|
||||
pythonVersion = mkOption {
|
||||
type = types.str;
|
||||
default = "python311";
|
||||
default = "python313";
|
||||
description = "Python version to use (e.g., python39, python310, python311)";
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user