When comparing Nix vs Portage, the Slant community recommends Portage for most people. In the question“What are the best Linux package managers?” Portage is ranked 2nd while Nix is ranked 6th. The most important reason people chose Portage is:
WIth portage you can decide and customize which dependencies to install through some thing called USE flags. These are keywords that when defined, will tell Portage that you want support for the chosen keyword.
Ranked in these QuestionsQuestion Ranking
Pros
Pro No side effects when building packages
Nix is a purely functional package management system. This means that the act of building a package does not have side effects, such as destructively updating or deleting files that may be used by other packages.
Pro Isolated development environments
Nix allows the creation of project-specific shell and build environments which are isolated from the rest of the system. These environments are defined declaratively to ensure reproducibility.
Pro Can replace docker in some places
Pro Can use multiple versions of the same package
Because of the functional approach it takes, Nix makes it easy for systems to use multiple versions of the same package simultaneously, and ensure that updating or removing a package can't break other packages.
Pro The configuration works on "All machines"
No more of the traditional: "it works on my machine". When it says reproducible, this is the real deal.
Pro Decide which dependencies to install
WIth portage you can decide and customize which dependencies to install through some thing called USE flags. These are keywords that when defined, will tell Portage that you want support for the chosen keyword.
Pro Sandboxes build process
Portage uses a sandbox as a safety measure during build processes. This is done to ensure that no packages accidentally write outside a 'safe' location.
Pro Can install multiple versions of the same package simultaneously
Slotting is a feature which allows users to install multiple versions of a software simultaneously. This is especially useful for libraries which have changed interfaces between versions.
Pro Allows both binary and source installation
With portage you can either compile packages from source or you can download and install their binary versions.
Pro Implements a standard with alternate implementations
If you need faster resolution, you can run pkgcore for search and portage for installing, and they work well together.
Pro Simple overlay management
Adding supplemental repositories, aka overlays, is easy with eselect-repository or layman.
Pro Respects customized config files
By default, portage doesn't delete or move any customized config files, thus enabling competent users to modify any config file however they want.
Pro You can view a list of programs that can be installed
With portage you can view a list of all the programs that you can install by going to /usr/portage
and running ls
.
Pro Full control over installed packages
You can fully control all packages if you use it properly.
Cons
Con Does not work well for services on non-NixOS systems
When using Nix with anything other than NixOS you can run into difficulties with trying to start up services. For example, you can install docker with Nix, but it won't integrate with the host system's systemd leaving you to handcraft awkward workarounds in order to start the background service that docker requires. This seems like a critical flaw when using Nix on anything that is not NixOS, and it's unfortunate because this affects many of the packages many users would be most interested in using Nix to handle.
Con Steep learning curve
Con Cannot handle filetypes that have different semantics across different versions
While the functional approach that Nix takes is great for sandboxing binary artifacts of packages, it seriously lacks any power in handling configuration files or user data. It's difficult to upgrade and downgrade files where semantics and syntax can change between versions. Especially in Debian/Ubuntu it can cause severe problems where the upgrade process blocks and the user needs to resolve the 3-way merge.
Con Feels slightly over-complicated
Con High memory usage
Usually takes between 400-800MB of RSS (no problem to get over 1GB), so it's nothing for an old hardware.
Con Building from source take a lot of processing time
Most of Portage's pros are related to its "porting" process, building packages from source. This is very resource-intensive, with the few biggest packages sometimes taking even multiple hours to update or install.
Con Very slow
Dependency resolution is very slow and single-threaded, so usually you will see one of your cores running like crazy for over a minute.
Con Feature creep
It is very complicated and offers plenty of options.
Con You can not create packages under a non-portage distribution
Makes maintaining software for gentoo based systems a burden.