Files
flakes/python/flake.nix
2026-02-23 21:52:19 +01:00

50 lines
1.3 KiB
Nix

{
description = "Python project flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }:
let
python = pkgs.python314;
in
{
packages.default = python.pkgs.buildPythonApplication {
pname = "my-app";
version = "0.1.0";
src = ./.;
format = "pyproject";
nativeBuildInputs = [
python.pkgs.hatchling
];
propagatedBuildInputs = with python.pkgs; [
# Add runtime dependencies here (e.g., requests, pandas)
];
pythonImportsCheck = [ "my_app" ]; # Good practice to verify installs
};
devShells.default = pkgs.mkShell {
inputsFrom = [ self'.packages.default ];
packages = with pkgs; [
ruff # Linter/Formatter
ty # Type checker
];
shellHook = ''
export PYTHONPATH="$PYTHONPATH:$(pwd)"
'';
};
};
};
}