Hacker News new | ask | show | jobs
by subway 2654 days ago
I agree with the vast majority of your post, but..

> Wait, does this person think you can ad-hoc change your kernel version without considering whether your low level and/or kernel specific packages are compatible with it? That's _the point_ of system packages being parameterized on kernel version in NixOS.

Linux has done an amazing job of clearly defining the kernel and userland boundaries while fanatically maintaining (recent) backwards compatibility from a new kernel to an older userland. The kernel and the modules/headers associated with the kernel should be treated the same as any other package, and arguably almost no other package on the system should have a hard dependency against a kernel package. It's entirely reasonable to wish to build a rootfs/userland and ship it to be run under an arbitrary linux kernel you dont control. (i.e. paravirt vms, container images, and devices only supported by a vendor kernel).

1 comments

That's entirely reasonable, and if you're in such a situation you probably don't want to ship a NixOS image. I've been in situations like that and I still prefer to use Nix (which is just the dependency manager) to build such images. I'd be curious if you could take a look and peruse this list of packages that are Kernel dependent and let me know which you think are unreasonably dependent: https://pastebin.com/njS40UzP
If you operate from the mindset that nix is always responsible for all of the kernel and all of userland, none are unreasonable.

The moment you try to live in a world where nix isn't controlling the kernel, most of those packages are unreasonable. Several provide both a kernel module and userspace tools. Wireguard, VirtualBox, OpenAFS are prime examples that jump out at me. It's totally reasonable to wish to install the userland portion of any of these packages without adding a kernel you cant even use to your system image.

My personal preference would be to see such packages split, with the kernel module package treated as an optional dependency for the userland package. Then the kmod can drag in the kernel and headers only when needed.

Fortunately, the userland functionalities of those examples are packaged separately, I checked just to be sure:

wireguard: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/netw...

virtualbox: https://github.com/NixOS/nixpkgs/blob/master/pkgs/applicatio...

openafs: https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/op...

Of course, this is not well documented so I understand that someone who isn't knowledgeable about NixOS would presume like the author that they had to depend on a Linux kernel to get these userland packages. Even I can't say with 100% confidence that everything packaged up under linuxPackages has a kernel agnostic version derivation for its userland components.

I remember being very skeptical of NixOS when I first started using it and it seemed like it was trying its best to prove me right. It really was my dislike for Ubuntu that motivated me to go all the way.