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