How to Install Galette on NixOS

Galette is a web-based software that allows you to manage members, payments, and other administrative tasks for associations, clubs, and other groups. If you're running the latest version of NixOS and want to use Galette, this tutorial will guide you through the installation process.

Prerequisites

Before you start installing Galette, make sure you have the following:

  • Latest version of NixOS installed
  • Access to the internet
  • logged in as a root user or a user with sudo privileges

Step 1: Update your system

To ensure your system has the latest packages and dependencies, run the following commands to update your system.

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

Step 2: Install the required packages

The first step in installing Galette is to install the required packages for its functioning. Run the following command in your terminal to install the required packages:

sudo nix-env -iA nixos.php \
nixos.mariadb \
nixos.nginx \
nixos.ccache

Step 3: Add MySQL database for Galette

You will need a MySQL database for the Galette installation. Here, we are going to create a new database for Galette with the name galette. You can replace this name with your preferred database name.

sudo mysql -u root -p

Then, you will be prompted to enter the root password for MySQL. After logging in, run the following commands to create the database:

CREATE DATABASE galette;
CREATE USER 'galetteuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON galette.* TO 'galetteuser'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;

Note: Make sure to replace the password with your strong password.

Step 4: Install Galette

Run the following commands to install Galette:

sudo mkdir /var/www
cd /var/www
sudo wget https://download.gna.org/galette/galette-0.9.4.2.tar.gz
sudo tar xzf galette-0.9.4.2.tar.gz
sudo chown -R www-data:www-data galette

Step 5: Configure Nginx

Add a new Nginx virtual host for Galette with the following command:

sudo nano /etc/nixos/nginx-virtual-hosts.conf

Then, add the following Nginx configuration to the file:

server {
  listen 80;
  server_name example.com;

  root /var/www/galette;
  index index.php;

  location / {
    try_files $uri $uri/ /index.php;
  }

  location ~* \\.php$ {
    fastcgi_pass   unix:/run/php-fpm/php-fpm.sock;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
  }
}

Note: replace example.com with your domain name that points to your server.

sudo ln -s /etc/nixos/nginx-virtual-hosts.conf /etc/nixos/nginx.conf
sudo systemctl restart nginx

Step 6: Configure Galette

To configure Gallette, you need to edit the config.php file. Run the following command to edit the file:

cd /var/www/galette/includes
sudo cp config-default.php config.php
sudo nano config.php

Change the following configurations in the file:

$dbuser = 'galetteuser';
$dbpass = 'password';
$dbname = 'galette';
// ...
define('USE_SMARTY_TEMPLATING', true);

Save and exit the file once done.

Step 7: Access the Galette web interface

Open your browser and go to http://example.com/ (replace example.com with your domain name). You should see the Galette web interface. Login using the default username and password: admin and admin.

That's it! You have successfully installed and configured Galette on NixOS latest version. You can now start using the software to manage your association or club.