mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-05 17:38:41 +08:00
TLP is often no longer the best choice since firmware provides power profiles instead. That's why we are removing TLP as the default option. We may want to bring back TLP to some old hardware if it makes sense i.e. certain thinkpad modules.
55 lines
1.7 KiB
Markdown
55 lines
1.7 KiB
Markdown
# Contributing a Device Profile
|
|
|
|
## 1. Writing profiles
|
|
|
|
Create an appropriate directory and start writing your expression.
|
|
|
|
When setting an option, use `lib.mkDefault` unless:
|
|
- The option *must* be set and the user should get an error if they try to
|
|
override it.
|
|
- The setting should merge with the user's settings (typical for list or set
|
|
options).
|
|
|
|
For example:
|
|
|
|
```nix
|
|
{ lib }: {
|
|
# Using mkDefault, because the user might want to disable power-profiles-daemon
|
|
services.power-profiles-daemon.enable = lib.mkDefault true;
|
|
|
|
# No need to use mkDefault, because the setting will merge with the user's setting
|
|
boot.kernelModules = [ "tmp_smapi" ];
|
|
}
|
|
```
|
|
|
|
Where possible, use module imports to share code between similar hardware
|
|
variants. In most cases, import:
|
|
- a cpu module;
|
|
- a gpu module;
|
|
- either the pc or the laptop module;
|
|
- either the HDD or the SSD module.
|
|
|
|
Try to avoid "opinionated" settings relating to optional features like sound,
|
|
bluetooth, choice of bootloader etc. You can mention these in the readme.
|
|
|
|
Profiles should favor usability and stability, so performance improvements
|
|
should either be conservative or be guarded behind additional NixOS module
|
|
options. If it makes sense to have a performance-focussed config, it can be
|
|
declared in a separate profile.
|
|
|
|
## 2. Adding Entry
|
|
|
|
Link the profile in the table in README.md and in flake.nix.
|
|
|
|
## 3. Testing
|
|
|
|
Run `nix run ./tests#run .` to evaluate all hardware profiles.
|
|
Because profiles can only be tested with the appropriate hardware, quality
|
|
assurance is up to *you*.
|
|
|
|
# For reviewers:
|
|
|
|
This repository has [mergify](https://mergify.com/) enabled for easier merging after a successfull build:
|
|
|
|
* `@mergify queue` will add the current pull request to the merge queue and merge when all tests succeed
|