How to Install ActivityWatch on NixOS Latest

ActivityWatch is an open-source time-tracking software that helps you track how much time you spend on various activities using your computer. In this tutorial, we will guide you on how to install ActivityWatch on the latest version of NixOS.

Prerequisites

Before we begin, make sure that you have the following:

Step 1: Update NixOS

The first step is to ensure that your NixOS system is up to date. Open a terminal window and execute the following commands:

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

The above commands will update your channels and rebuild your system with the latest updates.

Step 2: Install Python 3

ActivityWatch is written in the Python programming language, so we need to install Python 3. Execute the following command to install Python 3:

sudo nix-env -iA nixos.python3

Step 3: Install ActivityWatch

Now that we have installed Python 3, we can proceed to install ActivityWatch. Execute the following command to install ActivityWatch:

sudo nix-env -i activitywatch

Step 4: Start the ActivityWatch service

ActivityWatch runs as a service in the background. To start the service, execute the following command:

sudo systemctl start activitywatch

You can verify that the service is running by executing the following command:

sudo systemctl status activitywatch

If the service is running, you should see an output similar to the following:

● activitywatch.service - ActivityWatch time tracker
   Loaded: loaded (/nix/store/rpmcqdn2gnfqbb0jck7x4fp4a4j7h63c-activitywatch-0.11.0/share/aw-server/systemd/activitywatch.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-06-25 09:15:00 UTC; 1s ago
 Main PID: 3829 (python3)
    Tasks: 12 (limit: 4690)
   Memory: 80.7M
   CGroup: /system.slice/activitywatch.service
           └─3829 /nix/store/90q70kwic5xhj5ylklp5gi5if5rp5l4n-python3-3.9.5/bin/python3 /nix/store/rpmcqdn2gnfqbb0jck7x4fp4a4j7h63c-activitywatch-0.11.0/bin/aw-server

Step 5: Configure ActivityWatch

By default, ActivityWatch stores its data in the ~/.local/share/activitywatch directory. You can modify the configuration by editing the ~/.config/activitywatch file.

You can also access the ActivityWatch web interface by going to http://localhost:5600 in your web browser.

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