Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a0943687d2a5094a6d92f25a4b6e16a76b5b7
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

167 lines
6.9 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