The dev shell's interpreter is the one `pkgmgr update --all` installs every repository in the catalogue with, so it has to satisfy their floors rather than only this project's. portfolio declares requires-python >=3.12, which 3.11 does not resolve; the package block moves along with the shell because the comment there promises they are the same version. ldap-schema-manager pulls python-ldap, which compiles against lber.h and ldap.h from OpenLDAP plus the SASL headers and locates them through pkg-config. None of the three were in buildInputs, so that repository failed in the compiler rather than in the resolver. Both are failures of the same sweep, and both are environment rather than code. Verified: a full `pkgmgr update --all` sweep in the arch image against this flake, with 0 installation failures. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
141 lines
3.9 KiB
Nix
141 lines
3.9 KiB
Nix
{
|
|
description = "Nix flake for Kevin's package-manager tool";
|
|
|
|
nixConfig = {
|
|
extra-experimental-features = [ "nix-command" "flakes" ];
|
|
};
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
|
};
|
|
|
|
outputs = { self, nixpkgs }:
|
|
let
|
|
systems = [ "x86_64-linux" "aarch64-linux" ];
|
|
|
|
forAllSystems = f:
|
|
builtins.listToAttrs (map (system: {
|
|
name = system;
|
|
value = f system;
|
|
}) systems);
|
|
in
|
|
{
|
|
##########################################################################
|
|
# PACKAGES
|
|
##########################################################################
|
|
packages = forAllSystems (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
python = pkgs.python312;
|
|
pyPkgs = pkgs.python312Packages;
|
|
in
|
|
rec {
|
|
pkgmgr = pyPkgs.buildPythonApplication {
|
|
pname = "package-manager";
|
|
version = "1.16.1";
|
|
|
|
# Use the git repo as source
|
|
src = ./.;
|
|
|
|
# Build using pyproject.toml
|
|
format = "pyproject";
|
|
|
|
# Clear any stale wheels carried in from the source tree so
|
|
# pypaInstallPhase doesn't collide on bin/pkgmgr.
|
|
preBuild = "rm -rf dist";
|
|
|
|
# Build backend requirements from [build-system]
|
|
nativeBuildInputs = [
|
|
pyPkgs.setuptools
|
|
pyPkgs.wheel
|
|
];
|
|
|
|
# Runtime dependencies (matches [project.dependencies] in pyproject.toml)
|
|
propagatedBuildInputs = [
|
|
pyPkgs.pyyaml
|
|
pyPkgs.jinja2
|
|
pyPkgs.pip
|
|
pkgs.git
|
|
pkgs.gnupg
|
|
];
|
|
|
|
doCheck = false;
|
|
|
|
pythonImportsCheck = [ "pkgmgr" ];
|
|
};
|
|
|
|
default = pkgmgr;
|
|
}
|
|
);
|
|
|
|
##########################################################################
|
|
# DEVELOPMENT SHELL
|
|
##########################################################################
|
|
devShells = forAllSystems (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
ansiblePkg =
|
|
if pkgs ? ansible-core then pkgs.ansible-core
|
|
else pkgs.ansible;
|
|
|
|
# Use the same Python version as the package
|
|
python = pkgs.python312;
|
|
|
|
pythonWithDeps = python.withPackages (ps: [
|
|
ps.pip
|
|
ps.pyyaml
|
|
ps.jinja2
|
|
]);
|
|
in
|
|
{
|
|
default = pkgs.mkShell {
|
|
buildInputs = [
|
|
pythonWithDeps
|
|
pkgs.git
|
|
pkgs.gnupg
|
|
ansiblePkg
|
|
pkgs.pkg-config
|
|
pkgs.openldap
|
|
pkgs.cyrus_sasl
|
|
];
|
|
|
|
shellHook = ''
|
|
# Ensure our Python with dependencies is preferred on PATH
|
|
export PATH=${pythonWithDeps}/bin:$PATH
|
|
|
|
# Ensure src/ layout is importable:
|
|
# pkgmgr lives in ./src/pkgmgr
|
|
export PYTHONPATH="$PWD/src:${PYTHONPATH:-}"
|
|
# Also add repo root in case tools/tests rely on it
|
|
export PYTHONPATH="$PWD:$PYTHONPATH"
|
|
|
|
echo "Entered pkgmgr development shell for ${system}"
|
|
echo "Python used in this shell:"
|
|
python --version
|
|
echo "pkgmgr CLI (from source) is available via:"
|
|
echo " python -m pkgmgr.cli --help"
|
|
'';
|
|
};
|
|
}
|
|
);
|
|
|
|
##########################################################################
|
|
# nix run .#pkgmgr
|
|
##########################################################################
|
|
apps = forAllSystems (system:
|
|
let
|
|
pkgmgrPkg = self.packages.${system}.pkgmgr;
|
|
in
|
|
{
|
|
pkgmgr = {
|
|
type = "app";
|
|
program = "${pkgmgrPkg}/bin/pkgmgr";
|
|
};
|
|
|
|
default = self.apps.${system}.pkgmgr;
|
|
}
|
|
);
|
|
};
|
|
}
|