Skip to content

CollaboraOnline/nix-build-support

Repository files navigation

Collabora Online nix-build-support

This repository contains community-supported nix build support for developing Collabora Online. We do not support, and recommend you do not use, this in a production environment

General usage

The following I know to work

  • building Core and Collabora Online for Android on NixOS
  • building Core and Collabora Online on NixOS
  • running Core and Collabora Online on NixOS

You likely want to use this with Nilla's cli as, while you can manually use the shells, it will provide a much more sugared experience. You can follow Nilla's quickstart guide to install it

You will probably want to keep this directory alongside your nix rather than cloning into it. That's because nilla will copy everything to your store if you use it to enter a shell, leading to a very long delay. LibreOffice translations/etc. are gigabytes big in a full clone. You do not want that.

Language Server support

We've included clangd (by way of pkgs.clang-tools) in the core projects so you can use it as a language server in your editor of choice.

Many editors come with ways to set this up

To properly use this, you'll need to generate a compilation database, which you can do with

make vim-ide-integration
# See https://wiki.documentfoundation.org/Development/Vim for the source of this

don't worry if you're using an editor other than vim - the compilation database generated by this command is usable wherever the language server is supported!

Copy/pasteable commands

Note

In the following instructions we use some variables ($AUTOGEN_FLAGS, $CONFIGURE_FLAGS, etc.). These don't need to be replaced by you. Instead, the shell you are in will have them automatically populated.

Some of the flags are important, for example they might have paths to dependencies, so you should keep them intact. For adding your own customizations you can add additional flags to the command line. For example, to set an external tarball directory you could run this in place of the existing ./autogen.sh line:

./autogen.sh $AUTOGEN_FLAGS --with-external-tar=../../core-tarballs

Before you get started, you'll need to clone this repository to your system. We recommend that you keep it alongside your LibreOffice and Collabora Online code rather than putting one inside the other

git clone https://github.com/CollaboraOnline/nix-build-support

To build core

With the Nilla cli
nilla shell core --project /path/to/CollaboraOnline/nix-build-support
git clone https://gerrit.libreoffice.org/core
cd core
git checkout distro/collabora/co-25.04
./autogen.sh $AUTOGEN_FLAGS
make
With plain Nix/Lix
nix-shell /path/to/CollaboraOnline/nix-build-support/nilla.nix -A shells.core.result.x86_64-linux
git clone https://gerrit.libreoffice.org/core
cd core
git checkout distro/collabora/co-25.04
./autogen.sh $AUTOGEN_FLAGS
make

To build online

Important

Collabora Online has recently improved its support for NixOS

If you are running on an older clone of Collabora Online, you will need to either cherry-pick that commit or run git apply "$SYSTEMPLATE_PATCH" in your clone

Note

You may see instructions for other distributions that mention daily-build core archives as an alternative to building core yourself

You can't use daily-built LibreOffice core archives on NixOS as they will run into missing dynamic libraries. To avoid this, build core on NixOS yourself with the shells from this repository

With the Nilla cli
nilla shell online --project /path/to/CollaboraOnline/nix-build-support
git clone https://github.com/CollaboraOnline/online
cd online
./autogen.sh
./configure $CONFIGURE_FLAGS --with-lokit-path=/path/to/core/include --with-lo-path=/path/to/core/instdir
make run
With plain Nix/Lix
nix-shell /path/to/CollaboraOnline/nix-build-support/nilla.nix -A shells.online.result.x86_64-linux
git clone https://github.com/CollaboraOnline/online
cd online
./autogen.sh
./configure $CONFIGURE_FLAGS --with-lokit-path=/path/to/core/include --with-lo-path=/path/to/core/instdir
make run

To build Android core

With the Nilla cli
nilla shell android-core --project /path/to/CollaboraOnline/nix-build-support
git clone https://gerrit.libreoffice.org/core
cd core
git checkout distro/collabora/co-25.04
./autogen.sh $AUTOGEN_FLAGS
make
With plain Nix/Lix
nix-shell /path/to/CollaboraOnline/nix-build-support/nilla.nix -A shells.android-core.result.x86_64-linux
git clone https://gerrit.libreoffice.org/core
cd core
git checkout distro/collabora/co-25.04
./autogen.sh $AUTOGEN_FLAGS
make

To build Android online

With the Nilla cli
nilla shell android-online --project /path/to/CollaboraOnline/nix-build-support
git clone https://github.com/CollaboraOnline/online
cd online
./autogen.sh
./configure $CONFIGURE_FLAGS --with-lo-builddir=/path/to/core
make
android-studio
# Follow the prompts in Android studio to build. If you're asked whether to use project NDK or Android Studio NDK choose Android Studio NDK
With plain Nix/Lix
nix-shell /path/to/CollaboraOnline/nix-build-support/nilla.nix -A shells.android-online.result.x86_64-linux
git clone https://github.com/CollaboraOnline/online
cd online
./autogen.sh
./configure $CONFIGURE_FLAGS --with-lo-builddir=/path/to/core
make
android-studio
# Follow the prompts in Android studio to build. If you're asked whether to use project NDK or Android Studio NDK choose Android Studio NDK

Usage with direnv

The .envrc.template assumes that you have kept this directory alongside your Collabora Online and LibreOffice clones rather than cloning LibreOffice into it. (This is the preferred way of using this project anyway as otherwise you will end up copying your clones into the nix store which will severely harm performance)

The .envrc.template also assumes you have some nested directory structure, such as

- nix-build-support/
- android/
  - core/
  - online/
- standard/
  - core/
  - online/

and are placing it in your clone directories (here 'core' and 'online')

This is a reasonable assumption as you will need separate shells for core and online, so you can't just place the .envrc directly above your clone of this repository.

If you decide to change either of these assumptions, the path should be trivial to modify. You'll need to change the envrc anyway to fill in the shell name you want. Again, this should be fairly self explanatory

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages