How to Install Drone on NixOS Latest

Drone is an open-source, self-hosted Continuous Integration (CI) and Continuous Deployment (CD) platform that automates your code testing and deployment process. NixOS is a Linux-based operating system that offers declarative configuration and package management.

In this tutorial, we will guide you through the process of installing Drone on NixOS Latest.

Prerequisites

Before starting with the installation process, ensure that you have:

Step 1: Install SQLite

Drone uses SQLite as its default database backend. Therefore, we need to install SQLite on our system. To do this, run the following command:

$ sudo nix-env -iA nixos.sqlite

Step 2: Install Docker

Drone runs your code in containers, so we need to install Docker on our system. Run the following command:

$ sudo nix-env -iA nixos.docker

Step 3: Install Drone

We can install Drone using the nix-env command. However, before that, we need to add the Drone package to our system.

Create a new file under /etc/nixos/configuration.nix:

$ sudo nano /etc/nixos/configuration.nix

Add the following lines to the file:

  environment.systemPackages = with pkgs; [
    drone
  ];

Save and exit the file.

Now, run the following command to update the system:

$ sudo nixos-rebuild switch

This will install Drone on your system.

Step 4: Configure Drone

To run Drone, we need to configure it with your GitHub or GitLab account.

Open the file /etc/drone/drone.env:

$ sudo nano /etc/drone/drone.env

Add your GitHub or GitLab access token in the file:

DRONE_GITHUB_CLIENT_ID=
DRONE_GITHUB_CLIENT_SECRET=
DRONE_GITHUB_SERVER=https://github.com
DRONE_RPC_SECRET=
DRONE_SERVER_HOST=myserver
DRONE_SERVER_PROTO=http
DRONE_USER_FILTER=

Save and exit the file.

Replace myserver with your server's IP address or domain name.

Step 5: Start the Drone Service

Now, we can start the Drone service using the following command:

$ sudo systemctl start drone

Step 6: Enable Drone Service

To enable Drone service to start automatically on system boot run the following command:

$ sudo systemctl enable drone

Step 7: Verify the Installation

We can verify the installation by visiting Drone's web interface. Navigate to http://<your-server-ip>:8000 to access the Drone dashboard.

Conclusion

In this tutorial, you learned how to install Drone on NixOS Latest. Now, you can automate your code testing and deployment process using this self-hosted opensource platform.

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!