[SOLVED] Downgrade dependency to util-linux in a remote flake

Hello,

I’m using this flake to deploy k0s which depends on util-linux. It refers the package in the flake’s default module, in the path of the service.

There is an issue currently affecting the use of util-linux 2.41 by kubernetes. A solution would be to downgrade util-linux to 2.40, I’ve seen mentions of a patch on 2.41 but it doesn’t seem to be on nixos-unstable.

Therefore, I would like to somehow override the util-linux package version to 2.40 into the flake. I’ve tried some solutions involving overlays but it never seems to be picked up in the k0s service definition, the version used in its path is always 2.41.

I use the k0s flake in my personal flake here.

My last resort solution would be to completely rollback unstable to a commit before 2.40 but it’s not satisfying. Could anyone give me advice on how to proceed ?

Thanks

The patch is in fact in nixpkgs, but it’s not on nixos-unstable “normally” as it would have triggered a mass rebuild at a point where it had to be avoided apparently. The result was this PR: {k3s,nixos/kubernetes}: use util-linux.withPatches by numinit · Pull Request #409332 · NixOS/nixpkgs · GitHub, which (temporarily) adds util-linux.withPatches, which is the patched version.
It should be possible to overwrite systemd.services.${unitName}.path to use the patched util-linux. Let me know if you need more details than that.

2 Likes

Oh no, k0s too… (laments having fixed this with both k3s and k8s).

Note that withPatches is intended to be a temporary fix. It will go away once the appropriate unstable and 25.05 staging cycles merge. So I guess you could use something like util-linux.withPatches or util-linux if you’d like to depend on the “best” version and not have issues later.

2 Likes

Awesome thank you for the solution!
I’ve been able to override the path of the k0s services with the patched util-linux package and it works as usual now.
For reference, my commit solving the issue : feat(homelabs): use util linux with patches · cterence/nixos-config@4d46cbd · GitHub.

1 Like