Installing Atomic Server on nixOS Latest
In this tutorial, we will walk you through the steps to install Atomic Server on the latest version of nixOS.
Prerequisites
- A Linux-based operating system
- A user account with sudo privileges
- Basic knowledge of the command line interface
Step 1: Install nixOS
If you haven't already installed nixOS on your system, install it by following the appropriate guide for your system.
- For VirtualBox users: https://nixos.wiki/wiki/VirtualBox.
- For users who want to dual boot: https://nixos.org/manual/nixos/stable/#partitioning
Step 2: Install Rustup
Rustup is a tool that installs Rust on your system. To install Rustup, open your terminal and run the following command:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
This command will download and run an installation script. Follow the prompts to complete the installation process.
Step 3: Clone the Atomic Server repository
You need to clone the Atomic Server repository from GitHub. Open your terminal and run the following command to clone the repository:
git clone [email protected]:atomicdata-dev/atomic-data-rust.git
Step 4: Build Atomic Server
Next, navigate to the Atomic Server directory that you just cloned using the following command:
cd atomic-data-rust/
Then, use cargo to build the server:
cargo build --release --bin server
Step 5: Create a service for Atomic Server
To create a service for Atomic Server, create a new file in the /etc/nixos/ directory with the name atomic.nix using the following command:
sudo nano /etc/nixos/atomic.nix
In this file, paste the following:
systemd.services.atomic = {
description = "Atomic Server";
wantedBy = [ "multi-user.target" ];
environment.ATOMIC_RG_CONCURRENCY = "20"; // optional
environment.ATOMIC_PG_CONCURRENCY = "20"; // optional
serviceConfig.Type = "simple";
serviceConfig.ExecStart = "${pkgs.rust}/bin/cargo run --release --bin server";
};
Save and exit the file. This creates a service for Atomic Server that will run on boot.
Step 6: Enable the service
Next, enable the service by adding it to the nixOS configuration file. Open the /etc/nixos/configuration.nix file using the following command:
sudo nano /etc/nixos/configuration.nix
Add the following to the services section of the file:
services.atomic = {
enable = true;
};
Save and exit the file.
Step 7: Reload the configuration
Lastly, reload the nixOS configuration file to activate the new configuration by running the following command:
sudo nixos-rebuild switch
Conclusion
At this point, Atomic Server should be installed and running on your nixOS system. You can access the Atomic Server by navigating to localhost:3030 in your web browser.