expose python environment throug sub-attribute, for accessing python interpreter to run admin scripts
This commit is contained in:
parent
9dde0d319f
commit
8b73ec0585
|
@ -237,17 +237,8 @@ in
|
|||
''}")
|
||||
("${pkgs.writeShellScript "seafile-server-preStart-unprivileged" ''
|
||||
# stuff run as seafile user
|
||||
set -x
|
||||
|
||||
# ccnet-init must only be run once per installation, as it also generates stateful key and ID
|
||||
# solution: invoke it once, use result as template
|
||||
if [ ! -e ./ccnet/mykey.peer ]; then
|
||||
#$ {pkgs.seafile-server.ccnet-server}/bin/ccnet-init -c ./ccnet -H 'TEMPLATEHOST'
|
||||
mv ./ccnet/ccnet.conf{,.template}
|
||||
fi
|
||||
|
||||
# generate actual ccnet config file
|
||||
echo "[General]" > ./conf/ccnet.conf
|
||||
grep "^ID =" ./ccnet/ccnet.conf.template >> ./conf/ccnet.conf
|
||||
# outside URL
|
||||
SERVICE_URL="http${if cfg.enableTLS then "s" else ""}://${cfg.domainName}:${toString cfg.externalPort}"
|
||||
|
||||
|
@ -264,8 +255,9 @@ in
|
|||
}
|
||||
|
||||
|
||||
pwd
|
||||
ln -sf ${pkgs.seafile-server} seafile-server
|
||||
./seafile-server/setup-seafile-mysql.sh \
|
||||
${pkgs.seafile-server.pythonEnv}/bin/python seafile-server/setup-seafile-mysql.py auto \
|
||||
-n "${cfg.name}" \
|
||||
-i "${cfg.domainName}" \
|
||||
-p "${toString cfg.fileserverPort}" \
|
||||
|
|
|
@ -49,6 +49,8 @@ let
|
|||
pycryptodome
|
||||
]
|
||||
++ map (p: p.override { inherit django; }) djangoModules; # build django modules with required version
|
||||
# defining them here to be able to expose them in a python environment as well
|
||||
pythonEnvDeps = seahubPythonDependencies ++ [ libsearpc ];
|
||||
seafile-server-core = stdenv.mkDerivation rec {
|
||||
name = "seafile-server-core";
|
||||
inherit version;
|
||||
|
@ -66,7 +68,7 @@ let
|
|||
# `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;
|
||||
propagatedBuildInputs = pythonEnvDeps;
|
||||
# copy manual to required location
|
||||
postInstall = ''
|
||||
mkdir $out/doc
|
||||
|
@ -127,6 +129,7 @@ stdenv.mkDerivation {
|
|||
name = "seafile-server";
|
||||
inherit version;
|
||||
|
||||
nativeBuildInputs = [ python3Packages.wrapPython ];
|
||||
buildInputs = [ seahub seafile-server-core libsearpc ]
|
||||
++ lib.optional withMysql libmysqlclient;
|
||||
phases = [ "installPhase" "fixupPhase" "distPhase" ];
|
||||
|
@ -145,10 +148,21 @@ stdenv.mkDerivation {
|
|||
cp -r ${seafile-server-core.src}/scripts/upgrade .
|
||||
cp -r ${seafile-server-core.src}/scripts/sql .
|
||||
# copy_user_manual is already done in the postInstall hook of seafile-server-core
|
||||
# python admin scripts need to be made executable and patched with python path
|
||||
chmod ugo+x *.py
|
||||
buildPythonPath $propagatedBuildInputs
|
||||
wrapPythonProgramsIn "$out/*.py" "$out $pythonPath"
|
||||
|
||||
echo -n "${version}" > installed_version
|
||||
'';
|
||||
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
|
||||
|
||||
pythonEnv = python3.buildEnv.override {
|
||||
extraLibs = pythonEnvDeps;
|
||||
ignoreCollisions = true;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
services.seafile-server = {
|
||||
enable = true;
|
||||
#autorun = false;
|
||||
domainName = "localhost";
|
||||
domainName = "seaf.local";
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue