15 # var/www/onlyoffice/documentserver/server/DocService/docservice
16 onlyoffice-documentserver = stdenv.mkDerivation rec {
17 pname = "onlyoffice-documentserver";
21 url = "https://github.com/ONLYOFFICE/DocumentServer/releases/download/v${lib.concatStringsSep "." (lib.take 3 (lib.splitVersion version))}/onlyoffice-documentserver_amd64.deb";
22 sha256 = "sha256-191PYpxs/TbVXoBPHvuyTp81ZMtw1YaFznY1hUSbh+0=";
25 preferLocalBuild = true;
27 unpackCmd = "dpkg -x $curSrc source";
34 # replace dangling symlinks which are not copied into fhs with actually files
36 for file in var/www/onlyoffice/documentserver/server/FileConverter/bin/*.so* ; do
37 ln -rs "$file" lib/$(basename "$file")
40 # NixOS uses systemd, not supervisor
43 install -Dm755 usr/bin/documentserver-prepare4shutdown.sh -t $out/bin
44 # maintainer scripts which expect supervisorctl, try to write into the nix store or are handled by nixos modules
47 # .deb default documentation
50 # required for bwrap --bind
51 mkdir -p var/lib/onlyoffice/ var/www/onlyoffice/documentserver/fonts/
56 # stripping self extracting javascript binaries likely breaks them
61 name = "onlyoffice-wrapper";
65 onlyoffice-documentserver
74 "--bind var/lib/onlyoffice/ var/lib/onlyoffice/"
75 "--bind var/lib/onlyoffice/documentserver/sdkjs/common/ var/www/onlyoffice/documentserver/sdkjs/common/"
76 "--bind var/lib/onlyoffice/documentserver/sdkjs/slide/themes/ var/www/onlyoffice/documentserver/sdkjs/slide/themes/"
77 "--bind var/lib/onlyoffice/documentserver/fonts/ var/www/onlyoffice/documentserver/fonts/"
78 "--bind var/lib/onlyoffice/documentserver/server/FileConverter/bin/ var/www/onlyoffice/documentserver/server/FileConverter/bin/"
81 runScript = writeScript "onlyoffice-documentserver-run-script" ''
82 export NODE_CONFIG_DIR=$2
83 export NODE_DISABLE_COLORS=1
84 export NODE_ENV=production-linux
86 if [[ $1 == DocService/docservice ]]; then
87 mkdir -p var/www/onlyoffice/documentserver/sdkjs/slide/themes/
88 # symlinking themes/src breaks discovery in allfontsgen
89 rm -rf var/www/onlyoffice/documentserver/sdkjs/slide/themes/src
90 cp -r ${onlyoffice-documentserver}/var/www/onlyoffice/documentserver/sdkjs/slide/themes/src var/www/onlyoffice/documentserver/sdkjs/slide/themes/
91 chmod -R u+w var/www/onlyoffice/documentserver/sdkjs/slide/themes/
93 # onlyoffice places generated files in those directores
94 rm -rf var/www/onlyoffice/documentserver/sdkjs/common/*
95 ${xorg.lndir}/bin/lndir -silent ${onlyoffice-documentserver}/var/www/onlyoffice/documentserver/sdkjs/common/ var/www/onlyoffice/documentserver/sdkjs/common/
96 rm -rf var/www/onlyoffice/documentserver/server/FileConverter/bin/*
97 ${xorg.lndir}/bin/lndir -silent ${onlyoffice-documentserver}/var/www/onlyoffice/documentserver/server/FileConverter/bin/ var/www/onlyoffice/documentserver/server/FileConverter/bin/
99 # https://github.com/ONLYOFFICE/document-server-package/blob/master/common/documentserver/bin/documentserver-generate-allfonts.sh.m4
100 echo -n Generating AllFonts.js, please wait...
101 "var/www/onlyoffice/documentserver/server/tools/allfontsgen"\
102 --input="${onlyoffice-documentserver}/var/www/onlyoffice/documentserver/core-fonts"\
103 --allfonts-web="var/www/onlyoffice/documentserver/sdkjs/common/AllFonts.js"\
104 --allfonts="var/www/onlyoffice/documentserver/server/FileConverter/bin/AllFonts.js"\
105 --images="var/www/onlyoffice/documentserver/sdkjs/common/Images"\
106 --selection="var/www/onlyoffice/documentserver/server/FileConverter/bin/font_selection.bin"\
107 --output-web="var/www/onlyoffice/documentserver/fonts"\
111 echo -n Generating presentation themes, please wait...
112 "var/www/onlyoffice/documentserver/server/tools/allthemesgen"\
113 --converter-dir="var/www/onlyoffice/documentserver/server/FileConverter/bin"\
114 --src="var/www/onlyoffice/documentserver/sdkjs/slide/themes"\
115 --output="var/www/onlyoffice/documentserver/sdkjs/common/Images"
117 "var/www/onlyoffice/documentserver/server/tools/allthemesgen"\
118 --converter-dir="var/www/onlyoffice/documentserver/server/FileConverter/bin"\
119 --src="var/www/onlyoffice/documentserver/sdkjs/slide/themes"\
120 --output="var/www/onlyoffice/documentserver/sdkjs/common/Images"\
124 "var/www/onlyoffice/documentserver/server/tools/allthemesgen"\
125 --converter-dir="var/www/onlyoffice/documentserver/server/FileConverter/bin"\
126 --src="var/www/onlyoffice/documentserver/sdkjs/slide/themes"\
127 --output="var/www/onlyoffice/documentserver/sdkjs/common/Images"\
133 exec var/www/onlyoffice/documentserver/server/$1
139 description = "ONLYOFFICE Document Server is an online office suite comprising viewers and editors";
140 mainProgram = "documentserver-prepare4shutdown.sh";
142 ONLYOFFICE Document Server is an online office suite comprising viewers and editors for texts, spreadsheets and presentations,
143 fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.
145 homepage = "ONLYOFFICE Document Server is an online office suite comprising viewers and editors";
146 license = licenses.agpl3Plus;
147 platforms = [ "x86_64-linux" ];
148 sourceProvenance = [ sourceTypes.binaryNativeCode ];
149 maintainers = with maintainers; [ SuperSandro2000 ];
153 onlyoffice-documentserver