CryptPad is an open-source platform for online collaboration, which is designed to provide encryption to all the data entered by the user. In this tutorial, we will learn how to install CryptPad on nixOS.
Before we begin, make sure your nixOS system is up-to-date, and you have the necessary permissions to install packages. You also must have an active internet connection.
Go to the nix shell with the following command:
nix-shell -p nodejs
Open the following website in your web browser to download the source code of CryptPad:
https://cryptpad.fr
Once the download completes, unzip the downloaded file and navigate to the directory where you saved it.
Create a new file called "default.nix" in the current directory:
touch default.nix
Copy the following code into the file and save it.
{ stdenv, nodejs, yarn, makeWrapper }:
stdenv.mkDerivation rec {
name = "cryptpad-${version}";
version = "3.19.0";
src = ./.;
buildInputs = [ nodejs yarn ];
installPhase = ''
yarn install --modules-folder ${lib}/node_modules
makeWrapper ${src}/dist/server.js \
$out/bin/cryptpad \
--add-flags "--config-dir $out \
--config-name config \
--disable-supervisor \
--no-daemonize \
--disable-message-server \
--disable-ssl-tunnel \
--ip 127.0.0.1 \
--port 3000 \
--session-store "${lib}/cryptpad-sessions""
'';
}
Run the following command to build and install CryptPad:
nix-build
This will create a "result" directory in the current directory.
Now we need to create a user and group for CryptPad, so it can run as a separate user:
sudo adduser --system --no-create-home --ingroup cryptpad cryptpad
Copy the following configuration file to /etc/nixos/configuration.nix and add the required entries:
{ config, pkgs, ... }:
{
services.cryptpad = {
enable = true;
package = pkgs.cryptpad;
port = 3000;
maxBodySize = "1024m";
users.cryptpad.uid = 1000;
users.cryptpad.gid = 1000;
users.cryptpad.home = "/dev/null";
};
}
Finally, run the following command to apply the configuration changes:
sudo nixos-rebuild switch
This will rebuild the system configuration and apply the changes.
Now open your web browser and navigate to "http://localhost:3000" to see if CryptPad is installed and working correctly.
Congratulations! You have successfully installed CryptPad on nixOS.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!