diff options
author | KokaKiwi <kokakiwi+git@kokakiwi.net> | 2024-04-18 18:56:19 +0200 |
---|---|---|
committer | KokaKiwi <kokakiwi+git@kokakiwi.net> | 2024-04-18 18:56:19 +0200 |
commit | 9111997f845cb61bcbe5b5f49672ba26814d19c9 (patch) | |
tree | 701c4dc457658904420bddff944cac6f906aa991 /cluster/prod/app/cryptpad/build/README.md | |
parent | d41e10bd25e54ae46b4c35f677abb593fde4c60d (diff) | |
download | nixcfg-9111997f845cb61bcbe5b5f49672ba26814d19c9.tar.gz nixcfg-9111997f845cb61bcbe5b5f49672ba26814d19c9.zip |
cluster/prod(app): Add new CryptPad build files
Diffstat (limited to 'cluster/prod/app/cryptpad/build/README.md')
-rw-r--r-- | cluster/prod/app/cryptpad/build/README.md | 61 |
1 files changed, 44 insertions, 17 deletions
diff --git a/cluster/prod/app/cryptpad/build/README.md b/cluster/prod/app/cryptpad/build/README.md index 079d836..8e17406 100644 --- a/cluster/prod/app/cryptpad/build/README.md +++ b/cluster/prod/app/cryptpad/build/README.md @@ -1,29 +1,56 @@ -## Build +# CryptPad for NixOS with Deuxfleurs flavour -Cryptpad being not NixOS native, an upgrade must be done in 4 steps: - 1. Bump the cryptpad version in `common.nix` - 2. Rebuild the Nix lock files for the dependencies - 3. Build the package for Nix - 4. Create a container from the Nix package +## Building -To bump the nix version, set the desired tag in `common.nix` in the `cryptpadVersion` entry. -Set the corresponding commit in the `cryptadCommit` field, its goal would be to detect unwanted update of the tag. +The `default.nix` file follows the nixpkgs `callPackage` convention for fetching dependencies, so you need to either: -To rebuild the lock files (they are stored in the `nix.lock` folder): +- Run `nix-build --expr '{ ... }@args: (import <nixpkgs> {}).callPackage ./default.nix args'` +- Do the `callPackage from a higher-level directory importing your package` -``` -nix-shell --run "update_lock" -``` +### Docker -To build cryptpad: +The `docker.nix` derives into a Docker image you can load simply by running: +```shell +docker load -i $(nix-build docker.nix) ``` -nix-build + +You can then test the built Docker image using the provided `docker-compose.yml` and `config.js` files, which are +configured to render the instance accessible at `http://localhost:3000` with data stored into the `_data` folder. + + +### Deuxfleurs flavour +The `deuxfleurs.nix` file derives into two derivations: The CryptPad derivation itself and a Docker image, +which can be choose by passing the `-A [name]` flags to `nix-build` + +For example, to build and load the Deuxfleurs-flavoured CryptPad Docker image, you run: + +```shell +docker load -i $(nix-build deuxfleurs.nix -A docker) ``` -Create the container: +## OnlyOffice integration +Apart for `deuxfleurs.nix`, both `default.nix` and `docker.nix` files build CryptPad with a copy of OnlyOffice pre-built and +used by CryptPad, which can result to large Docker image (~2.6GiB) +This behaviour is configurable by passing the `--arg withOnlyOffice false` flag to `nix-build` when building them. + +## Updating the Deuxfleurs pinned nixpkgs +The pinned sources files are generated with the [niv](https://github.com/nmattia/niv) tool. + +To update the pinned nixpkgs, you simply run the following command: + +```shell +niv update ``` -docker load < $(nix-build docker.nix) -docker push superboum/cryptpad:??? + +To modify the pinned nixpkgs, you can use the `niv modify` command, for example, to move to nixpkgs-unstable: + +```shell +niv modify nixpkgs -b nixos-unstable ``` + +## Quirks + +- The CryptPad `package-lock.json` is included here because the upstream-provided one appeared to be desync'ed, so a + manual lockfile generation was needed |