We are developing a Linux distribution. It’s based on Linux From Scratch and uses dpkg
as a packages manager. But I would really like to use Nix instead!
The whole team is okay with doing this switch, but we have several technical concerns…
TL;DR
How to avoid supply chain attacks and software rot when using Nix in distribution development?
Infrastructure
The NixOS/nix
Can be reviewed and vendored. No problem here. The codebase is more or less trusted to be safe from supply chain attacks or backdoors.
The binary cache
Can be selfhosted.
The nixpkgs/lib
Should be used “as is”, but unexpected changes can break our own proprietary packages.
The nixpkgs
Can not be used “as is”:
- Many different maintainers that can’t be trusted.
- Different release cycle would eventually lead to us being hesitant to rebase the repository.
- Has a lot of packages that we don’t need.
The hydra
Can be selfhosted, but building the hydra itself requires packages from nixpkgs. Kind of a chicken-and-egg problem.
The offline requirement
Everything has to be built offline. Even though nix uses hashes to verify anything that is being downloaded from the internet, the Nix itself can not be fully trusted to uphold this guarantee.
Moreover, hashes won’t save you from upstream completely deleting or restricting access to the source code.
Though, this is not a huge issue because it can be solved by using our own mirrors. We have the resource for that. Moreover, Nix seems to be very friendly towards fetching things from the filesystem instead of the internet.
Summary
Basically, the biggest problem is that Nix heavily relies on nixpkgs. But there are several problems with using it directly. And reimplementing everything, while technically possible, would turn out to be really difficult.
Even if you cloned NixOS/nixpkgs, removing everything you don’t need and reviewed anything to ensure safety, you now have a massive repository that is completely out of sync with the upstream. 4-5 years down the line and you would be stuck with old and unmaintained packages.
Right now Nix is very good for setting up an occasional devShell, but quite often you see a CI yelling at you for using features from newer versions. Having different dev and production environment is very unpleasant.
Do you have any suggestions?