139 lines
4.1 KiB
Nix
139 lines
4.1 KiB
Nix
{ stdenv
|
|
, lib
|
|
, fetchFromGitHub
|
|
, autoconf
|
|
, automake
|
|
, autoreconfHook
|
|
, pkgconfig
|
|
, curl
|
|
, libevent
|
|
, glib
|
|
, libuuid
|
|
, intltool
|
|
, sqlite
|
|
, withMysql ? true
|
|
, libmysqlclient
|
|
, libarchive
|
|
, libtool
|
|
, jansson
|
|
, vala
|
|
, fuse
|
|
, openssl
|
|
, oniguruma
|
|
, libevhtp
|
|
, libsearpc
|
|
, which
|
|
, # for SeaHub
|
|
python3
|
|
, python3Packages
|
|
}:
|
|
let
|
|
version = "8.0.0";
|
|
python = python3;
|
|
pythonPackages = python3Packages;
|
|
django = pythonPackages.django;
|
|
djangoModules = with pythonPackages; [ django-statici18n django-post_office django-picklefield django-formtools djangorestframework ];
|
|
seahubPythonDependencies = with pythonPackages; [
|
|
django
|
|
django-webpack-loader
|
|
future
|
|
captcha
|
|
gunicorn
|
|
pymysql
|
|
openpyxl
|
|
qrcode
|
|
dateutil
|
|
requests
|
|
pillow
|
|
pyjwt
|
|
pycryptodome
|
|
]
|
|
++ map (p: p.override { inherit django; }) djangoModules; # build django modules with required version
|
|
seafile-server-core = stdenv.mkDerivation rec {
|
|
name = "seafile-server-core";
|
|
inherit version;
|
|
src = fetchFromGitHub {
|
|
owner = "haiwen";
|
|
repo = "seafile-server";
|
|
rev = "v${version}-server";
|
|
sha256 = "0pd1zjsw6lkpxd54ln0dz5r9zx9585nib10kvpl1vgzp61g4d223";
|
|
};
|
|
# patch to work with latest, non-vulnerable libevhtp
|
|
patches = [
|
|
./recent_libevhtp.patch
|
|
./django-version.patch
|
|
];
|
|
# `which` is called directly from python during buildPhase, so we need the binary
|
|
nativeBuildInputs = [ autoconf automake libtool pkgconfig vala autoreconfHook which pythonPackages.wrapPython ];
|
|
buildInputs = [ sqlite glib python libuuid openssl oniguruma fuse libarchive libevent libevhtp ];
|
|
propagatedBuildInputs = [ libsearpc ] ++ seahubPythonDependencies;
|
|
postFixup = ''
|
|
buildPythonPath $propagatedBuildInputs
|
|
wrapPythonProgramsIn "$out/bin" "$out $pythonPath"
|
|
'';
|
|
checkPhase = "bash ./run_tests.sh";
|
|
|
|
meta = with lib; {
|
|
license = licenses.agpl3; # with additional OpenSSL linking exception
|
|
maintainers = with maintainers; [ schmittlauch ];
|
|
};
|
|
};
|
|
seahub = pythonPackages.buildPythonApplication rec {
|
|
name = "seahub";
|
|
inherit version;
|
|
src = fetchFromGitHub {
|
|
owner = "haiwen";
|
|
repo = "seahub";
|
|
rev = "v${version}-server";
|
|
sha256 = "0j7g43j7w1zb00pg4aaacdv5ycva3qf561hj9pbwh4709mbiykip";
|
|
};
|
|
phases = [ "unpackPhase" "installPhase" "fixupPhase" "distPhase" ];
|
|
buildInputs = [ python pythonPackages.wrapPython ];
|
|
propagatedBuildInputs = seahubPythonDependencies ++ [ pythonPackages.seafile-bindings ]; # for `seaserv` module
|
|
installPhase = ''
|
|
cp -r ./ $out
|
|
cd "$out"
|
|
${python.interpreter} -m compileall ./
|
|
buildPythonPath $propagatedBuildInputs
|
|
set -x
|
|
patchPythonScript manage.py
|
|
'';
|
|
meta = with lib; {
|
|
license = licenses.asl20;
|
|
maintainers = with maintainers; [ schmittlauch ];
|
|
};
|
|
};
|
|
|
|
buildInputs = [ vala fuse libsearpc libuuid sqlite openssl libarchive libevent glib python ]
|
|
++ lib.optional (!withMysql) "--without-mysql";
|
|
# `which` is called directly from python during buildPhase, so we need the binary
|
|
nativeBuildInputs = [ autoconf automake libtool pkgconfig autoreconfHook which ];
|
|
configureFlags = [ "--disable-static" ];
|
|
|
|
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 libsearpc ]
|
|
++ lib.optional withMysql libmysqlclient;
|
|
phases = [ "installPhase" "fixupPhase" "distPhase" ];
|
|
# todo: create data directory in /srv in activation script
|
|
installPhase = ''
|
|
mkdir "$out"
|
|
cd "$out"
|
|
ln -s ${seahub} seahub
|
|
ln -s ${seafile-server-core} seafile-server-latest
|
|
'';
|
|
meta = with lib; {
|
|
maintainers = with maintainers; [ schmittlauch ];
|
|
license = licenses.free; # components with different free software licenses are combined
|
|
};
|
|
inherit seafile-server-core seahub;# for using the path in the NixOS module
|
|
}
|