2019-10-09 00:53:54 +02:00
|
|
|
{ stdenv, lib, fetchFromGitHub,
|
2019-10-09 00:54:44 +02:00
|
|
|
autoconf, automake, autoreconfHook, pkgconfig, curl, libevent, glib, libuuid, intltool, sqlite, withMysql ? true, libmysql, libarchive, libtool, jansson, vala, fuse, openssl, libevhtp, ccnet, libsearpc, which,
|
2019-10-09 00:53:54 +02:00
|
|
|
# for SeaHub
|
|
|
|
python27, python27Packages }:
|
|
|
|
|
|
|
|
let
|
2019-10-18 01:19:43 +02:00
|
|
|
version = "7.0.5";
|
2019-10-19 00:16:16 +02:00
|
|
|
python = python27;
|
|
|
|
pythonPackages = python27Packages;
|
|
|
|
seahubPythonDependencies = with pythonPackages; [
|
|
|
|
django pytz django-statici18n djangorestframework django_compressor
|
|
|
|
django-post_office django-constance gunicorn flup chardet dateutil six
|
|
|
|
openpyxl pysqlite jsonfield pillow
|
|
|
|
];
|
2019-10-09 00:53:54 +02:00
|
|
|
seafile-server-core = stdenv.mkDerivation rec {
|
|
|
|
name = "seafile-server-core";
|
|
|
|
inherit version;
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "haiwen";
|
|
|
|
repo = "seafile-server";
|
|
|
|
rev = "v${version}-server";
|
2019-10-18 01:19:43 +02:00
|
|
|
sha256 = "sha256:1875qsdcy6lw0nkjqjg8qwahwqxm8iy02lw8012s5qp91jcg8gpl";
|
2019-10-09 00:53:54 +02:00
|
|
|
};
|
2019-10-09 00:54:44 +02:00
|
|
|
# patch to work with latest, non-vulnerable libevhtp
|
|
|
|
patches = [
|
|
|
|
./recent_libevhtp.patch
|
2019-10-19 00:16:16 +02:00
|
|
|
./django-version.patch
|
2019-10-09 00:54:44 +02:00
|
|
|
];
|
|
|
|
# `which` is called directly from python during buildPhase, so we need the binary
|
2019-10-19 00:16:16 +02:00
|
|
|
nativeBuildInputs = [ autoconf automake libtool pkgconfig vala autoreconfHook which pythonPackages.wrapPython ];
|
|
|
|
buildInputs = [ sqlite glib python libuuid openssl fuse libarchive ccnet-server libevent libevhtp ];
|
|
|
|
propagatedBuildInputs = [ libsearpc ] ++ seahubPythonDependencies;
|
|
|
|
postFixup = ''
|
|
|
|
buildPythonPath $propagatedBuildInputs
|
|
|
|
wrapPythonProgramsIn "$out/bin" "$out $pythonPath"
|
|
|
|
'';
|
2019-10-09 00:53:54 +02:00
|
|
|
checkPhase = "bash ./run_tests.sh";
|
2019-10-12 22:45:05 +02:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
license = licenses.agpl3; # with additional OpenSSL linking exception
|
|
|
|
maintainers = with maintainers; [ schmittlauch ];
|
|
|
|
};
|
2019-10-09 00:53:54 +02:00
|
|
|
};
|
2019-10-19 00:16:16 +02:00
|
|
|
seahub = pythonPackages.buildPythonApplication rec {
|
2019-10-09 00:53:54 +02:00
|
|
|
name = "seahub";
|
|
|
|
inherit version;
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "haiwen";
|
|
|
|
repo = "seahub";
|
|
|
|
rev = "v${version}-server";
|
2019-10-18 01:19:43 +02:00
|
|
|
sha256 = "sha256:04wy0cj76j8kwgnx6iqja5gpc3q661lcy64qpqf3bzi907bad6xp";
|
2019-10-09 00:53:54 +02:00
|
|
|
};
|
2019-10-12 23:21:29 +02:00
|
|
|
phases = [ "unpackPhase" "installPhase" "fixupPhase" "distPhase" ];
|
2019-10-21 22:37:05 +02:00
|
|
|
buildInputs = [ python pythonPackages.wrapPython ];
|
|
|
|
propagatedBuildInputs = seahubPythonDependencies ++ [ pythonPackages.seafile-bindings pythonPackages.ccnet-bindings ]; # for `seaserv` module
|
2019-10-12 23:21:29 +02:00
|
|
|
installPhase = ''
|
|
|
|
cp -r ./ $out
|
2019-10-21 22:37:05 +02:00
|
|
|
cd "$out"
|
|
|
|
${python.interpreter} -m compileall ./
|
|
|
|
buildPythonPath $propagatedBuildInputs
|
|
|
|
patchPythonScript manage.py
|
2019-10-12 23:21:29 +02:00
|
|
|
'';
|
2019-10-12 22:45:05 +02:00
|
|
|
meta = with lib; {
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ schmittlauch ];
|
|
|
|
};
|
|
|
|
};
|
2019-10-19 00:16:16 +02:00
|
|
|
django-constance = pythonPackages.buildPythonPackage rec {
|
2019-10-09 00:53:54 +02:00
|
|
|
pname = "django-constance";
|
|
|
|
version = "1.0.1";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "haiwen";
|
|
|
|
repo = pname;
|
|
|
|
rev = "bde7f7c";
|
2019-10-12 22:45:05 +02:00
|
|
|
sha256 = "sha256:0m5hhylsrs6bn7ma04615r1n7jwykyw8kmbw1xqrkgxs259lm77h";
|
2019-10-09 00:53:54 +02:00
|
|
|
};
|
2019-10-19 00:16:16 +02:00
|
|
|
propagatedBuildInputs = with pythonPackages; [ django ];
|
|
|
|
checkInputs = [ pythonPackages.redis pythonPackages.coverage pythonPackages.django-picklefield ];
|
2019-10-12 22:45:05 +02:00
|
|
|
doCheck = false; # figure that out later
|
2019-10-09 00:53:54 +02:00
|
|
|
meta = {
|
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
ccnet-server = stdenv.mkDerivation rec {
|
|
|
|
name = "ccnet-server";
|
|
|
|
inherit version;
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "haiwen";
|
|
|
|
repo = "ccnet-server";
|
|
|
|
rev = "v${version}-server";
|
2019-10-18 01:19:43 +02:00
|
|
|
sha256 = "sha256:0mi0d2b4jwg511r0pp2ws9cw8ab6njplwy2a03wn6zi8q8fpjl38";
|
2019-10-09 00:53:54 +02:00
|
|
|
};
|
|
|
|
|
2019-10-19 00:16:16 +02:00
|
|
|
buildInputs = [ vala libsearpc libuuid sqlite openssl libevent glib python ]
|
2019-10-09 00:53:54 +02:00
|
|
|
++ lib.optional (!withMysql) "--without-mysql";
|
2019-10-09 00:54:44 +02:00
|
|
|
# `which` is called directly from python during buildPhase, so we need the binary
|
|
|
|
nativeBuildInputs = [ autoconf automake libtool pkgconfig autoreconfHook which ];
|
2019-10-09 00:54:28 +02:00
|
|
|
configureFlags = [ "--disable-static" ];
|
2019-10-09 00:53:54 +02:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Internal communication framework and user/group management for Seafile server";
|
|
|
|
license = lib.licenses.agpl3; # with additional OpenSSL linking exception
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
name = "seafile-server";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
buildInputs = [ seahub seafile-server-core ccnet-server libsearpc ]
|
|
|
|
++ lib.optional withMysql libmysql;
|
|
|
|
phases = [ "installPhase" "fixupPhase" "distPhase" ];
|
|
|
|
# todo: create data directory in /srv in activation script
|
2019-10-09 00:56:46 +02:00
|
|
|
installPhase = ''
|
|
|
|
mkdir "$out"
|
|
|
|
cd "$out"
|
|
|
|
ln -s ${seahub} seahub
|
2019-10-16 17:31:52 +02:00
|
|
|
ln -s ${seafile-server-core} seafile-server-latest
|
2019-10-09 00:56:46 +02:00
|
|
|
'';
|
2019-10-12 22:45:05 +02:00
|
|
|
meta = with lib; {
|
|
|
|
maintainers = with maintainers; [ schmittlauch ];
|
|
|
|
license = licenses.free; # components with different free software licenses are combined
|
|
|
|
};
|
2019-10-21 22:37:05 +02:00
|
|
|
inherit ccnet-server seafile-server-core seahub; # for using the path in the NixOS module
|
2019-10-12 22:45:05 +02:00
|
|
|
}
|