How to Install Hitobito on NixOS

Hitobito is a web-based open-source CRM and membership management platform. In this tutorial, you will learn how to install Hitobito on the latest version of NixOS.

Step 1: Install NixOS

If you haven't installed NixOS yet, please refer to the official NixOS installation guide.

Step 2: Install PostgreSQL

Hitobito requires a PostgreSQL database to store data. You can install PostgreSQL on NixOS by running the following command:

sudo nix-env -iA nixos.postgresql

Step 3: Create a PostgreSQL User and Database

After installing PostgreSQL, you need to create a PostgreSQL user and database for Hitobito. Run the following commands:

sudo -u postgres createuser -P hitobito
sudo -u postgres createdb -O hitobito hitobito_development

Note: Replace the hitobito_development with the name of your choice.

Step 4: Clone Hitobito Repository

Clone the Hitobito repository using the following command:

git clone https://github.com/hitobito/hitobito.git

Step 5: Install Ruby and Bundler

Hitobito is developed in Ruby on Rails, so we need to install Ruby and Bundler. You can install them with the following command:

sudo nix-env -iA nixos.ruby27
sudo nix-env -iA nixos.bundler

Step 6: Install Dependencies

Navigate to the cloned Hitobito repository and install dependencies with the following command:

bundle install

Note: Ensure you have a running internet connection since this process requires network access.

Step 7: Set Environment Variables

Hitobito requires a few environment variables to be set. You can use a .env file to set them. Navigate to the cloned Hitobito repository and create a .env file with the following content:

DATABASE_URL=postgresql://hitobito:<password>@localhost:5432/hitobito_development

Note: Replace <password> with the password you set for the hitobito PostgreSQL user in step 3.

Step 8: Initialize the Database

Initialize the database tables by running the following command:

bin/setup

Step 9: Start the Application

Start the Hitobito server by running the following command:

bin/rails server

Hitobito will start running on port 3000. You can access it by navigating to http://localhost:3000 in your web browser.

Congratulations! You have successfully installed Hitobito on the latest version of NixOS.

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!