How to Install CDS on NixOS Latest?

CDS (Continuous Delivery Service) is an open-source, enterprise-grade Continuous Integration and Continuous Delivery platform that you can use to automate building, testing, and deploying your applications. In this tutorial, we will guide you through the process of installing CDS onto NixOS Latest using the official package from the CDS website.

Prerequisites

Before we start, ensure that you have:

  • A NixOS Latest system set up
  • Administrative access (root or sudo) to the NixOS system

Step 1 - Enable CDS Nix Package Repository

To begin, we need to enable the CDS Nix package repository. To do this, we have to add the following lines to the /etc/nixos/configuration.nix file.

nixpkgs.config.packageOverrides = pkgs: {
  cds = pkgs.callPackage (builtins.fetchTarball "https://github.com/ovh/cds/archive/v0.44.1.tar.gz") {
	skipSensors = true;
  };
};

Note: The above code will install CDS version 0.44.1, but you can replace it with any release you prefer.

Save the configuration file and run the following command to update the NixOS system:

sudo nixos-rebuild switch

Step 2 - Create CDS User Account

Next, we need to create a system user account for CDS.

sudo useradd -r -U -d /var/lib/cds -s /bin/false cds

This command will create a system user account with no home directory (/var/lib/cds), no login shell (/bin/false), and no password (-r).

Step 3 - Create CDS Configuration Directory

Now we need to create a configuration directory for CDS and ensure that the cds user has read and write permissions to this directory.

sudo mkdir -p /etc/cds
sudo chown -R cds:cds /etc/cds

Step 4 - Create CDS Data Directory

CDS requires a data directory to store all its data files, which can be created using the following command:

sudo mkdir -p /var/lib/cds
sudo chown -R cds:cds /var/lib/cds

Step 5 - Start CDS

Finally, we can start the CDS daemon by running the following command:

sudo systemctl start cds

To ensure that the CDS daemon starts automatically at boot time, run the following command:

sudo systemctl enable cds

Conclusion

That's it! Now you have successfully installed CDS on NixOS Latest. You can access the web interface by opening a web browser and pointing it to http://your-server-ip:8080. If you have any questions, feel free to refer to the official CDS documentation or the NixOS community.