this repo has no description
1{
2 description = "python flake";
3 inputs = {
4 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5 flake-parts.url = "github:hercules-ci/flake-parts";
6 };
7 outputs = inputs @ { flake-parts, ... }:
8 flake-parts.lib.mkFlake { inherit inputs; } {
9 systems = [
10 "x86_64-linux"
11 "aarch64-linux"
12 "aarch64-darwin"
13 ];
14 perSystem = { pkgs, system, ... }: let
15 commonPackages = [
16 pkgs.python313Full
17 pkgs.pyright
18 pkgs.uv
19 pkgs.curl
20 pkgs.wget
21 pkgs.cmake
22 ] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [
23 pkgs.gcc
24 pkgs.stdenv.cc.cc.lib
25 ];
26 in {
27 devShells.default = pkgs.mkShell {
28 buildInputs = commonPackages;
29 shellHook = ''
30 # Set up the Python virtual environment with uv
31 test -d .venv || ${pkgs.uv}/bin/uv venv .venv
32 export VIRTUAL_ENV="$(pwd)/.venv"
33 export PATH="$VIRTUAL_ENV/bin:$PATH"
34 export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath commonPackages}:$LD_LIBRARY_PATH
35
36 source "$VIRTUAL_ENV/bin/activate"
37
38 if uv sync --frozen; then
39 package_count=$(uv pip list --format=freeze | wc -l)
40 echo "Done. $package_count pip packages installed."
41 else
42 echo "Warning: An error occurred during uv sync."
43 fi
44 '';
45 };
46 };
47 };
48}