about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/etebase/default.nix
blob: 2a8233e5e0dcf0967e0757f90d845a027216eb09 (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
{ lib
, fetchFromGitHub
, withLdap ? true
, python3
, withPostgres ? true
, nix-update-script
, nixosTests
}:

let
  python = python3.override {
    packageOverrides = self: super: {
      pydantic = super.pydantic_1;
    };
  };
in
python.pkgs.buildPythonPackage rec {
  pname = "etebase-server";
  version = "0.11.0";

  src = fetchFromGitHub {
    owner = "etesync";
    repo = "server";
    rev = "refs/tags/${version}";
    hash = "sha256-+MSNX+CFmIQII+SFjM2TQKCgRMOTdsOIVAP8ur4WjQY=";
  };

  patches = [ ./secret.patch ];

  doCheck = false;

  propagatedBuildInputs = with python.pkgs; [
    aiofiles
    django_3
    fastapi
    msgpack
    pynacl
    redis
    uvicorn
    websockets
    watchfiles
    uvloop
    pyyaml
    python-dotenv
    httptools
    typing-extensions
  ] ++ lib.optional withLdap python-ldap
    ++ lib.optional withPostgres psycopg2;

  postInstall = ''
    mkdir -p $out/bin $out/lib
    cp manage.py $out/bin/etebase-server
    wrapProgram $out/bin/etebase-server --prefix PYTHONPATH : "$PYTHONPATH"
    chmod +x $out/bin/etebase-server
  '';

  passthru.updateScript = nix-update-script {};
  passthru.python = python;
  # PYTHONPATH of all dependencies used by the package
  passthru.pythonPath = python.pkgs.makePythonPath propagatedBuildInputs;
  passthru.tests = {
    nixosTest = nixosTests.etebase-server;
  };

  meta = with lib; {
    homepage = "https://github.com/etesync/server";
    description = "An Etebase (EteSync 2.0) server so you can run your own";
    changelog = "https://github.com/etesync/server/blob/${version}/ChangeLog.md";
    license = licenses.agpl3Only;
    maintainers = with maintainers; [ felschr phaer ];
  };
}