Use pyproject-based Nix flake build and fix install logic for pkgmgr

- Add pyproject.toml to define package-manager as a Python application
  - Declare setuptools build backend (setuptools.build_meta) and wheel
  - Expose CLI entrypoint via [project.scripts] as `pkgmgr = pkgmgr.cli:main`
  - Define PyYAML as a base runtime dependency

- Update flake.nix to build pkgmgr via python311Packages.buildPythonApplication
  - Use format = "pyproject" and src = ./. (current git checkout)
  - Add setuptools and wheel to nativeBuildInputs for the backend
  - Add pyyaml to propagatedBuildInputs to match pyproject dependencies
  - Provide a devShell that includes the built pkgmgr, git, and Ansible
  - Expose `nix run .#pkgmgr` and `nix run .#default` as flake apps

- Fix Makefile install target for Nix shells
  - Treat install as a no-op when IN_NIX_SHELL is set (skip venv / pip)
  - In non-Nix environments, create ~/.venvs/pkgmgr, install deps, and
    wire automatic activation into shell rc files
  - Keep Arch/Manjaro-specific aur_builder/yay setup behind pacman check

- Adjust PKGBUILD prepare() to correctly copy the full project tree
  - Stop excluding the top-level src directory from rsync
  - Still exclude .git, .github, pkg, and srcpkg

This unifies the installation workflow across Arch, Nix, and local venvs,
and ensures pkgmgr builds cleanly inside the Docker-based Nix devShell tests.

Reference: ChatGPT-assisted refactor & debugging session on 2025-12-07.
https://chatgpt.com/share/6935ee1f-6c0c-800f-bb32-434c4051bd1e
This commit is contained in:
Kevin Veen-Birkenbach
2025-12-07 22:14:29 +01:00
parent 8e80dc5fd7
commit 7760c77952
4 changed files with 137 additions and 120 deletions

42
pyproject.toml Normal file
View File

@@ -0,0 +1,42 @@
[build-system]
requires = [
"setuptools>=68",
"wheel"
]
build-backend = "setuptools.build_meta"
[project]
name = "package-manager"
version = "0.1.1"
description = "Kevin's package-manager tool (pkgmgr)"
readme = "README.md"
requires-python = ">=3.11"
license = { text = "MIT" }
authors = [
{ name = "Kevin Veen-Birkenbach", email = "info@veen.world" }
]
# Base runtime dependencies
dependencies = [
"PyYAML>=6.0"
]
[project.urls]
Homepage = "https://github.com/kevinveenbirkenbach/package-manager"
Source = "https://github.com/kevinveenbirkenbach/package-manager"
[project.optional-dependencies]
dev = [
"pytest",
"mypy"
]
# CLI entrypoint: this is the "pkgmgr" command
[project.scripts]
pkgmgr = "pkgmgr.cli:main"
# Tell setuptools to find the pkgmgr package
[tool.setuptools.packages.find]
where = ["."]
include = ["pkgmgr*"]