1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
{ lib
, stdenv
, buildFHSUserEnvBubblewrap
, 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 = "7.3.3";
src = fetchurl {
url = "https://github.com/ONLYOFFICE/DocumentServer/releases/download/v${lib.concatStringsSep "." (lib.take 3 (lib.splitVersion version))}/onlyoffice-documentserver_amd64.deb";
sha256 = "sha256-WeDXIDrjICGDVnpkdGLyA9plW50Kz3bHXU48DdHReHM=";
};
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 = buildFHSUserEnvBubblewrap {
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";
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 = "ONLYOFFICE Document Server is an online office suite comprising viewers and editors";
license = licenses.agpl3;
platforms = [ "x86_64-linux" ];
sourceProvenance = [ sourceTypes.binaryNativeCode ];
maintainers = with maintainers; [ SuperSandro2000 ];
};
};
in
onlyoffice-documentserver
|