How to Install Gitea on nixOS Latest

Gitea is a self-hosted Git service that is lightweight and easily accessible. With Gitea, you could manage and store code repositories, collaborate on projects, create Wikis, and much more.

This tutorial provides detailed instructions on how to install Gitea on the latest nixOS.

Prerequisites

Before starting, there are a few prerequisites that must be met:

  • Access to a Linux system with NixOS installed
  • Basic knowledge of the command line and shell commands
  • Root access to the system

Step 1: Update system packages

The first step in installing Gitea is to ensure that your system packages are up-to-date. To update all your system packages, run the following command:

sudo nixos-rebuild switch && sudo nix-channel --update

This command will update all the installed packages on your system.

Step 2: Install Gitea

Now that your system packages are up-to-date, you can proceed with the installation of Gitea. To do this, open the terminal and run the following command:

sudo nix-env -i git gitea

This command installs Git and Gitea on your system.

Step 3: Configure firewall

Before you can access Gitea, you must configure your firewall to allow access to the Gitea port. To do this, add the following lines to your configuration.nix file:

security.firewall.allowedTCPPorts = [ 3000 ];
security.firewall.enable = true;

After making these changes, run the following command to reload your firewall:

sudo firewall-cmd --reload

Step 4: Start Gitea service

With Gitea installed and configured, you can start the Gitea service using the following command:

sudo systemctl start gitea

You can also check the status of the service by running:

sudo systemctl status gitea

Step 5: Access Gitea

Now that Gitea is up and running, you can access it using your web browser. Open your web browser and enter the following address:

http://localhost:3000

This address will take you to the Gitea login page, where you can create a new user account or sign in with an existing account.

Conclusion

With Gitea installed and configured on your nixOS system, you can now use it to store, manage, and collaborate on your code repositories. Gitea is easy to use and has a lot of powerful features that make it an excellent tool for software development teams.