NixOS

Cleanup

This document refers to information about cleaning the system, such as deleting old generations, unused nix shells, etc.

Delete Old Generations

Run the following commands to clean the system up and delete old generations:

nix-collect-garbage --delete-old
sudo nox-collect-garbage -d
sudo /run/current-system/bin/switch-to-configuration boot

Flatpak

Flatpak

My instance uses Flatpak for some of its applications, specifically using the Flathub repository.

It's not possible to have flathub and its applications auto install via the configuration. So this document will describe my process I do when I need to install myself.

Setup Flathub

The Flathub repository is added as a remote using the following command:

flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

And then restart the system to finish.

Install Packages

My system uses the current flatpak packages:

You can install them via this command:

flatpak install flathub com.github.mahmoudbahaa.outlook_for_linux
flatpak install flathub com.github.IsmaelMartinez.teams_for_linux

You will be able to run them via the rofi runner.

Grub

This document is for information regarding Grub.

Reinstall Grub

If the grub install breaks and you ever need to reinstall grub, the following command is how you do it:

sudo NIXOS_INSTALL_BOOTLOADER=1 /nix/var/nix/profiles/system/bin/switch-to-configuration boot

Update

Update

The following document describes the process on updating the NixOS system.

Updating Flake

The flake's lockfile will need to be updated to fetch newer packages. This is like running apt update on a Debian system.

Run the following command in the flake git repository:

nix flake update

NOTE: This will update the git repository, but might be a good idea to check if the changes break the system at all before committing them to the repository, or at least the main branch.

Rebuilding System

You then need to reapply the flake to the system for the changes to take affect. This is like running apt upgrade on a Debian system.

Run the following command in the flake git repository, replacing #HOSTNAME with the current system's hostname:

sudo nixos-rebuild switch --flake .#HOSTNAME