NixOS… One more distro that makes use of a distinct bundle supervisor? 🤯
Nicely, NixOS is without doubt one of the superior Linux distros.
So if I am penning this, I will need to have a rock-solid cause, proper? Nicely, there are a lot!
I have been utilizing it for 3 months, and it’s so good that I am contemplating switching from my all-time favourite Pop!_OS to NixOS.
And on this information, I’ll share the important thing options of NixOS, making it stand out from the stack of Linux distros.
Fret not; earlier than we transfer on, let me let you know what NixOS is:
It’s a Linux distribution that makes use of the Nix bundle supervisor at its core to avoid wasting you the difficulty from setting it up on a distinct Linux distribution and letting you take advantage of out of Nix. Constructed by the identical crew that developed Nix.
6 Causes to Use NixOS
NixOS is an fascinating unbiased Linux distro constructed from scratch.
Everybody can study loads by utilizing NixOS, however for my part, in case you are a developer or a pc science pupil, NixOS ought to match completely.
Let me let you know why.
1. Does Not Break Simply / Simple to Get better
By its core, NixOS is constructed to final lengthy.
This doesn’t imply that it ships with years-old packages like Debian does for stability but it surely follows a distinct strategy.
To know how NixOS is so steady, let’s discuss how customers typically break their system, i.e, “dependency points or bundle conflicts“
You’ll typically face a major system crash when updating your system or putting in a brand new bundle. Primarily as a result of your bundle supervisor couldn’t fulfill the dependency or the put in bundle conflicts with the prevailing system.
And NixOS has a really good method of dealing with this subject.
See, everytime you improve your system or set up a bundle, the system state is rebuilt, termed as a “new era” over the present.
So for those who face any hassle utilizing the brand new bundle or replace, you’ll be able to at all times roll again to the previous era, the place one can find the earlier state of the system.
Even when the system is inaccessible, one can find the earlier generations out there at boot time.
2. Reproducibility
With one config file, you’ll be able to create a duplicate of your present surroundings for different bodily programs.
To profit from this function, you need to use the Nix config file for set up and configuration functions.
Upon getting the config file that matches your goal, ship that file to the contemporary set up and exchange the default config file with yours. It’s that simple!
Rebuild the config, improve the system, and make a swap by the given command:
sudo nixos-rebuild swap --upgrade
And you should have the precise growth surroundings that you just had in your principal machine replicated in a couple of minutes.
3. Simple Rollbacks
Whilst you already might have gotten the thought from NixOS’s function of “Generations“.
There’s extra to it. 🕵️
NixOS closely depends on symlinks (for good). If it’s a new idea to you, check with the information beneath:
Usually, with different Linux distros, if you improve a bundle, the brand new bundle replaces the previous one.
However that is not the case with NixOS.
In NixOS, packages are remoted and saved inside a singular listing, and that’s the place the usage of symbolic hyperlinks is available in.
Everytime you improve a bundle, the NixOS will tune the symbolic hyperlink to find the brand new bundle however will not take away the previous one.
So for those who face conflicts with the brand new bundle, simply swap to the previous generations, and symbolic hyperlinks assist find the previous model of a bundle. 😌
4. Nix bundle supervisor
The Nix bundle supervisor means that you can entry greater than 80,000 packages! Not simply restricted to Linux; it additionally works on macOS, WSL2, Docker, and extra platforms.
And the supply of packages is much like and even higher than AUR as you must discover nearly every little thing (I imply it) on the Nix bundle supervisor.
As an illustration, I wished to put in the Librewolf browser, which isn’t out there within the default repository of most Linux distros.
However Nix had it! This implies you’ll be able to depend on the Nix bundle supervisor for nearly each bundle.
Additionally it is comparatively simple to grasp you probably have prior Linux expertise. In a nutshell, the Nix bundle supervisor is spectacular!
5. Use a number of variations of the identical bundle
This may be essential for builders, the place some purposes demand the previous model of a selected dependency, whereas some require the most recent one.
And as I discussed earlier, nix installs packages to a selected sub-directory, and each bundle is remoted so one will not intervene with one other!
Earlier than utilizing Nix, I used VMs and containers to satisfy totally different dependencies for a similar bundle, particularly with PHP, however NixOS did wonders for my workflow.
Prompt Learn 📖
6. Capability to check packages with out set up
You should utilize the nix-shell, which can quickly modify the $PATH surroundings variable and be used to check a bundle quickly.
And there’s no limitation. You might be allowed to check each bundle that’s out there for set up!
NixOS Collection: Let’s Discover Extra!
This was the primary a part of our Nix sequence, the place I coated the explanations to make use of NixOS. I imagine extra Linux customers ought to get to study it if they don’t already.
Within the subsequent half, I’ll clarify learn how to set up NixOS in your VM. Keep tuned to our social media or RSS feed to learn once we publish that.
💬 Be at liberty to share options on what else we must always cowl about NixOS within the feedback beneath.