Skip to content

Commit

Permalink
docs: simplify python project example
Browse files Browse the repository at this point in the history
Use `lib.importTOML`, clearer than the previous implementation.

Reuse more information from `pyproject`.
  • Loading branch information
yajo authored and DavHau committed Sep 15, 2023
1 parent 398fd94 commit 5a729cb
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions examples/packages/single-language/python-project/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
dream2nix,
...
}: let
pyproject = lib.pipe (config.mkDerivation.src + /pyproject.toml) [
builtins.readFile
builtins.fromTOML
];
pyproject = lib.importTOML (config.mkDerivation.src + /pyproject.toml);
in {
imports = [
dream2nix.modules.dream2nix.pip
];

name = "pyproject-dependencies";
version = pyproject.project.version;
inherit (pyproject.project) name version;

mkDerivation = {
src = ./.;
Expand All @@ -30,7 +26,10 @@ in {

pip = {
pypiSnapshotDate = "2023-08-27";
requirementsList = ["setuptools"] ++ pyproject.project.dependencies;
requirementsList =
pyproject.build-system.requires
or []
++ pyproject.project.dependencies;
flattenDependencies = true;
};
}

0 comments on commit 5a729cb

Please sign in to comment.