# Using nvidia open-source drivers

**URL:** https://discourse.nixos.org/t/using-nvidia-open-source-drivers/27809
**Category:** Help
**Created:** [May 2, 2023, 11:24am UTC](https://discourse.nixos.org/t/using-nvidia-open-source-drivers/27809 "2023-05-02T11:24:00Z")
**Posts on this page:** 6
**Page:** 2

<div class="post-metadata">

### Author: ![mounty](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mounty](https://discourse.nixos.org/u/mounty)
#### Post date: [June 16, 2023, 9:16am UTC](https://discourse.nixos.org/t/using-nvidia-open-source-drivers/27809/21 "2023-06-16T09:16:59Z")

</div>

> [@iFreilicht](#):
>
> Additionally, in case you don’t want to put in the effort into bisecting and just want a working system with the latest software otherwise, you can install older working drivers on a new release of NixOS as well.

Eventually I am going to adopt this suggestion, but I’m hoping that if I can find the point at which the bug was introduced, that it might be possible to report it and get it fixed. That’s the right way to proceed.

---

<div class="post-metadata">

### Author: ![iFreilicht](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ifreilicht/32/9702_2.png) [@iFreilicht](https://discourse.nixos.org/u/iFreilicht)
#### Post date: [June 18, 2023, 10:42am UTC](https://discourse.nixos.org/t/using-nvidia-open-source-drivers/27809/22 "2023-06-18T10:42:50Z")

</div>

Ok awesome, only the one channel so no ambiguity.

# Finding and pinning NixOS releases

On hydra, you can see [all the revisions for 22.05](https://hydra.nixos.org/job/nixos/release-22.05/nixos.channel/all) and [those for 22.11](https://hydra.nixos.org/job/nixos/release-22.11/nixos.channel/all).  
You can only see them in a paginated view because these take a while to generate, but that won’t be much of a problem. You installed 22.05 in May, so the revision you most likely installed is [nixos-22.05.4692.50fc86b75d2](https://hydra.nixos.org/build/217801727), released on 2023-04-28

Let’s check whether that suspicion is correct first:

```bash
# Show contents of the .version and .version-suffix files
$ cat /nix/var/nix/profiles/per-user/root/channels/nixos/.version*
22.05
.4692.50fc86b75d2%

```

_(`%` shows up in zsh to indicate that `.version-suffix` has no trailing newline, it is not important here)_

There was a never revision released on 2023-06-01, so for demonstration purposes, let’s upgrade your system to that explicitly. In the job list, you can see a field “Package/release name”:

 ![image](https://discourse.nixos.org/uploads/default/original/2X/1/1980df1cc208b4a7ba1e12741dda17fade3c65c3.png)

In this case, it’s `nixos-22.05.4694.380be19fbd2`. You can append this to `https://releases.nixos.org/nixos/22.05/` and set your `nixos` channel to the resulting URL:

```bash
$ sudo nix-channel --add 'https://releases.nixos.org/nixos/22.05/nixos-22.05.4694.380be19fbd2' nixos
$ sudo nix-channel --update
$ cat /nix/var/nix/profiles/per-user/root/channels/nixos/.version*
22.05
.4694.380be19fbd2%

```

_(Note that `--add` is a bit of a misnomer as it **overwrites** the previous definition of `nixos`)_

Now you can `nixos-rebuild` like you did before and see if the issue already exists or not. This is your basic tool for rebuilding your config based on a fixed channel release.

# Bisecting

Now, for the strategy of finding the commit that causes your issue; on the [22.11 channel job page](https://hydra.nixos.org/job/nixos/release-22.11/nixos.channel/all?page=10), there’s 197 releases. They are listed in descending order by their “Finished at” date, so the first one is on the last page, and you can see it was published in 2022-11-22. **Just to be sure you’re not wasting time, start with that one first.**

If it succeeds, _we know that the very first release of 22.11 was ok_, and you can succeed in the usual bisect algorithm:

1. Choose one release roughly halfway between the most recent known good one and the oldest known bad one
2. Get the release URL as shown above (maybe paste it into your browser once to make sure it doesn’t 404)
3. Set your `nixos` channel to the release URL, `nix-channel --update`, `nixos-rebuild`.
4. Check if the issue is there
5. If it is, all newer commits can be considered bad. If it isn’t all older commits can be considered good.
6. Select a new release according to step 1 and continue until you find the first bad release.

If you have _the same issue on the very first release of 22.11_, you’ll need to do the bisecting on old releases of nixos-unstable. It is called [trunk-combined on hydra](https://hydra.nixos.org/job/nixos/trunk-combined/nixos.channel/all?page=19), but it works pretty much the same as described above, you just have to know that the base URL is `https://releases.nixos.org/nixos/unstable/` and that `pre22.11` means that the release was after the branch-off of 22.05 and before the release of 22.11, so those are the releases you’ll want to look at. I think old releases might be purged from unstable if they’re old enough, or if they were never downloaded. The oldest one that seems to still be up is [nixos-22.11pre383837.033bd4fa9a8](https://releases.nixos.org/nixos/unstable/nixos-22.11pre383837.033bd4fa9a8) from 2022-06-08.

I hope this explanation was clear enough, let me know if you have any more questions or issues! Also make sure to click “Reply” on my answer or mention me directly, otherwise I might not get a notification about your reply 🙂

---

<div class="post-metadata">

### Author: ![mounty](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mounty](https://discourse.nixos.org/u/mounty)
#### Post date: [June 19, 2023, 7:44pm UTC](https://discourse.nixos.org/t/using-nvidia-open-source-drivers/27809/23 "2023-06-19T19:44:32Z")

</div>

Thanks for that. I changed to nixos-22.05.4694.380be19fbd2 and the problem is present, so surely doesn’t that mean that it happened in 22. **05** , not 22.11?

Just to be clear:

- nixos-22.05.4694.380be19fbd2 – problem **present**.
- nixos-22.05.4692.50fc86b75d2 – problem **absent**.

---

<div class="post-metadata">

### Author: ![iFreilicht](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ifreilicht/32/9702_2.png) [@iFreilicht](https://discourse.nixos.org/u/iFreilicht)
#### Post date: [June 19, 2023, 10:52pm UTC](https://discourse.nixos.org/t/using-nvidia-open-source-drivers/27809/24 "2023-06-19T22:52:41Z")

</div>

Jup, exactly. I would have assumed some changes got backported to 22.05 that caused this, but looking at the git log, this seems impossible:

```plaintext
$ git log --decorate --oneline --graph | head -7
* 380be19fbd2 (HEAD, origin/release-22.05, origin/nixpkgs-22.05-darwin, origin/nixos-22.05-small, origin/nixos-22.05-aarch64, origin/nixos-22.05) Merge pull request #235159 from prusnak/bitcoin-22.05
|\  
| * c3a341f4d26 bitcoin: 23.0 -> 23.2
|/  
* 50fc86b75d2 haskellPackages.hs-mesos: throw properly
* abd6db5708e texlive.texinfo: fix hash (#227358)
* 08741686397 Merge pull request #206382 from NixOS/backport-206193-to-release-22.05

```

You see `50fc86b75d2`, which is where the problem is absent, and `380be19fbd2` where the problem is present.

The only change that happened in between was a minor version bump of bitcoin; [the full diff just contains the version number and the hash](https://hydra.nixos.org/api/scmdiff?rev2=380be19fbd2d9079f677978361792cb25e8a3635&type=git&rev1=50fc86b75d2744e1ab3837ef74b53f103a9b55a0&uri=https%3A%2F%2Fgithub.com%2FNixOS%2Fnixpkgs.git&branch=), and searching for “bitcoin” in your config yields 0 results, so you’re not even installing it.

_ **How the hell is that breaking nouveau?** _

I guess we gotta look deeper. The next thing we should check is the full closure of your system.  
I’m not on NixOS, but this should work like a regular profile. First off, let’s see the generation numbers:

```plaintext
nix profile history --profile /nix/var/nix/profiles/system

```

This should allow you to find the generation numbers for the generations based on `50fc86b75d2` and `380be19fbd2`. You’ll have to figure out which is which, but I would assume they’re the last two. Now, let’s say those were 661 and 662, respectively. You’d then execute this command:

```plaintext
nix store diff-closures /nix/var/nix/profiles/system-661-link /nix/var/nix/profiles/system-662-link

```

This should already show if there’s any difference between the two profiles. If there are some, you can also run

```plaintext
diff --recursive /nix/var/nix/profiles/system-661-link /nix/var/nix/profiles/system-662-link

```

which will give you more detail. Remember to replace 661 and 662 with your actual generation numbers.

Please post the output of all commands here (but truncate the first one, it would be way too long to post here).

I really hope we find something in those diffs.

---

<div class="post-metadata">

### Author: ![mounty](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mounty](https://discourse.nixos.org/u/mounty)
#### Post date: [June 21, 2023, 6:28am UTC](https://discourse.nixos.org/t/using-nvidia-open-source-drivers/27809/25 "2023-06-21T06:28:24Z")

</div>

I was mistaken. The problem is **absent** in nixos-22.05.4694.380be19fbd2. Without boring you with the details, I am performing this investigation in less than ideal conditions.  
Also, I’m using the Nvidia proprietary closed-source drivers, not Nouveau. [Here](https://github.com/mounty1/NixOS-W520-config/tree/22.11) is my config.  
So at the end of the 22.05 line my system is running OK. What should I do next? Move to the start of 22.11? If so, how?

---

<div class="post-metadata">

### Author: ![iFreilicht](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ifreilicht/32/9702_2.png) [@iFreilicht](https://discourse.nixos.org/u/iFreilicht)
#### Post date: [June 21, 2023, 8:56am UTC](https://discourse.nixos.org/t/using-nvidia-open-source-drivers/27809/26 "2023-06-21T08:56:22Z")

</div>

Ah phew, ok.

> [@mounty](#):
>
> Also, I’m using the Nvidia proprietary closed-source drivers, not Nouveau. [Here](https://github.com/mounty1/NixOS-W520-config/tree/22.11) is my config.

Ahhh right I looked at the link to your nouveau config, but you already explained that didn’t work. Sorry about that.

> [@mounty](#):
>
> What should I do next? Move to the start of 22.11? If so, how?

Yes. So as I wrote above you can go to the [Hydra build page for 22.11](https://hydra.nixos.org/job/nixos/release-22.11/nixos.channel/all?page=10) and select the first beta release, so `https://releases.nixos.org/nixos/22.11/nixos-22.11beta19.c9538a9b707` is what to set your channel to first. Starting from that, follow [the instructions I already posted](https://discourse.nixos.org/t/using-nvidia-open-source-drivers/27809/22).

Note that for some of these releases, the commit hash is missing from the release name, and you’ll get a 404 if try to access it that way. You need to use the full file name of the archive minus the file extension:

 ![Screenshot 2023-06-21 at 10.45.52](https://discourse.nixos.org/uploads/default/original/2X/4/4e37f0e34014c12a603a28f6ffa6fda75a9af3bc.png)

[Previous page](https://discourse.nixos.org/t/using-nvidia-open-source-drivers/27809.md?page=1)
