# Make nixos-hardware more prominent?

**URL:** https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657
**Category:** Development
**Created:** [June 7, 2024, 4:51pm UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657 "2024-06-07T16:51:52Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![jheidbrink](https://discourse.nixosstag.fcio.net/letter_avatar_proxy/v4/letter/j/f1d935/32.png) [@jheidbrink](https://discourse.nixosstag.fcio.net/u/jheidbrink)
#### Post date: [June 7, 2024, 4:51pm UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/1 "2024-06-07T16:51:52Z")

</div>

I installed NixOS on a Latitude 9430 and found that the video was lagging so much that the system was pretty much unusable. I stumbled upon [I915 driver has bug for iris xe graphics - #12 by TLATER](https://discourse.nixosstag.fcio.net/t/i915-driver-has-bug-for-iris-xe-graphics/25006/12) where TLATER described a fix, and in the same thread also mentioned [nixos-hardware](https://github.com/NixOS/nixos-hardware)

I wonder why nixos-hardware isn’t mentioned more prominently in the NixOS documentation, or even incorporated into the `nixos-generate-config` command. In this case it wouldn’t have helped because there is no config for Latitude 9430 in that repo yet, but I imagine that it can make the installation experience smoother in lots of cases.

---

<div class="post-metadata">

### Author: ![AndersonTorres](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/andersontorres/32/27666_2.png) [@AndersonTorres](https://discourse.nixosstag.fcio.net/u/AndersonTorres)
#### Post date: [June 7, 2024, 5:19pm UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/2 "2024-06-07T17:19:05Z")

</div>

I believe that some of these external projects should be phagocyted, included inside the monorepo. They should be as easy to access as `nixos/` is nowadays.

The problem with nixos-hardware, **in my opinion** , is that is looks like a blob of hacks and workarounds for bad hardware.  
How should we include it in the monorepo? Certainly it should not be “preinstalled”, but it should not be hidden either.  
How should they be tested? Should we ping contributors with weird hardware? Should the modules be kept forever?

---

<div class="post-metadata">

### Author: ![fricklerhandwerk](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/fricklerhandwerk/32/2029_2.png) [@fricklerhandwerk](https://discourse.nixosstag.fcio.net/u/fricklerhandwerk)
#### Post date: [June 7, 2024, 8:54pm UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/3 "2024-06-07T20:54:11Z")

</div>

I’d be totally in favor of wrapping the nixos-hardware hacks into modules shipped with NixOS such that they can be enabled as needed. I think the problem is primarily that it would be quite a bit of work to make that nice, and “ain’t nobody got time for that”.

Maybe as a first step, can we ask maintainers and users whether there are any blockers to do that sort of upstreaming in principle? When there are no objections, it’s less likely a waste of time to make an attempt and see how involved it actually is.

---

<div class="post-metadata">

### Author: ![TLATER](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/tlater/32/4257_2.png) [@TLATER](https://discourse.nixosstag.fcio.net/u/TLATER)
#### Post date: [June 7, 2024, 10:57pm UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/4 "2024-06-07T22:57:49Z")

</div>

I’d love to see it refactored a bit if/when this happens, currently nixos-hardware modules are not very composable because they are designed to be used with `imports` and don’t really use the NixOS module system. There’s lots of copy-paste code duplication because of that, and I’ve seen issues fixed in one place but not another. It’s hard to fix that while maintaining backwards compatibility, moving things to nixpkgs would be the ideal moment to do so.

Other than that I don’t see any issues with this, getting more people’s eyes on it will solve more issues than it causes. There’s enough half-broken and poorly maintained packages in nixpkgs, I don’t think these modules would make things much worse, especially if they’re clearly separated.

To help with maintenance, some kind of script that just evaluates all entrypoints and ensures that there are no differences in the actual evaluated config would be great. Maintainers usually don’t have the devices in question to test, so that kind of “test” is the only way to make sure things keep working.

---

<div class="post-metadata">

### Author: ![AndersonTorres](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/andersontorres/32/27666_2.png) [@AndersonTorres](https://discourse.nixosstag.fcio.net/u/AndersonTorres)
#### Post date: [June 7, 2024, 11:23pm UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/5 "2024-06-07T23:23:48Z")

</div>

Then ~~we~~ you have a work to be made before merging it over NixOS/nixpkgs/hardware-quirks.  
Namely, getting it in a suitable shape to be included as a PR Train over Nixpkgs monorepo.

---

<div class="post-metadata">

### Author: ![ehmry](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/ehmry/32/9429_2.png) [@ehmry](https://discourse.nixosstag.fcio.net/u/ehmry)
#### Post date: [June 8, 2024, 7:17am UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/6 "2024-06-08T07:17:41Z")

</div>

This has been discussed many times before:

> <https://github.com/NixOS/rfcs/pull/70>
>
> We are currently having a separate repository to providing NixOS profiles for ha…rdware specific extensions at \[nixos-hardware\](https://github.com/NixOS/nixos-hardware). This RFC proposes to merge this repository (4000 LOCs/350 commits) and add support for detecting hardware in \`nixos-generate-config\`.
> 
> \[Rendered\](https://github.com/Mic92/rfcs/blob/nixos-hardware/rfcs/0070-nixos-hardware.md)

---

<div class="post-metadata">

### Author: ![ehmry](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/ehmry/32/9429_2.png) [@ehmry](https://discourse.nixosstag.fcio.net/u/ehmry)
#### Post date: [June 8, 2024, 7:31am UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/7 "2024-06-08T07:31:36Z")

</div>

> <https://github.com/NixOS/nixpkgs/issues/301541>
>
> \## Issue description
> 
> We have https://github.com/NixOS/nixos-hardware/ which i…s a repo where everyone dumps pieces of configurations they find to make their computer do better in their view.
> 
> In the past, that repo was merged \_inside\_ nixpkgs, then reverted, in the context of https://github.com/NixOS/nixpkgs/pull/91160.
> 
> Furthermore, \`nixos-generate-config\` is not always aware of potential hardware profiles to apply, see https://github.com/NixOS/nixos-hardware/issues/49 for ideas, which impedes the discoverability sometimes.
> 
> We discussed on Matrix at https://matrix.to/#/!kjdutkOsheZdjqYmqp:nixos.org/$2Tu2fydLwl5XTeuHQxOrqGa0TAn0F6ft4e6fdylQaAU?via=lossy.network&via=matrix.org&via=nixos.dev "what if we merged the repo again" and we came to the conclusion very quickly this was not an option.
> 
> Here's a summary of the discussion:
> 
> \- Kernel maintainers in nixpkgs are not super comfortable with forked kernels \_inside\_ of nixpkgs: @alyssais, @K900 and I prefer a hard rule "no forked kernel" even if it had permitted hardware enablement.
> \- A code owner of \`hardware/\`, even multiples to ensure a high quality level, on par with Jovian or Asahi
> \- For something to be present in \`hardware/\`, the intention of their vendor/author is that it should be upstreamed as soon as possible
> \- Explicit traces of good maintenance from the midstream (Asahi/Collabora/Jovian) must be apparent
> \- We also mentioned that CI in nixos-hardware is lacking and a better separation of packages/modules would help
> 
> \- @alyssais is against ideally any forked project for hardware enablement
> \- The previous points do not cover things like just tweaking a configuration with existing packages even if the configuration could be upstreamed and thus no tweak would be required
> \- Open questions are also how to reconcile diverging outcomes and whether we should have NixOS module code to handle things like "I want to optimize my HW for power", "I want to optimize my HW for performance", etc.
> 
> \#### Raito's proposal
> 
> My proposal would be to formalize better a policy in Nixpkgs about the hardware enablement here, take ownership of that repo and start to look if some stuff makes sense to move over from nixos-hardware to here.
> 
> In parallel, we can help the nixos-hardware project to get CI and help with the structure.
> 
> Finally, I'd like to try to close the "auto generate" profile issue with \`nixos-generate-config\`, during the conversation: https://git.numtide.com/numtide/nixos-generate-facts was mentioned.
> 
> cc @samueldr @zimbatm

---

<div class="post-metadata">

### Author: ![jheidbrink](https://discourse.nixosstag.fcio.net/letter_avatar_proxy/v4/letter/j/f1d935/32.png) [@jheidbrink](https://discourse.nixosstag.fcio.net/u/jheidbrink)
#### Post date: [June 8, 2024, 10:30am UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/8 "2024-06-08T10:30:42Z")

</div>

Besides incorporating nixos-hardware into nixpkgs which seems a big and controversial topic, what do you think of at least mentioning nixos-hardware in the NixOS documentation? That seems like a way smaller step to take, and also beneficial.

---

<div class="post-metadata">

### Author: ![TLATER](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/tlater/32/4257_2.png) [@TLATER](https://discourse.nixosstag.fcio.net/u/TLATER)
#### Post date: [June 8, 2024, 12:01pm UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/9 "2024-06-08T12:01:32Z")

</div>

The config generator does at least mention it: [nixpkgs/nixos/modules/installer/tools/nixos-generate-config.pl at eee6bf962146fe720558f69d8205646ba11da07a · Mic92/nixpkgs · GitHub](https://github.com/Mic92/nixpkgs/blob/eee6bf962146fe720558f69d8205646ba11da07a/nixos/modules/installer/tools/nixos-generate-config.pl#L706)

Maybe it could be added to the actual generated config in a comment? Script stderr can be easy to miss.

---

<div class="post-metadata">

### Author: ![AndersonTorres](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/andersontorres/32/27666_2.png) [@AndersonTorres](https://discourse.nixosstag.fcio.net/u/AndersonTorres)
#### Post date: [June 9, 2024, 12:57am UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/10 "2024-06-09T00:57:23Z")

</div>

Do we really need an RFC to do this?  
Just do it in reverse:

1. Create a branch at nixos-hardware that merges Nixpkgs over it  
a. Periodically merge Nixpkgs
2. cleanup nixos-hardware
3. profit

![image](https://discourse.nixosstag.fcio.net/uploads/default/original/3X/5/e/5ec387f926aa59237c1f469d272653d709e51c9d.jpeg)

In my experience, it is easier to convince people by showing a functional and complete prototype.

The NixBSD is doing exacty this.

---

<div class="post-metadata">

### Author: ![Mic92](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/mic92/32/5265_2.png) [@Mic92](https://discourse.nixosstag.fcio.net/u/Mic92)
#### Post date: [June 9, 2024, 5:36am UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/11 "2024-06-09T05:36:15Z")

</div>

One of the critique points of nixos-hardware is and was back with the RFC that it also includes a lot of information that could be also automatically generated - Profpatsch already tried to merge nixos-hardware in the past and it got reverted again. That’s why my current plan is to upstream modules in [nixos-hardware/common at master · NixOS/nixos-hardware · GitHub](https://github.com/NixOS/nixos-hardware/tree/master/common) to nixpkgs and than have tools auto-generate the information. This would allow us to drop this information from the NixOS configurations in nixos-hardware itself.

For a user not having nixos-hardware in nixpkgs is probably an inconvenience. For a contributor at the moment I would argue, it’s a lot easier to get changes in. It’s i.e. easier to have a smaller and faster CI and I personally as a maintainer have a better overview which pull requests can be merged. In nixpkgs everything just gets drowned under automated nixpkgs updates. I don’t know how we could fix that in nixpkgs itself.

---

<div class="post-metadata">

### Author: ![Mic92](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/mic92/32/5265_2.png) [@Mic92](https://discourse.nixosstag.fcio.net/u/Mic92)
#### Post date: [June 9, 2024, 5:38am UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/12 "2024-06-09T05:38:51Z")

</div>

I like that approach and even if we merge nixos-hardware into nixpkgs, it would be valueable to have documentation already being written. Let me know if you have any pull requests that can be reviewd. So far what I did was adding links to the repository in nixos-generate-config - so when users generate their configuration they get pointed to it. However it should be also part of the installation manual.

---

<div class="post-metadata">

### Author: ![jheidbrink](https://discourse.nixosstag.fcio.net/letter_avatar_proxy/v4/letter/j/f1d935/32.png) [@jheidbrink](https://discourse.nixosstag.fcio.net/u/jheidbrink)
#### Post date: [June 9, 2024, 2:53pm UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/13 "2024-06-09T14:53:46Z")

</div>

I like @TLATER’s idea of referencing nixos-hardware in a comment in the config generated by `nixos-generate-config`. I can try to create a PR for that.

Regarding `nixos-generate-config`, I think we should include it not only in the instructions for the initial installation, but also suggest to run it upon upgrading to a new NixOS release. I remember that after one NixOS upgrade I couldn’t control my backlight brightness any more, and it helped to re-run `nixos-generate-config` and merge the result into my existing config.

---

<div class="post-metadata">

### Author: ![Mic92](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/mic92/32/5265_2.png) [@Mic92](https://discourse.nixosstag.fcio.net/u/Mic92)
#### Post date: [June 19, 2024, 2:09pm UTC](https://discourse.nixosstag.fcio.net/t/make-nixos-hardware-more-prominent/46657/14 "2024-06-19T14:09:14Z")

</div>

I created now a new matrix channel, where discuss a new alternative for nixos-generate-config and other nixos-hardware related topics:

> **[You're invited to talk on Matrix](https://matrix.to/#/%23nixos-hardware:nixos.org)**
>
> You're invited to talk on Matrix. If you don't already have a client this link will help you pick one, and join the conversation. If you already have one, this link will help you join the conversation
