1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, poetry-core
6, jsonschema
7, peewee
8, platformdirs
9, iso8601
10, rfc3339-validator
11, strict-rfc3339
12, tomlkit
13, deprecation
14, timeslot
15, pytestCheckHook
16, gitUpdater
17}:
18
19buildPythonPackage rec {
20 pname = "aw-core";
21 version = "0.5.16";
22
23 format = "pyproject";
24
25 # pypi distribution doesn't include tests, so build from source instead
26 src = fetchFromGitHub {
27 owner = "ActivityWatch";
28 repo = "aw-core";
29 rev = "v${version}";
30 sha256 = "sha256-7xT7bOGzH5G4WpgNo8pDyiQqX0dWNLNHpgssozUa9kQ=";
31 };
32
33 disabled = pythonOlder "3.8";
34
35 nativeBuildInputs = [
36 poetry-core
37 ];
38
39 propagatedBuildInputs = [
40 jsonschema
41 peewee
42 platformdirs
43 iso8601
44 rfc3339-validator
45 strict-rfc3339
46 tomlkit
47 deprecation
48 timeslot
49 ];
50
51 nativeCheckInputs = [
52 pytestCheckHook
53 ];
54
55 preCheck = ''
56 # Fake home folder for tests that write to $HOME
57 export HOME="$TMPDIR"
58 '';
59
60 pythonImportsCheck = [ "aw_core" ];
61
62 passthru.updateScript = gitUpdater {
63 rev-prefix = "v";
64 };
65
66 meta = with lib; {
67 description = "Core library for ActivityWatch";
68 homepage = "https://github.com/ActivityWatch/aw-core";
69 maintainers = with maintainers; [ huantian ];
70 license = licenses.mpl20;
71 };
72}