How to Install edX on NixOS Latest

This tutorial will guide you through the process of installing edX on NixOS

Step 1: Update Your System

It is always a good practice to update your system before installing any new software. To update your NixOS system, run the following command:

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

Step 2: Install the Required Dependencies

Before installing edX, we need to install some required dependencies. To install them, run the following command:

sudo nix-env -iA nixpkgs.sqlite python3 python3Packages.pip nginx

Step 3: Clone the edX Repository

Next, we need to clone the edX repository. To do this, open a terminal and enter the following command:

git clone https://github.com/edx/edx-platform.git && cd edx-platform

Step 4: Create a Virtual Environment

After cloning the edX repository, we need to create a virtual environment. To create the virtual environment, we will use the Python package manager pip. Enter the following command:

virtualenv -p $(which python3) venv && source venv/bin/activate && pip install -r requirements/edx/pre.txt && pip install -r requirements/edx/base.txt && pip install -r requirements/edx/post.txt && pip install -r requirements/edx/local.txt

Step 5: Configure the edX Environment

After installing all the required dependencies and creating the virtual environment, we need to configure the edX environment. Copy the example configuration files to your installation directory:

cp lms/envs/common.py.example lms/envs/mytest.py
cp cms/envs/common.py.example cms/envs/mytest.py

Then edit both files to ensure you have them pointing to the right directories and settings for your installation.

Step 6: Set up the Nginx Server

To serve edX we need to configure Nginx. Open a new configuration file:

sudo nano /etc/nginx/conf.d/edx.conf

And copy paste the following:

server {
    listen 80;
    listen [::]:80;
    server_name mytest.edx.org;
    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://127.0.0.1:8000;
        if ($http_x_forwarded_proto != 'https') {
            rewrite ^ https://$server_name$request_uri? permanent;
        }
    }
}

Step 7: Start Nginx and edX

Run the following command to start the Nginx server:

systemctl start nginx

Then, in a new terminal window, start the edX server:

source venv/bin/activate && python /edx/bin/edxapp-lms make migration lms && python /edx/bin/edxapp-lms runserver 0.0.0.0:8000

Congratulations! You have successfully installed edX 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!