trying stuff
This commit is contained in:
parent
e25cde7310
commit
22f2be0e87
23
flake.nix
23
flake.nix
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
# Select Python version based on the parameter
|
# Select Python version based on the parameter
|
||||||
python = pkgs.${pythonVersion};
|
python = pkgs.${pythonVersion};
|
||||||
|
|
||||||
# Determine if Python version is 3.11 or higher
|
# Determine if Python version is 3.11 or higher
|
||||||
isPython311OrHigher =
|
isPython311OrHigher =
|
||||||
let
|
let
|
||||||
@ -29,8 +29,18 @@
|
|||||||
in
|
in
|
||||||
versionNum >= 3.11;
|
versionNum >= 3.11;
|
||||||
|
|
||||||
|
# Define package overrides for specific Python versions
|
||||||
|
packageOverrides = self: super: {
|
||||||
|
# Remove sphinx for Python versions under 3.11
|
||||||
|
sphinx = if !isPython311OrHigher then null else super.sphinx;
|
||||||
|
|
||||||
|
# Add more package overrides as needed
|
||||||
|
};
|
||||||
|
|
||||||
# Create Python with package overrides
|
# Create Python with package overrides
|
||||||
pythonWithOverrides = python;
|
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; [
|
||||||
@ -44,14 +54,11 @@
|
|||||||
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 and filter out nulls
|
# Combine base packages with extra packages
|
||||||
allPackages = ps: builtins.filter (pkg: pkg != null) ((basePackages ps) ++ (extraPackages ps));
|
allPackages = ps: (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;
|
||||||
@ -105,7 +112,7 @@
|
|||||||
|
|
||||||
pythonVersion = mkOption {
|
pythonVersion = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "python313";
|
default = "python311";
|
||||||
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