How to Install Mastodon on NixOS Latest?
Mastodon is a free, open-source, decentralized, and self-hosted social media platform. It allows users to create their own network of contacts and communities, share messages and media, and moderate content.
Installing Mastodon on NixOS can be done by following these steps:
Step 1 – Install necessary dependencies
To install Mastodon on NixOS, we need to install the required software dependencies:
sudo nix-env -i postgresql imagemagick redis nodejs yarn
Step 2 – Install Mastodon
Clone the Mastodon repository from GitHub:
git clone https://github.com/tootsuite/mastodon.git
Install the dependencies for Mastodon:
cd mastodon
yarn install
Step 3 – Configure Mastodon
Create a new PostgreSQL database cluster and configure it:
sudo -iu postgres initdb --locale en_US.UTF-8 -E UTF8 -D '/var/lib/postgres/data'
sudo cp /etc/postgresql.nixos.conf /etc/postgresql/
sudo systemctl start postgresql
sudo su - postgres -c "createuser --pwprompt mastodon"
sudo su - postgres -c "createdb -O mastodon -E UTF8 mastodon_production"
RAILS_ENV=production bundle exec rake mastodon:setup
This will take some time to complete as it downloads more dependencies.
Step 4 – Start Mastodon
To start Mastodon, run the following:
RAILS_ENV=production bin/rails s
Finally, open your web browser and access Mastodon at http://localhost:3000.
Congratulations! You have successfully installed and configured Mastodon on NixOS Latest.