52 lines
1.8 KiB
Nix
52 lines
1.8 KiB
Nix
{
|
|
description = "A development shell for Python 3.12 with Pandas and Requests.";
|
|
|
|
# Define the inputs (dependencies) for the flake
|
|
inputs = {
|
|
# Pin nixpkgs to a specific channel (e.g., nixos-unstable) for a reproducible environment
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
};
|
|
|
|
# Define the outputs (what the flake provides)
|
|
outputs = { self, nixpkgs, ... }@inputs:
|
|
let
|
|
# Define the systems this flake supports
|
|
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
|
|
|
# Create a function that maps the supported systems to the nixpkgs instance
|
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
|
|
|
# Get the packages set for all systems
|
|
pkgs = forAllSystems (system: import nixpkgs { inherit system; });
|
|
|
|
in
|
|
{
|
|
# Define the development shells
|
|
devShells = forAllSystems (system: {
|
|
default = pkgs.${system}.mkShell {
|
|
name = "python-312-dev-shell";
|
|
|
|
# 1. Select the specific Python interpreter (Python 3.12)
|
|
# 2. Use .withPackages to create an environment that includes the specified libraries
|
|
packages = [
|
|
(pkgs.${system}.python312.withPackages (python-pkgs: with python-pkgs; [
|
|
# Python libraries
|
|
pip
|
|
virtualenv
|
|
requests
|
|
pandas
|
|
# Optional: Add other helpful dev tools outside of the python-pkgs set if needed
|
|
# (e.g., git, pre-commit, bash-completion)
|
|
]))
|
|
];
|
|
|
|
# Optional: Define environment variables for the shell
|
|
shellHook = ''
|
|
echo "🐍 Entering Python 3.12 development environment."
|
|
echo " (pip and Requests are available)"
|
|
python --version
|
|
'';
|
|
};
|
|
});
|
|
};
|
|
}
|