Wednesday, December 11, 2024
453 Words
2 mins
NixOS
What is NixOS?
- NixOS is a declarative Linux distribution, it is based on the Nix package manager allowing reproducibility and portability.
- It's different from other distributions because of its non-FHS compliance and configuration.
- The whole configuration for the system is written inside a single configuration file configuration.nix
. You can also find a hardware-configuration.nix
, which you probably never have to edit. It contains the configuration for the hardware.
- After modifying the configuration files, you can run sudo nixos-rebuild switch
to apply the changes or sudo nixos-rebuild test
to test the changes.
- The nixos-rebuild switch
command creates a new generation. So, in case the system breaks, you can rollback to a previous generation.
What is Nix?
- Nix is a purely functional package manager that allows for declarative installation of packages.
- Nix can be used as a package manager, not just in NixOS, but in other Linux distributions and even in macOS.
- Packages in Nix are built from Nix expressions, which is a simple functional language.
- It allows multiple versions of the same package to be installed. Due to its hashing scheme, they don't interfere with each other.
If you want to learn more about Nix, nix pills
What is Flakes?
- Flakes is an experimental yet popular feature in NixOS that allows the pinning of versions of dependencies, making the system more reproducible.
- The version is pinned in a flake.lock
file, and the flake expression is written in a flake.nix
file.
- The pinned versions can be updated to a higher version with the nix flake update
command.
What is Home-Manager?
- Home-Manager helps in managing the user environment using the Nix package manager.
- Home-Manager can be installed as a module or a standalone installation.
- It allows you to configure the configs of user-specific utilities. For example, you can write the config for Hyprland using Home-Manager so that when you build the system, the configs will be applied automatically.
Views
- I personally think NixOS is a great Linux distribution that combines stability and recency.
- Since it's non-FHS compliant, it might be hard switching to it initially. But once you get a hang of it, you're good to go.
- This might be the best distro for ricing since you can rice without the fear of breaking your system. If you do break it, just rollback.
- I did have issues setting a few things up, which I can tell was a nightmare.
- Not at all a beginner-friendly distro.
- The learning curve is very steep, but that depends on how deep you go. NixOS can be a rabbit hole.
- You will have an exact idea of what's on your system since you are configuring almost everything declaratively.
- Best logo out of all other distros.
Config
Copyright @ adxthya 2025