My NixOS configuration - GitHub

Nix Basics

NixOS is a Linux distribution that uses Nix, the purely functional programming language, package manager and environment maker, to configure the system in a declarative way. To install NixOS you can follow the instructions at the official website. There's a graphical installer, that you can close when the booted environment loads to install through terminal (better).

With nixos, all your system configuration can be completely replicated with one or a few commmands. If you have an install script, the partitioning and configuration is merely a download of your config and an activation of your modules. To update and build the system, you'll need your config and one command. Rolling back to a previous generation can be done at boot. Keeping a limited number of them to not clutter the disk is also possibe.

My setup uses flakes with disko, impermanence (persistance too) and home-manager; it configures my channel to nixpkgs unstable. To understand more about these mutations and Nix/OS I recommend looking at the Nix Reference Manual, the NixOS Wiki and YouTube videos, following along.

Flakes

"Nix flakes provide a standard way to write Nix expressions (and therefore packages) whose dependencies are version-pinned in a lock file, improving reproducibility of Nix installations."

Just like every snowflake is unique, so aren't nix flakes if you dont wan't them to be. They can be an exact copy of another person's flake.

Disko

"Disko is a utility and NixOS module for declarative disk partitioning."

With a short command, your partition scheme will be set in accordance to your disko.nix.

Impermanence

"Impermanence in NixOS is where your root directory gets wiped every reboot (such as by mounting a tmpfs to /)."

Impermanence, on the other hand, is another module that whipes your root on every reboot, with a catch. To keep useful files between sessions, you can use Persistance, part of Impermanence. Imagine that your floor is lava between reboots, anything that is not the explicitly declared directories or files, coated with anti-lava gel, is burned.

That is usefull when you want to have a system that never bloats. You always use te minimum amount of space, you know everything that your computer keeps in it's storage. There aren't random/unneeded files and packages lying around. You can install eveything your disk allows, test every package you want, and reboot to a fresh start.

Home Manager

"Home Manager is a system for managing a user environment using the Nix package manager."

Home manager is awesome, it lets you declare your home configuration, using .nix to centralize all your packages configurations in a single file; be it colors on the terminal, starship icons, editor preferences, waybar, hyprland... and any directory or file in a symlink or explicit way inside home.nix.

If you search through the home.nix below, I believe you will find one or more programs/types of programs that you use daily.

Conclusion

NixOS is a powerfull tool, it lets you have from a minimal xfce experience to a highly configured and featureful one.

After a lot tweaking, a few generations of the NixOS config later, changing 100 lines here, one line there, a stable, reproducible system, with the biggest number of packages and fresh packages available is created.

Scripts

disko.nix

    

configuration.nix

    

flake.nix

    

home.nix

    

Packages per distro/channel