50 lines
1.5 KiB
Nix
50 lines
1.5 KiB
Nix
# flake.nix
|
|
{
|
|
description = "A Python development environment";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; # Pin to the nixos-25.11 channel
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
# Define Python version and packages
|
|
pythonVersion = "python311"; # You can change this to python310, python312, etc.
|
|
pythonEnv = pkgs.${pythonVersion}; # Get the specific Python environment
|
|
|
|
pythonPackages = ps: with ps; [
|
|
# Core Python
|
|
#pkgs.${pythonVersion}
|
|
|
|
pythonEnv.pkgs.pip
|
|
pythonEnv.pkgs.setuptools
|
|
pythonEnv.pkgs.wheel
|
|
|
|
# Example useful packages (uncomment and add as needed)
|
|
# black # Code formatter
|
|
# ruff # Fast Python linter
|
|
# mypy # Static type checker
|
|
# ipython # Enhanced interactive Python shell
|
|
# venvwrapper # Virtual environment manager (can be useful even with Nix)
|
|
];
|
|
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
name = "python-dev-shell";
|
|
|
|
packages = pythonPackages pkgs;
|
|
|
|
# Environment variables you might want to set
|
|
shellHook = ''
|
|
echo "Welcome to the Python development shell!"
|
|
export NIX_PROJECT_SHELL="SPARC"
|
|
'';
|
|
};
|
|
}
|
|
);
|
|
} |