571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
160 lines
6.8 KiB
Nix
160 lines
6.8 KiB
Nix
{ lib
|
|
, stdenv
|
|
, buildFHSEnv
|
|
, corefonts
|
|
, dejavu_fonts
|
|
, dpkg
|
|
, fetchurl
|
|
, gcc-unwrapped
|
|
, liberation_ttf_v1
|
|
, writeScript
|
|
, xorg
|
|
}:
|
|
|
|
let
|
|
# var/www/onlyoffice/documentserver/server/DocService/docservice
|
|
onlyoffice-documentserver = stdenv.mkDerivation rec {
|
|
pname = "onlyoffice-documentserver";
|
|
version = "8.1.3";
|
|
|
|
src = fetchurl ({
|
|
"aarch64-linux" = {
|
|
url = "https://github.com/ONLYOFFICE/DocumentServer/releases/download/v${version}/onlyoffice-documentserver_arm64.deb";
|
|
sha256 = "sha256-+7hHz1UcnlJNhBAVaYQwK0m2tkgsfbjqY3oa8XU0yxo=";
|
|
};
|
|
"x86_64-linux" = {
|
|
url = "https://github.com/ONLYOFFICE/DocumentServer/releases/download/v${version}/onlyoffice-documentserver_amd64.deb";
|
|
sha256 = "sha256-jCwcXb97Z9/ZofKLYneJxKAnaZE/Hwvm34GLQu/BoUM=";
|
|
};
|
|
}.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}"));
|
|
|
|
preferLocalBuild = true;
|
|
|
|
unpackCmd = "dpkg -x $curSrc source";
|
|
|
|
nativeBuildInputs = [
|
|
dpkg
|
|
];
|
|
|
|
installPhase = ''
|
|
# replace dangling symlinks which are not copied into fhs with actually files
|
|
rm lib/*.so*
|
|
for file in var/www/onlyoffice/documentserver/server/FileConverter/bin/*.so* ; do
|
|
ln -rs "$file" lib/$(basename "$file")
|
|
done
|
|
|
|
# NixOS uses systemd, not supervisor
|
|
rm -rf etc/supervisor
|
|
|
|
install -Dm755 usr/bin/documentserver-prepare4shutdown.sh -t $out/bin
|
|
# maintainer scripts which expect supervisorctl, try to write into the nix store or are handled by nixos modules
|
|
rm -rf usr/bin
|
|
|
|
# .deb default documentation
|
|
rm -rf usr/share
|
|
|
|
# required for bwrap --bind
|
|
mkdir -p var/lib/onlyoffice/ var/www/onlyoffice/documentserver/fonts/
|
|
|
|
mv * $out/
|
|
'';
|
|
|
|
# stripping self extracting javascript binaries likely breaks them
|
|
dontStrip = true;
|
|
|
|
passthru = {
|
|
fhs = buildFHSEnv {
|
|
name = "onlyoffice-wrapper";
|
|
|
|
targetPkgs = pkgs: [
|
|
gcc-unwrapped.lib
|
|
onlyoffice-documentserver
|
|
|
|
# fonts
|
|
corefonts
|
|
dejavu_fonts
|
|
liberation_ttf_v1
|
|
];
|
|
|
|
extraBwrapArgs = [
|
|
"--bind var/lib/onlyoffice/ var/lib/onlyoffice/"
|
|
"--bind var/lib/onlyoffice/documentserver/sdkjs/common/ var/www/onlyoffice/documentserver/sdkjs/common/"
|
|
"--bind var/lib/onlyoffice/documentserver/sdkjs/slide/themes/ var/www/onlyoffice/documentserver/sdkjs/slide/themes/"
|
|
"--bind var/lib/onlyoffice/documentserver/fonts/ var/www/onlyoffice/documentserver/fonts/"
|
|
"--bind var/lib/onlyoffice/documentserver/server/FileConverter/bin/ var/www/onlyoffice/documentserver/server/FileConverter/bin/"
|
|
];
|
|
|
|
runScript = writeScript "onlyoffice-documentserver-run-script" ''
|
|
export NODE_CONFIG_DIR=$2
|
|
export NODE_DISABLE_COLORS=1
|
|
export NODE_ENV=production-linux
|
|
|
|
if [[ $1 == DocService/docservice ]]; then
|
|
mkdir -p var/www/onlyoffice/documentserver/sdkjs/slide/themes/
|
|
# symlinking themes/src breaks discovery in allfontsgen
|
|
rm -rf var/www/onlyoffice/documentserver/sdkjs/slide/themes/src
|
|
cp -r ${onlyoffice-documentserver}/var/www/onlyoffice/documentserver/sdkjs/slide/themes/src var/www/onlyoffice/documentserver/sdkjs/slide/themes/
|
|
chmod -R u+w var/www/onlyoffice/documentserver/sdkjs/slide/themes/
|
|
|
|
# onlyoffice places generated files in those directores
|
|
rm -rf var/www/onlyoffice/documentserver/sdkjs/common/*
|
|
${xorg.lndir}/bin/lndir -silent ${onlyoffice-documentserver}/var/www/onlyoffice/documentserver/sdkjs/common/ var/www/onlyoffice/documentserver/sdkjs/common/
|
|
rm -rf var/www/onlyoffice/documentserver/server/FileConverter/bin/*
|
|
${xorg.lndir}/bin/lndir -silent ${onlyoffice-documentserver}/var/www/onlyoffice/documentserver/server/FileConverter/bin/ var/www/onlyoffice/documentserver/server/FileConverter/bin/
|
|
|
|
# https://github.com/ONLYOFFICE/document-server-package/blob/master/common/documentserver/bin/documentserver-generate-allfonts.sh.m4
|
|
echo -n Generating AllFonts.js, please wait...
|
|
"var/www/onlyoffice/documentserver/server/tools/allfontsgen"\
|
|
--input="${onlyoffice-documentserver}/var/www/onlyoffice/documentserver/core-fonts"\
|
|
--allfonts-web="var/www/onlyoffice/documentserver/sdkjs/common/AllFonts.js"\
|
|
--allfonts="var/www/onlyoffice/documentserver/server/FileConverter/bin/AllFonts.js"\
|
|
--images="var/www/onlyoffice/documentserver/sdkjs/common/Images"\
|
|
--selection="var/www/onlyoffice/documentserver/server/FileConverter/bin/font_selection.bin"\
|
|
--output-web="var/www/onlyoffice/documentserver/fonts"\
|
|
--use-system="true"
|
|
echo Done
|
|
|
|
echo -n Generating presentation themes, please wait...
|
|
"var/www/onlyoffice/documentserver/server/tools/allthemesgen"\
|
|
--converter-dir="var/www/onlyoffice/documentserver/server/FileConverter/bin"\
|
|
--src="var/www/onlyoffice/documentserver/sdkjs/slide/themes"\
|
|
--output="var/www/onlyoffice/documentserver/sdkjs/common/Images"
|
|
|
|
"var/www/onlyoffice/documentserver/server/tools/allthemesgen"\
|
|
--converter-dir="var/www/onlyoffice/documentserver/server/FileConverter/bin"\
|
|
--src="var/www/onlyoffice/documentserver/sdkjs/slide/themes"\
|
|
--output="var/www/onlyoffice/documentserver/sdkjs/common/Images"\
|
|
--postfix="ios"\
|
|
--params="280,224"
|
|
|
|
"var/www/onlyoffice/documentserver/server/tools/allthemesgen"\
|
|
--converter-dir="var/www/onlyoffice/documentserver/server/FileConverter/bin"\
|
|
--src="var/www/onlyoffice/documentserver/sdkjs/slide/themes"\
|
|
--output="var/www/onlyoffice/documentserver/sdkjs/common/Images"\
|
|
--postfix="android"\
|
|
--params="280,224"
|
|
echo Done
|
|
fi
|
|
|
|
exec var/www/onlyoffice/documentserver/server/$1
|
|
'';
|
|
};
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "ONLYOFFICE Document Server is an online office suite comprising viewers and editors";
|
|
mainProgram = "documentserver-prepare4shutdown.sh";
|
|
longDescription = ''
|
|
ONLYOFFICE Document Server is an online office suite comprising viewers and editors for texts, spreadsheets and presentations,
|
|
fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.
|
|
'';
|
|
homepage = "https://github.com/ONLYOFFICE/DocumentServer";
|
|
license = licenses.agpl3Plus;
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
|
sourceProvenance = [ sourceTypes.binaryNativeCode ];
|
|
maintainers = with maintainers; [ SuperSandro2000 ];
|
|
};
|
|
};
|
|
in
|
|
onlyoffice-documentserver
|