about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/backup/gphotos-sync/default.nix
blob: 53db44bb2e11f4be6df9327a0df39698886f5dd2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{ lib
, fetchFromGitHub
, python3
, ffmpeg
}:
python3.pkgs.buildPythonApplication rec {
  pname = "gphotos-sync";
  version = "3.1.2";
  format = "pyproject";

  env.SETUPTOOLS_SCM_PRETEND_VERSION = version;

  src = fetchFromGitHub {
    owner = "gilesknap";
    repo = "gphotos-sync";
    rev = version;
    hash = "sha256-lLw450Rk7tIENFTZWHoinkhv3VtctDv18NKxhox+NgI=";
  };

  patches = [
    ./skip-network-tests.patch
  ];

  # Consider fixing this upstream by following up on:
  # https://github.com/gilesknap/gphotos-sync/issues/441
  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace "setuptools<57" "setuptools" \
      --replace "wheel==0.33.1" "wheel"
  '';

  nativeBuildInputs = with python3.pkgs; [
    pythonRelaxDepsHook
    setuptools
    setuptools-scm
    wheel
  ];

  pythonRelaxDeps = [
    "psutil"
    "exif"
    "pyyaml"
  ];

  propagatedBuildInputs = with python3.pkgs; [
    appdirs
    attrs
    exif
    google-auth-oauthlib
    psutil
    pyyaml
    psutil
    requests-oauthlib
    types-pyyaml
    types-requests
  ];

  buildInputs = [
    ffmpeg
  ];

  nativeCheckInputs = with python3.pkgs; [
    mock
    pytestCheckHook
  ];

  preCheck = ''
    export HOME=$(mktemp -d)
    substituteInPlace setup.cfg \
      --replace "--cov=gphotos_sync --cov-report term --cov-report xml:cov.xml" ""
  '';

  meta = with lib; {
    description = "Google Photos and Albums backup with Google Photos Library API";
    homepage = "https://github.com/gilesknap/gphotos-sync";
    license = licenses.asl20;
    maintainers = with maintainers; [ dnr ];
  };
}