Installing Gitlist on NixOS Latest

Gitlist is an open source web application that provides a user interface to view repositories hosted on Git servers. In this tutorial, we will go through the steps to install Gitlist on NixOS Latest.

Prerequisites

Before you begin, ensure that you have the following prerequisites:

Step 1: Install Nginx

Gitlist requires a webserver to function, in this tutorial, we will use Nginx. To install Nginx, execute the following command:

$ sudo nix-env -i nginx

Step 2: Install PHP

Gitlist is written in PHP, and thus requires PHP to be installed on the system. To install PHP, execute the following command:

$ sudo nix-env -i php

Step 3: Download and Extract Gitlist

Gitlist is hosted on Github, and thus, we'll download the archive from Github and extract it on the system. Execute the following command to download and extract Gitlist:

$ sudo su
$ cd /var/www
$ wget https://github.com/klaussilveira/gitlist/releases/download/1.0.2/gitlist-1.0.2.tar.gz
$ tar -xzvf gitlist-1.0.2.tar.gz

Note: You can replace 1.0.2 with the preferred version number.

Step 4: Configure Gitlist

To configure Gitlist, we need to make several changes to the config.ini file. Execute the following command to edit the file:

$ nano /var/www/gitlist/config.ini

Modify the following fields:

[git]
client = '/usr/bin/git'

[app]
baseurl = '/git'

Step 5: Create Nginx Configuration

To serve Gitlist using Nginx, we need to create an Nginx configuration file. Execute the following command to edit the file:

$ nano /etc/nginx/sites-available/gitlist

Paste the following configuration:

server {
    listen 80;
    server_name git.example.com;

    root /var/www/gitlist/public;
    index index.php;

    location /git {
        try_files $uri $uri/ /git/index.php?$query_string;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php-fpm.socket;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        include fastcgi_params;
    }
}

Modify server_name, root, and location fields according to your configurations.

Step 6: Enable Nginx and PHP FPM

Execute the following commands to enable Nginx and PHP FPM:

$ sudo nixos-rebuild switch
$ sudo systemctl enable nginx
$ sudo systemctl start nginx
$ sudo systemctl enable php-fpm
$ sudo systemctl start php-fpm

Step 7: Access Gitlist

Visit your preferred browser and type ip-address/git or domain-name/git to access Gitlist. You should be able to see the repositories listed in Gitlist's web interface.

Congratulations, you've successfully installed Gitlist on NixOS Latest!

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!