dream2nix/examples/packages/single-language/python-project/default.nix
Jairo Llopis 5a729cb75a docs: simplify python project example
Use `lib.importTOML`, clearer than the previous implementation.

Reuse more information from `pyproject`.
2023-09-15 10:33:20 +02:00

36 lines
650 B
Nix

# An example package with dependencies defined via pyproject.toml
{
config,
lib,
dream2nix,
...
}: let
pyproject = lib.importTOML (config.mkDerivation.src + /pyproject.toml);
in {
imports = [
dream2nix.modules.dream2nix.pip
];
inherit (pyproject.project) name version;
mkDerivation = {
src = ./.;
};
buildPythonPackage = {
format = lib.mkForce "pyproject";
pythonImportsCheck = [
"my_tool"
];
};
pip = {
pypiSnapshotDate = "2023-08-27";
requirementsList =
pyproject.build-system.requires
or []
++ pyproject.project.dependencies;
flattenDependencies = true;
};
}