Personal-use NixOS configuration
1# https://github.com/NixOS/nixpkgs/blob/c97c47f2bac4fa59e2cbdeba289686ae615f8ed4/pkgs/by-name/co/collabora-online/package.nix
2
3{
4 autoreconfHook,
5 cairo,
6 cppunit,
7 fetchFromGitHub,
8 fetchNpmDeps,
9 lib,
10 libcap,
11 libpng,
12 libreoffice-collabora,
13 nodejs,
14 npmHooks,
15 pam,
16 pango,
17 pixman,
18 pkg-config,
19 poco,
20 python3,
21 rsync,
22 stdenv,
23 zstd,
24}:
25
26stdenv.mkDerivation (finalAttrs: {
27 pname = "collabora-online";
28 version = "25.04.9-2";
29
30 src = fetchFromGitHub {
31 owner = "CollaboraOnline";
32 repo = "online";
33 tag = "cp-${finalAttrs.version}";
34 hash = "sha256-+Fq5P5c+MhACYeBMNAwxNnn4mHw3sLl/l2EcRid3fQc=";
35 };
36
37 nativeBuildInputs = [
38 autoreconfHook
39 nodejs
40 npmHooks.npmConfigHook
41 pkg-config
42 python3
43 python3.pkgs.lxml
44 python3.pkgs.polib
45 rsync
46 ];
47
48 buildInputs = [
49 cairo
50 cppunit
51 libcap
52 libpng
53 pam
54 pango
55 pixman
56 poco
57 zstd
58 ];
59
60 enableParallelBuilding = true;
61
62 configureFlags = [
63 "--disable-setcap"
64 "--disable-werror"
65 "--enable-silent-rules"
66 "--with-lo-path=${libreoffice-collabora}/lib/collaboraoffice"
67 "--with-lokit-path=${libreoffice-collabora.src}/include"
68 ];
69
70 patches = [
71 ./fix-file-server-regex.patch
72 ./dangerously-comment-code.patch
73 ];
74
75 postPatch = ''
76 cp ${./package-lock.json} ${finalAttrs.npmRoot}/package-lock.json
77
78 patchShebangs browser/util/*.py coolwsd-systemplate-setup scripts/*
79 substituteInPlace configure.ac --replace-fail '/usr/bin/env python3' python3
80 '';
81
82 # Copy dummy self-signed certificates provided for testing.
83 postInstall = ''
84 cp etc/ca-chain.cert.pem etc/cert.pem etc/key.pem $out/etc/coolwsd
85 '';
86
87 npmDeps = fetchNpmDeps {
88 unpackPhase = "true";
89 # TODO: Use upstream `npm-shrinkwrap.json` once it's fixed
90 # https://github.com/CollaboraOnline/online/issues/9644
91 postPatch = ''
92 cp ${./package-lock.json} package-lock.json
93 '';
94 hash = "sha256-CupMRQGNrg6V1UK3wLth5HydvtFnZbpVfCiNzD0VbKg=";
95 };
96
97 npmRoot = "browser";
98
99 passthru = {
100 libreoffice = libreoffice-collabora; # Used by NixOS module.
101 };
102
103 meta = {
104 description = "Collaborative online office suite based on LibreOffice technology";
105 license = lib.licenses.mpl20;
106 maintainers = [ lib.maintainers.xzfc ];
107 homepage = "https://www.collaboraonline.com";
108 platforms = lib.platforms.linux;
109 };
110})