Initial commit
This commit is contained in:
49
python/flake.nix
Normal file
49
python/flake.nix
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
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 = [
|
||||
pkgs.ruff # Linter/Formatter
|
||||
pkgs.pyright # Type checker (replaced 'ty')
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export PYTHONPATH="$PYTHONPATH:$(pwd)"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user