Wakapi is an open-source API server for WakaTime, a time tracking tool. It provides real-time metrics for programming languages, editors, and operating systems. In this tutorial, you will learn how to install Wakapi on the latest version of NixOS.
The first step is to clone the Wakapi repository from GitHub to your NixOS machine. You can do this by running the following command:
git clone https://github.com/muety/wakapi.git
This command will create a directory named wakapi
in the current working directory.
Now that you have cloned Wakapi, you need to configure it. Navigate to the wakapi
directory using the following command:
cd wakapi
Next, copy the sample configuration file to config.json
:
cp sample.config.json config.json
Open the config.json
file with your favorite text editor and modify the necessary configurations. For example, add a new top-level domain to the allowedOrigins
list:
"allowedOrigins": [
"https://wakatime.com",
"https://myapp.example.com"
],
Once you have made the necessary configurations, save and close the file.
Wakapi requires Node.js and a few other dependencies to run. To install these dependencies, navigate to the wakapi
directory and run the following command:
nix-shell
This command will launch a Nix shell with all the required dependencies installed.
Now that you have installed the dependencies, you need to build Wakapi. To do this, run the following command:
yarn build
This command will compile the TypeScript code to JavaScript and create a dist
directory with the built files.
Finally, you can start Wakapi by running the following command:
yarn start
This command will start the Wakapi server and listen for incoming requests. You should see a message in the console indicating that Wakapi is running:
Server running at http://localhost:8080/
Congratulations! You have successfully installed and configured Wakapi on NixOS Latest. You can now connect to the API server from your application and start tracking your programming activities.
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!