From 93981986d85d49a556d17f9960f23a737f213c9f Mon Sep 17 00:00:00 2001 From: 0xWheatyz Date: Sat, 6 Dec 2025 17:33:44 -0500 Subject: [PATCH] feat: nix flake --- flake.nix | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 flake.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..91f3859 --- /dev/null +++ b/flake.nix @@ -0,0 +1,59 @@ +# 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. + pythonPackages = ps: with ps; [ + # Core Python + pkgs.${pythonVersion} + + # Common development tools + pip + setuptools + 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 PATH="$HOME/.local/bin:$PATH" # Example: if you install packages globally via pip (not recommended with Nix) + # If you are using a specific Python version managed by Nix, you might + # want to ensure it's in your PATH. The above `packages` should handle this. + + # You can also set up virtual environments here if you prefer, + # although Nix aims to manage dependencies directly. + # Example: using venvwrapper if installed + # if [ -f "$(command -v venvwrapper.sh)" ]; then + # export WORKON_HOME=$HOME/.virtualenvs + # source $(command -v venvwrapper.sh) + # fi + ''; + }; + } + ); +} \ No newline at end of file