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