2022-09-10 07:08:51 +02:00
|
|
|
# Contributing a Device Profile
|
|
|
|
|
|
|
|
## 1. Writing profiles
|
|
|
|
|
|
|
|
Create an appropriate directory and start writing your expression.
|
2017-12-24 20:34:39 +01:00
|
|
|
|
2018-07-17 14:39:49 +02:00
|
|
|
When setting an option, use `lib.mkDefault` unless:
|
2022-09-10 07:08:51 +02:00
|
|
|
- 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).
|
2018-07-17 14:39:49 +02:00
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
```nix
|
|
|
|
{ lib }: {
|
|
|
|
# Using mkDefault, because the user might want to disable tlp
|
|
|
|
services.tlp.enable = lib.mkDefault true;
|
|
|
|
# No need to use mkDefault, because the setting will merge with the user's setting
|
|
|
|
boot.kernelModules = [ "tmp_smapi" ];
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2022-09-10 07:08:51 +02:00
|
|
|
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.
|
2018-07-17 14:39:49 +02:00
|
|
|
|
2022-09-10 07:08:51 +02:00
|
|
|
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.
|
2018-07-17 14:39:49 +02:00
|
|
|
|
2022-09-10 07:08:51 +02:00
|
|
|
## 2. Adding Entry
|
2018-07-17 14:39:49 +02:00
|
|
|
|
2022-09-10 07:08:51 +02:00
|
|
|
Link the profile in the table in README.md and in flake.nix.
|
2018-07-17 14:39:49 +02:00
|
|
|
|
2022-09-10 07:08:51 +02:00
|
|
|
## 3. Testing
|
2018-07-17 14:39:49 +02:00
|
|
|
|
2024-09-21 09:47:35 +02:00
|
|
|
Run `nix run ./tests#run .` to evaluate all hardware profiles.
|
2022-09-10 07:08:51 +02:00
|
|
|
Because profiles can only be tested with the appropriate hardware, quality
|
|
|
|
assurance is up to *you*.
|
2022-10-01 14:51:04 +02:00
|
|
|
|
|
|
|
# For reviewers:
|
|
|
|
|
|
|
|
This repository has bors enabled for easier merging after a successfull build:
|
|
|
|
|
|
|
|
* `bors try` - check if the PR builds.
|
|
|
|
* `bors merge` - same as `bors try` but will also merge the PR if it builds successfully.
|
|
|
|
* https://bors.tech/documentation/
|