seahub: init at 8.0.8
This commit is contained in:
parent
86c43007ae
commit
4094fcb66f
|
@ -1,7 +1,6 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
python = pkgs.python3Packages.python;
|
|
||||||
cfg = config.services.seafile;
|
cfg = config.services.seafile;
|
||||||
settingsFormat = pkgs.formats.ini { };
|
settingsFormat = pkgs.formats.ini { };
|
||||||
|
|
||||||
|
@ -221,9 +220,7 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
seahub = let
|
seahub = {
|
||||||
penv = (pkgs.python3.withPackages (ps: with ps; [ gunicorn seahub ]));
|
|
||||||
in {
|
|
||||||
description = "Seafile Server Web Frontend";
|
description = "Seafile Server Web Frontend";
|
||||||
wantedBy = [ "seafile.target" ];
|
wantedBy = [ "seafile.target" ];
|
||||||
partOf = [ "seafile.target" ];
|
partOf = [ "seafile.target" ];
|
||||||
|
@ -231,8 +228,7 @@ in {
|
||||||
requires = [ "seaf-server.service" ];
|
requires = [ "seaf-server.service" ];
|
||||||
restartTriggers = [ seahubSettings ];
|
restartTriggers = [ seahubSettings ];
|
||||||
environment = {
|
environment = {
|
||||||
PYTHONPATH =
|
PYTHONPATH = "${pkgs.seahub.pythonPath}:${pkgs.seahub}/thirdpart:${pkgs.seahub}";
|
||||||
"${pkgs.python3Packages.seahub}/thirdpart:${pkgs.python3Packages.seahub}:${penv}/${python.sitePackages}";
|
|
||||||
DJANGO_SETTINGS_MODULE = "seahub.settings";
|
DJANGO_SETTINGS_MODULE = "seahub.settings";
|
||||||
CCNET_CONF_DIR = ccnetDir;
|
CCNET_CONF_DIR = ccnetDir;
|
||||||
SEAFILE_CONF_DIR = dataDir;
|
SEAFILE_CONF_DIR = dataDir;
|
||||||
|
@ -249,7 +245,7 @@ in {
|
||||||
LogsDirectory = "seafile";
|
LogsDirectory = "seafile";
|
||||||
ConfigurationDirectory = "seafile";
|
ConfigurationDirectory = "seafile";
|
||||||
ExecStart = ''
|
ExecStart = ''
|
||||||
${penv}/bin/gunicorn seahub.wsgi:application \
|
${pkgs.seahub.python.pkgs.gunicorn}/bin/gunicorn seahub.wsgi:application \
|
||||||
--name seahub \
|
--name seahub \
|
||||||
--workers ${toString cfg.workers} \
|
--workers ${toString cfg.workers} \
|
||||||
--log-level=info \
|
--log-level=info \
|
||||||
|
@ -262,27 +258,27 @@ in {
|
||||||
preStart = ''
|
preStart = ''
|
||||||
mkdir -p ${seahubDir}/media
|
mkdir -p ${seahubDir}/media
|
||||||
# Link all media except avatars
|
# Link all media except avatars
|
||||||
for m in `find ${pkgs.python3Packages.seahub}/media/ -maxdepth 1 -not -name "avatars"`; do
|
for m in `find ${pkgs.seahub}/media/ -maxdepth 1 -not -name "avatars"`; do
|
||||||
ln -sf $m ${seahubDir}/media/
|
ln -sf $m ${seahubDir}/media/
|
||||||
done
|
done
|
||||||
if [ ! -e "${seafRoot}/.seahubSecret" ]; then
|
if [ ! -e "${seafRoot}/.seahubSecret" ]; then
|
||||||
${penv}/bin/python ${pkgs.python3Packages.seahub}/tools/secret_key_generator.py > ${seafRoot}/.seahubSecret
|
${pkgs.seahub.python}/bin/python ${pkgs.seahub}/tools/secret_key_generator.py > ${seafRoot}/.seahubSecret
|
||||||
chmod 400 ${seafRoot}/.seahubSecret
|
chmod 400 ${seafRoot}/.seahubSecret
|
||||||
fi
|
fi
|
||||||
if [ ! -f "${seafRoot}/seahub-setup" ]; then
|
if [ ! -f "${seafRoot}/seahub-setup" ]; then
|
||||||
# avatars directory should be writable
|
# avatars directory should be writable
|
||||||
install -D -t ${seahubDir}/media/avatars/ ${pkgs.python3Packages.seahub}/media/avatars/default.png
|
install -D -t ${seahubDir}/media/avatars/ ${pkgs.seahub}/media/avatars/default.png
|
||||||
install -D -t ${seahubDir}/media/avatars/groups ${pkgs.python3Packages.seahub}/media/avatars/groups/default.png
|
install -D -t ${seahubDir}/media/avatars/groups ${pkgs.seahub}/media/avatars/groups/default.png
|
||||||
# init database
|
# init database
|
||||||
${pkgs.python3Packages.seahub}/manage.py migrate
|
${pkgs.seahub}/manage.py migrate
|
||||||
# create admin account
|
# create admin account
|
||||||
${pkgs.expect}/bin/expect -c 'spawn ${pkgs.python3Packages.seahub}/manage.py createsuperuser --email=${cfg.adminEmail}; expect "Password: "; send "${cfg.initialAdminPassword}\r"; expect "Password (again): "; send "${cfg.initialAdminPassword}\r"; expect "Superuser created successfully."'
|
${pkgs.expect}/bin/expect -c 'spawn ${pkgs.seahub}/manage.py createsuperuser --email=${cfg.adminEmail}; expect "Password: "; send "${cfg.initialAdminPassword}\r"; expect "Password (again): "; send "${cfg.initialAdminPassword}\r"; expect "Superuser created successfully."'
|
||||||
echo "${pkgs.python3Packages.seahub.version}-sqlite" > "${seafRoot}/seahub-setup"
|
echo "${pkgs.seahub.version}-sqlite" > "${seafRoot}/seahub-setup"
|
||||||
fi
|
fi
|
||||||
if [ $(cat "${seafRoot}/seahub-setup" | cut -d"-" -f1) != "${pkgs.python3Packages.seahub.version}" ]; then
|
if [ $(cat "${seafRoot}/seahub-setup" | cut -d"-" -f1) != "${pkgs.seahub.version}" ]; then
|
||||||
# update database
|
# update database
|
||||||
${pkgs.python3Packages.seahub}/manage.py migrate
|
${pkgs.seahub}/manage.py migrate
|
||||||
echo "${pkgs.python3Packages.seahub.version}-sqlite" > "${seafRoot}/seahub-setup"
|
echo "${pkgs.seahub.version}-sqlite" > "${seafRoot}/seahub-setup"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
74
pkgs/applications/networking/seahub/default.nix
Normal file
74
pkgs/applications/networking/seahub/default.nix
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
{ lib, fetchFromGitHub, python3, makeWrapper }:
|
||||||
|
let
|
||||||
|
# Seahub 8.x.x does not support django-webpack-loader >=1.x.x
|
||||||
|
python = python3.override {
|
||||||
|
packageOverrides = self: super: {
|
||||||
|
django-webpack-loader = super.django-webpack-loader.overridePythonAttrs (old: rec {
|
||||||
|
version = "0.7.0";
|
||||||
|
src = old.src.override {
|
||||||
|
inherit version;
|
||||||
|
sha256 = "0izl6bibhz3v538ad5hl13lfr6kvprf62rcl77wq2i5538h8hg3s";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
python.pkgs.buildPythonApplication rec {
|
||||||
|
pname = "seahub";
|
||||||
|
version = "8.0.8";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "haiwen";
|
||||||
|
repo = "seahub";
|
||||||
|
rev = "c51346155b2f31e038c3a2a12e69dcc6665502e2"; # using a fixed revision because upstream may re-tag releases :/
|
||||||
|
sha256 = "0dagiifxllfk73xdzfw2g378jccpzplhdrmkwbaakbhgbvvkg92k";
|
||||||
|
};
|
||||||
|
|
||||||
|
dontBuild = true;
|
||||||
|
doCheck = false; # disabled because it requires a ccnet environment
|
||||||
|
|
||||||
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
|
||||||
|
propagatedBuildInputs = with python.pkgs; [
|
||||||
|
django
|
||||||
|
future
|
||||||
|
django-statici18n
|
||||||
|
django-webpack-loader
|
||||||
|
django-simple-captcha
|
||||||
|
django-picklefield
|
||||||
|
django-formtools
|
||||||
|
mysqlclient
|
||||||
|
pillow
|
||||||
|
python-dateutil
|
||||||
|
django_compressor
|
||||||
|
djangorestframework
|
||||||
|
openpyxl
|
||||||
|
requests
|
||||||
|
requests_oauthlib
|
||||||
|
pyjwt
|
||||||
|
pycryptodome
|
||||||
|
qrcode
|
||||||
|
pysearpc
|
||||||
|
seaserv
|
||||||
|
gunicorn
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
cp -dr --no-preserve='ownership' . $out/
|
||||||
|
wrapProgram $out/manage.py \
|
||||||
|
--prefix PYTHONPATH : "$PYTHONPATH:$out/thirdpart:"
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
inherit python;
|
||||||
|
pythonPath = python3.pkgs.makePythonPath propagatedBuildInputs;
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
homepage = "https://github.com/haiwen/seahub";
|
||||||
|
description = "The web end of seafile server";
|
||||||
|
license = licenses.asl20;
|
||||||
|
platforms = platforms.linux;
|
||||||
|
maintainers = with maintainers; [ greizgh schmittlauch ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -28606,6 +28606,8 @@ with pkgs;
|
||||||
|
|
||||||
seafile-client = libsForQt5.callPackage ../applications/networking/seafile-client { };
|
seafile-client = libsForQt5.callPackage ../applications/networking/seafile-client { };
|
||||||
|
|
||||||
|
seahub = callPackage ../applications/networking/seahub { };
|
||||||
|
|
||||||
seatd = callPackage ../applications/misc/seatd { };
|
seatd = callPackage ../applications/misc/seatd { };
|
||||||
|
|
||||||
secretscanner = callPackage ../tools/security/secretscanner { };
|
secretscanner = callPackage ../tools/security/secretscanner { };
|
||||||
|
|
Loading…
Reference in a new issue