trying stuff

This commit is contained in:
Arthur Wambst 2025-05-06 17:46:04 +02:00
parent 3911f3e0dc
commit 6103b46dda

View File

@ -1,5 +1,5 @@
{
description = "Customizable Python development environment";
description = "Customizable Python 3.11+ flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@ -22,17 +22,7 @@
python = pkgs.${pythonVersion};
# Determine if Python version is 3.11 or higher
isPython311OrHigher =
let
versionStr = builtins.substring 6 10 pythonVersion;
versionNum = builtins.fromJSON (builtins.substring 0 1 versionStr + "." + builtins.substring 1 2 versionStr);
in
versionNum >= 3.11;
# Custom function to filter out sphinx when Python version is < 3.11
filterSphinxForOldPython = packages:
builtins.filter (p: p.pname or "" != "sphinx") packages;
# Base Python packages that are always included
basePackages = ps: with ps; [
# Data science
@ -45,19 +35,12 @@
pytest
ipython
# Include sphinx (will be filtered out later if needed)
#sphinx
# Add more default packages as needed
];
# Combine base packages with extra packages and filter if needed
allPackages = ps:
let
combinedPackages = (basePackages ps) ++ (extraPackages ps);
in
filterSphinxForOldPython combinedPackages;
allPackages = ps: (basePackages ps) ++ (extraPackages ps);
# Create the Python environment with filtered packages
pythonEnv = python.withPackages allPackages;
in