Set src to lib.cleanSource projectDir by default

Ideally we'd use `nix-gitignore` but that one fails when there is no
`.gitignore` file so it's not a sensible default.
This commit is contained in:
adisbladis 2020-02-26 16:35:42 +00:00
parent fbb246c77a
commit b85e2a6733
No known key found for this signature in database
GPG key ID: 110BFAD44C6249B7
3 changed files with 6 additions and 7 deletions

View file

@ -18,8 +18,8 @@ The _poetry2nix_ public API consists of the following attributes:
Creates a Python application using the Python interpreter specified based on the designated poetry project and lock files. `mkPoetryApplication` takes an attribute set with the following attributes (attributes without default are mandatory):
- **src**: project source.
- **projectDir**: path to the root of the project.
- **src**: project source (_default_: `lib.cleanSource projectDir`).
- **pyproject**: path to `pyproject.toml` (_default_: `projectDir + "/pyproject.toml"`).
- **poetrylock**: `poetry.lock` file path (_default_: `projectDir + "/poetry.lock"`).
- **overrides**: Python overrides to apply (_default_: `[defaultPoetryOverrides]`).
@ -29,7 +29,6 @@ Creates a Python application using the Python interpreter specified based on the
#### Example
```nix
poetry2nix.mkPoetryApplication {
src = lib.cleanSource ./.;
projectDir = ./.;
}
```

View file

@ -145,8 +145,8 @@ let
/* Creates a Python application from pyproject.toml and poetry.lock */
mkPoetryApplication =
{ src
, projectDir ? null
{ projectDir ? null
, src ? lib.cleanSource projectDir
, pyproject ? projectDir + "/pyproject.toml"
, poetrylock ? projectDir + "/poetry.lock"
, overrides ? [ defaultPoetryOverrides ]
@ -199,6 +199,8 @@ let
pname = pyProject.tool.poetry.name;
version = pyProject.tool.poetry.version;
inherit src;
format = "pyproject";
buildInputs = mkInput "buildInputs" buildSystemPkgs;

View file

@ -2,7 +2,5 @@
poetry2nix.mkPoetryApplication {
python = python3;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
src = lib.cleanSource ./.;
projectDir = ./.;
}