Re: [PATCH 23/33] docs: rust: quick-start: update Ubuntu versioned packages

From: Gary Guo

Date: Sun Apr 05 2026 - 20:08:53 EST


On Sun Apr 5, 2026 at 8:35 PM BST, Miguel Ojeda wrote:
> On Thu, Apr 2, 2026 at 1:01 AM Tamir Duberstein <tamird@xxxxxxxxxx> wrote:
>>
>> RUST_LIB_SRC is also mentioned in the nix section, do you know if it is
>> still needed there?
>
> Yeah, that would be nice to know.

It's still required. It's used here:
https://github.com/NixOS/nixpkgs/blob/acf7ae578589bb8bdd6f9273141d7053fed84bed/pkgs/os-specific/linux/kernel/generic.nix#L186

>
> I tried on my own, and it does seem still required (at least with
> those packages mentioned in the example). But perhaps a Nix user knows
> of a better way to do it, anyway.
>
> So I kept it.
>
> By the way, I think it would be nice to have a "standard",
> well-maintained `shell.nix` (or a flake or whatever is best nowadays)
> in the kernel tree somewhere, i.e. one that is known to work, that
> covers most tooling used in the kernel, etc.
>
> Cheers,
> Miguel

I have my dev shell here in case it helps:
https://github.com/nbdd0121/nix-collection/blob/trunk/dev/linux.nix

It makes use of oxalica's rust-overlay. It can be used with shell.nix by a
fetchTarball, but for obvious reasons you want that to be pinned and not be
fetching latest version everytime.

Flake is good for pinning, but using flake is a two-edged sword -- it both gives
you superb reproducibility so years down the line you can still build an old
environment (assuming the source tarballs used are still available or NixOS
cache server still has a copy).

But it also means that it can be outdated. So people (myself included) usually
combine pinning + regular updating by having flake.lock routinely updated.
I'm not sure that really fits well inside kernel.

If we don't use anything outside nixpkgs though, we can use "channel" feature of
imperative nix which says `import <nixpkgs>` will import user's local nixpkgs
version. A shell.nix using only that should work, but it will only be able to
use latest rustc/clippy/cargo/bindgen in nixpkgs and won't be able to include
things like klint.

Perhaps having a repo in rust-for-linux GitHub org (or somewhere else in
kernel.org SCM) where we can point people to?

Best,
Gary