15 # var/www/onlyoffice/documentserver/server/DocService/docservice
16 onlyoffice-documentserver = stdenv.mkDerivation rec {
17 pname = "onlyoffice-documentserver";
22 url = "https://github.com/ONLYOFFICE/DocumentServer/releases/download/v${version}/onlyoffice-documentserver_arm64.deb";
23 sha256 = "sha256-+7hHz1UcnlJNhBAVaYQwK0m2tkgsfbjqY3oa8XU0yxo=";
26 url = "https://github.com/ONLYOFFICE/DocumentServer/releases/download/v${version}/onlyoffice-documentserver_amd64.deb";
27 sha256 = "sha256-jCwcXb97Z9/ZofKLYneJxKAnaZE/Hwvm34GLQu/BoUM=";
29 }.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}"));
31 preferLocalBuild = true;
33 unpackCmd = "dpkg -x $curSrc source";
40 # replace dangling symlinks which are not copied into fhs with actually files
42 for file in var/www/onlyoffice/documentserver/server/FileConverter/bin/*.so* ; do
43 ln -rs "$file" lib/$(basename "$file")
46 # NixOS uses systemd, not supervisor
49 install -Dm755 usr/bin/documentserver-prepare4shutdown.sh -t $out/bin
50 # maintainer scripts which expect supervisorctl, try to write into the nix store or are handled by nixos modules
53 # .deb default documentation
56 # required for bwrap --bind
57 mkdir -p var/lib/onlyoffice/ var/www/onlyoffice/documentserver/fonts/
62 # stripping self extracting javascript binaries likely breaks them
67 name = "onlyoffice-wrapper";
71 onlyoffice-documentserver
80 "--bind var/lib/onlyoffice/ var/lib/onlyoffice/"
81 "--bind var/lib/onlyoffice/documentserver/sdkjs/common/ var/www/onlyoffice/documentserver/sdkjs/common/"
82 "--bind var/lib/onlyoffice/documentserver/sdkjs/slide/themes/ var/www/onlyoffice/documentserver/sdkjs/slide/themes/"
83 "--bind var/lib/onlyoffice/documentserver/fonts/ var/www/onlyoffice/documentserver/fonts/"
84 "--bind var/lib/onlyoffice/documentserver/server/FileConverter/bin/ var/www/onlyoffice/documentserver/server/FileConverter/bin/"
87 runScript = writeScript "onlyoffice-documentserver-run-script" ''
88 export NODE_CONFIG_DIR=$2
89 export NODE_DISABLE_COLORS=1
90 export NODE_ENV=production-linux
92 if [[ $1 == DocService/docservice ]]; then
93 mkdir -p var/www/onlyoffice/documentserver/sdkjs/slide/themes/
94 # symlinking themes/src breaks discovery in allfontsgen
95 rm -rf var/www/onlyoffice/documentserver/sdkjs/slide/themes/src
96 cp -r ${onlyoffice-documentserver}/var/www/onlyoffice/documentserver/sdkjs/slide/themes/src var/www/onlyoffice/documentserver/sdkjs/slide/themes/
97 chmod -R u+w var/www/onlyoffice/documentserver/sdkjs/slide/themes/
99 # onlyoffice places generated files in those directores
100 rm -rf var/www/onlyoffice/documentserver/sdkjs/common/*
101 ${xorg.lndir}/bin/lndir -silent ${onlyoffice-documentserver}/var/www/onlyoffice/documentserver/sdkjs/common/ var/www/onlyoffice/documentserver/sdkjs/common/
102 rm -rf var/www/onlyoffice/documentserver/server/FileConverter/bin/*
103 ${xorg.lndir}/bin/lndir -silent ${onlyoffice-documentserver}/var/www/onlyoffice/documentserver/server/FileConverter/bin/ var/www/onlyoffice/documentserver/server/FileConverter/bin/
105 # https://github.com/ONLYOFFICE/document-server-package/blob/master/common/documentserver/bin/documentserver-generate-allfonts.sh.m4
106 echo -n Generating AllFonts.js, please wait...
107 "var/www/onlyoffice/documentserver/server/tools/allfontsgen"\
108 --input="${onlyoffice-documentserver}/var/www/onlyoffice/documentserver/core-fonts"\
109 --allfonts-web="var/www/onlyoffice/documentserver/sdkjs/common/AllFonts.js"\
110 --allfonts="var/www/onlyoffice/documentserver/server/FileConverter/bin/AllFonts.js"\
111 --images="var/www/onlyoffice/documentserver/sdkjs/common/Images"\
112 --selection="var/www/onlyoffice/documentserver/server/FileConverter/bin/font_selection.bin"\
113 --output-web="var/www/onlyoffice/documentserver/fonts"\
117 echo -n Generating presentation themes, please wait...
118 "var/www/onlyoffice/documentserver/server/tools/allthemesgen"\
119 --converter-dir="var/www/onlyoffice/documentserver/server/FileConverter/bin"\
120 --src="var/www/onlyoffice/documentserver/sdkjs/slide/themes"\
121 --output="var/www/onlyoffice/documentserver/sdkjs/common/Images"
123 "var/www/onlyoffice/documentserver/server/tools/allthemesgen"\
124 --converter-dir="var/www/onlyoffice/documentserver/server/FileConverter/bin"\
125 --src="var/www/onlyoffice/documentserver/sdkjs/slide/themes"\
126 --output="var/www/onlyoffice/documentserver/sdkjs/common/Images"\
130 "var/www/onlyoffice/documentserver/server/tools/allthemesgen"\
131 --converter-dir="var/www/onlyoffice/documentserver/server/FileConverter/bin"\
132 --src="var/www/onlyoffice/documentserver/sdkjs/slide/themes"\
133 --output="var/www/onlyoffice/documentserver/sdkjs/common/Images"\
139 exec var/www/onlyoffice/documentserver/server/$1
145 description = "ONLYOFFICE Document Server is an online office suite comprising viewers and editors";
146 mainProgram = "documentserver-prepare4shutdown.sh";
148 ONLYOFFICE Document Server is an online office suite comprising viewers and editors for texts, spreadsheets and presentations,
149 fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.
151 homepage = "https://github.com/ONLYOFFICE/DocumentServer";
152 license = licenses.agpl3Plus;
153 platforms = [ "x86_64-linux" "aarch64-linux" ];
154 sourceProvenance = [ sourceTypes.binaryNativeCode ];
155 maintainers = with maintainers; [ SuperSandro2000 ];
159 onlyoffice-documentserver