diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..4c9bbd01 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,12 @@ +# This file contains commits that should be ignored by git blame +# See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-file +# and https://github.com/NixOS/nixpkgs/blob/master/.git-blame-ignore-revs for more info + +# To enable this in your local repository, run: +# git config blame.ignoreRevsFile .git-blame-ignore-revs + +# For rebasing PRs, commits marked with !autorebase will be automatically +# reapplied by the auto-rebase script + +# nixfmt-rfc-style formatting +51e51e601448705c0d2f92ef90ec7b680123077c #!autorebase cd tests && nix fmt .. \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3e96b10d..4f58d888 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,10 +4,18 @@ on: push: branches: - master + merge_group: jobs: - tests: + nixfmt: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v30 - - run: nix run ./tests#run . + - uses: cachix/install-nix-action@v31 + - run: cd tests && nix fmt .. -- --fail-on-change + tests: + needs: nixfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v31 + - run: nix run ./tests#run . \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 22e78dd4..63a147a7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,8 +48,6 @@ assurance is up to *you*. # For reviewers: -This repository has bors enabled for easier merging after a successfull build: +This repository has [mergify](https://mergify.com/) 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/ +* `@mergify queue` will add the current pull request to the merge queue and merge when all tests succeed diff --git a/README.md b/README.md index 0b109c34..a064978f 100644 --- a/README.md +++ b/README.md @@ -69,304 +69,351 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md). For questions and discussions, come join us in the [nixos-anywhere matrix](https://matrix.to/#/#nixos-hardware:nixos.org) room. +# Community Meetings + +The [NixOS hardware](https://github.com/orgs/NixOS/teams/nixos-hardware) team meets regularly to discuss hardware profiles and maintenance: + +- **When**: Every 3rd Friday of the month +- **Time**: 04:00 pm (UTC) / 16:00 (UTC) +- **Where**: https://jitsi.lassul.us/Hardware-team +- **Contact**: hardware@nixos.org + +All contributors and users are welcome to join! + ## List of Profiles See code for all available configurations. -| Model | Path | -| --------------------------------------------------------------------------------- | ------------------------------------------------------- | -| [Acer Aspire 4810T](acer/aspire/4810t) | `` | -| [Airis N990](airis/n990) | `` | -| [Apple iMac 14.2](apple/imac/14-2) | `` | -| [Apple iMac 18.2](apple/imac/18-2) | `` | -| [Apple MacBook Air 3,X](apple/macbook-air/3) | `` | -| [Apple MacBook Air 4,X](apple/macbook-air/4) | `` | -| [Apple MacBook Air 6,X](apple/macbook-air/6) | `` | -| [Apple MacBook Air 7,X](apple/macbook-air/7) | `` | -| [Apple MacBook Pro 8,1](apple/macbook-pro/8-1) | `` | -| [Apple MacBook Pro 10,1](apple/macbook-pro/10-1) | `` | -| [Apple MacBook Pro 11,1](apple/macbook-pro/11-1) | `` | -| [Apple MacBook Pro 11,5](apple/macbook-pro/11-5) | `` | -| [Apple MacBook Pro 12,1](apple/macbook-pro/12-1) | `` | -| [Apple MacBook Pro 14,1](apple/macbook-pro/14-1) | `` | -| [Apple MacMini (2010, Intel, Nvidia)](apple/macmini/4) | `` | -| [Apple Macs with a T2 Chip](apple/t2) | `` | -| [Asus Pro WS X570-ACE](asus/pro-ws-x570-ace) | `` | -| [Asus ROG Ally RC71L (2023)](asus/ally/rc71l) | `` | -| [Asus ROG Flow X13 GV302X\* (2023)](asus/flow/gv302x/amdgpu) | `` | -| [Asus ROG Flow X13 GV302X\* (2023)](asus/flow/gv302x/nvidia) | `` | -| [Asus ROG Strix G513IM](asus/rog-strix/g513im) | `` | -| [Asus ROG Strix G713IE](asus/rog-strix/g713ie) | `` | -| [Asus ROG Strix G733QS](asus/rog-strix/g733qs) | `` | -| [Asus ROG Strix X570-E GAMING](asus/rog-strix/x570e) | `` | -| [Asus ROG Zephyrus G14 GA401](asus/zephyrus/ga401) | `` | -| [Asus ROG Zephyrus G14 GA402](asus/zephyrus/ga402) | `` | -| [Asus ROG Zephyrus G14 GA402X\* (2023)](asus/zephyrus/ga402x/amdgpu) | `` | -| [Asus ROG Zephyrus G14 GA402X\* (2023)](asus/zephyrus/ga402x/nvidia) | `` | -| [Asus ROG Zephyrus G15 GA502](asus/zephyrus/ga502) | `` | -| [Asus ROG Zephyrus G15 GA503](asus/zephyrus/ga503) | `` | -| [Asus ROG Zephyrus G16 GU605MY](asus/zephyrus/gu605my) | `` | -| [Asus ROG Zephyrus M16 GU603H](asus/zephyrus/gu603h) | `` | -| [Asus TUF FX504GD](asus/fx504gd) | `` | -| [Asus TUF FX506HM](asus/fx506hm) | `` | -| [Asus TUF FA506IC](asus/fa506ic) | `` | -| [Asus TUF FA507RM](asus/fa507rm) | `` | -| [Asus TUF FA507NV](asus/fa507nv) | `` | -| [Asus Zenbook Flip S13 UX371](asus/zenbook/ux371/) | `` | -| [Asus Zenbook Pro 15 UX535](asus/zenbook/ux535/) | `` | -| [BeagleBoard PocketBeagle](beagleboard/pocketbeagle) | `` | -| [Chuwi MiniBook X](chuwi/minibook-x) | `` | -| [Deciso DEC series](deciso/dec) | `` | -| [Dell G3 3779](dell/g3/3779) | `` | -| [Dell G3 3579](dell/g3/3579) | `` | -| [Dell Inspiron 3442](dell/inspiron/3442) | `` | -| [Dell Inspiron 14 5420](dell/inspiron/14-5420) | `` | -| [Dell Inspiron 5509](dell/inspiron/5509) | `` | -| [Dell Inspiron 5515](dell/inspiron/5515) | `` | -| [Dell Inspiron 7405](dell/inspiron/7405) | `` | -| [Dell Inspiron 7460](dell/inspiron/7460) | `` | -| [Dell Latitude 3340](dell/latitude/3340) | `` | -| [Dell Latitude 3480](dell/latitude/3480) | `` | -| [Dell Latitude 5490](dell/latitude/5490) | `` | -| [Dell Latitude 5520](dell/latitude/5520) | `` | -| [Dell Latitude 7280](dell/latitude/7280) | `` | -| [Dell Latitude 7390](dell/latitude/7390) | `` | -| [Dell Latitude 7420](dell/latitude/7420) | `` | -| [Dell Latitude 7430](dell/latitude/7430) | `` | -| [Dell Latitude 7490](dell/latitude/7490) | `` | -| [Dell Latitude 9430](dell/latitude/9430) | `` | -| [Dell Optiplex 3050](dell/optiplex/3050) | `` | -| [Dell Poweredge R7515](dell/poweredge/r7515) | `` | -| [Dell Precision 3541](dell/precision/3541) | `` | -| [Dell Precision 5490](dell/precision/5490) | `` | -| [Dell Precision 5530](dell/precision/5530) | `` | -| [Dell Precision 7520](dell/precision/7520) | `` | -| [Dell XPS 13 7390](dell/xps/13-7390) | `` | -| [Dell XPS 13 9300](dell/xps/13-9300) | `` | -| [Dell XPS 13 9310](dell/xps/13-9310) | `` | -| [Dell XPS 13 9315](dell/xps/13-9315) | `` | -| [Dell XPS 13 9333](dell/xps/13-9333) | `` | -| [Dell XPS 13 9343](dell/xps/13-9343) | `` | -| [Dell XPS 13 9350](dell/xps/13-9350) | `` | -| [Dell XPS 13 9360](dell/xps/13-9360) | `` | -| [Dell XPS 13 9370](dell/xps/13-9370) | `` | -| [Dell XPS 13 9380](dell/xps/13-9380) | `` | -| [Dell XPS 15 7590, nvidia](dell/xps/15-7590/nvidia) | `` | -| [Dell XPS 15 7590](dell/xps/15-7590) | `` | -| [Dell XPS 15 9500, nvidia](dell/xps/15-9500/nvidia) | `` | -| [Dell XPS 15 9500](dell/xps/15-9500) | `` | -| [Dell XPS 15 9510, nvidia](dell/xps/15-9510/nvidia) | `` | -| [Dell XPS 15 9510](dell/xps/15-9510) | `` | -| [Dell XPS 15 9520, nvidia](dell/xps/15-9520/nvidia) | `` | -| [Dell XPS 15 9520](dell/xps/15-9520) | `` | -| [Dell XPS 15 9530, nvidia](dell/xps/15-9520/nvidia) | `` | -| [Dell XPS 15 9420](dell/xps/15-9520) | `` | -| [Dell XPS 15 9550, nvidia](dell/xps/15-9550/nvidia) | `` | -| [Dell XPS 15 9550](dell/xps/15-9550) | `` | -| [Dell XPS 15 9560, intel only](dell/xps/15-9560/intel) | `` | -| [Dell XPS 15 9560, nvidia only](dell/xps/15-9560/nvidia) | `` | -| [Dell XPS 15 9560](dell/xps/15-9560) | `` | -| [Dell XPS 15 9570, intel only](dell/xps/15-9570/intel) | `` | -| [Dell XPS 15 9570, nvidia](dell/xps/15-9570/nvidia) | `` | -| [Dell XPS 15 9570](dell/xps/15-9570) | `` | -| [Dell XPS 17 9700, intel](dell/xps/17-9700/intel) | `` | -| [Dell XPS 17 9710, intel only](dell/xps/17-9710/intel) | `` | -| [Dell XPS E7240](dell/e7240) | `` | -| [Framework 11th Gen Intel Core](framework/13-inch/11th-gen-intel) | `` | -| [Framework 12th Gen Intel Core](framework/13-inch/12th-gen-intel) | `` | -| [Framework 13th Gen Intel Core](framework/13-inch/13th-gen-intel) | `` | -| [Framework Intel Core Ultra Series 1](framework/13-inch/intel-core-ultra-series1) | `` | -| [Framework 13 AMD Ryzen 7040 Series](framework/13-inch/7040-amd) | `` | -| [Framework 16 AMD Ryzen 7040 Series](framework/16-inch/7040-amd) | `` | -| [FriendlyARM NanoPC-T4](friendlyarm/nanopc-t4) | `` | -| [FriendlyARM NanoPi R5s](friendlyarm/nanopi-r5s) | `` | -| [Focus M2 Gen 1](focus/m2/gen1) | `` | -| [Gigabyte B550](gigabyte/b550) | `` | -| [GPD MicroPC](gpd/micropc) | `` | -| [GPD P2 Max](gpd/p2-max) | `` | -| [GPD Pocket 3](gpd/pocket-3) | `` | -| [GPD Pocket 4](gpd/pocket-4) | `` | -| [GPD WIN 2](gpd/win-2) | `` | -| [GPD WIN Max 2 2023](gpd/win-max-2/2023) | `` | -| [GPD WIN Mini 2024](gpd/win-mini/2024) | `` | -| [Google Pixelbook](google/pixelbook) | `` | -| [HP Elitebook 2560p](hp/elitebook/2560p) | `` | -| [HP Elitebook 830g6](hp/elitebook/830/g6) | `` | -| [HP Elitebook 845g7](hp/elitebook/845/g7) | `` | -| [HP Elitebook 845g8](hp/elitebook/845/g8) | `` | -| [HP Elitebook 845g9](hp/elitebook/845/g9) | `` | -| [HP Laptop 14s-dq2024nf](hp/laptop/14s-dq2024nf) | `` | -| [HP Notebook 14-df0023](hp/notebook/14-df0023) | `` | -| [HP Probook 440G5](hp/probook/440g5) | `` | -| [Huawei Matebook X Pro (2020)](huawei/machc-wa) | `` | -| [i.MX8QuadMax Multisensory Enablement Kit](nxp/imx8qm-mek/) | `` | -| [Intel NUC 8i7BEH](intel/nuc/8i7beh/) | `` | -| [Lenovo IdeaCentre K330](lenovo/ideacentre/k330) | `` | -| [Lenovo IdeaPad 3 15alc6](lenovo/ideapad/15alc6) | `` | -| [Lenovo IdeaPad Gaming 3 15arh05](lenovo/ideapad/15arh05) | `` | -| [Lenovo IdeaPad Gaming 3 15ach6](lenovo/ideapad/15ach6) | `` | -| [Lenovo IdeaPad 5 Pro 16ach6](lenovo/ideapad/16ach6) | `` | -| [Lenovo IdeaPad Z510](lenovo/ideapad/z510) | `` | -| [Lenovo IdeaPad Slim 5](lenovo/ideapad/slim-5) | `` | -| [Lenovo IdeaPad Slim 5 16iah8](lenovo/ideapad/16iah8) | `` | -| [Lenovo Legion 5 15ach6h](lenovo/legion/15ach6h) | `` | -| [Lenovo Legion 5 15arh05h](lenovo/legion/15arh05h) | `` | -| [Lenovo Legion 7 Slim 15ach6](lenovo/legion/15ach6) | `` | -| [Lenovo Legion 5 Pro 16ach6h](lenovo/legion/16ach6h) | `` | -| [Lenovo Legion 5 Pro 16ach6h (Hybrid)](lenovo/legion/16ach6h/hybrid) | `` | -| [Lenovo Legion 5 Pro 16ach6h (Nvidia)](lenovo/legion/16ach6h/nvidia) | `` | -| [Lenovo Legion 7 16achg6 (Hybrid)](lenovo/legion/16achg6/hybrid) | `` | -| [Lenovo Legion 7 16achg6 (Nvidia)](lenovo/legion/16achg6/nvidia) | `` | -| [Lenovo Legion 7i Pro 16irx8h (Intel)](lenovo/legion/16irx8h) | `` | -| [Lenovo Legion 7 Pro 16irx9h (Intel)](lenovo/legion/16irx9h) | `` | -| [Lenovo Legion Slim 7 Gen 7 (AMD)](lenovo/legion/16arha7/) | `` | -| [Lenovo Legion T5 AMR5](lenovo/legion/t526amr5) | `` | -| [Lenovo Legion Y530 15ICH](lenovo/legion/15ich) | `` | -| [Lenovo ThinkPad A475](lenovo/thinkpad/a475) | `` | -| [Lenovo ThinkPad E14 (AMD)](lenovo/thinkpad/e14/amd) | `` | -| [Lenovo ThinkPad E14 (Intel)](lenovo/thinkpad/e14/intel) | `` | -| [Lenovo ThinkPad E470](lenovo/thinkpad/e470) | `` | -| [Lenovo ThinkPad E495](lenovo/thinkpad/e495) | `` | -| [Lenovo ThinkPad L13 Yoga](lenovo/thinkpad/l13/yoga) | `` | -| [Lenovo ThinkPad L13](lenovo/thinkpad/l13) | `` | -| [Lenovo ThinkPad L14 (AMD)](lenovo/thinkpad/l14/amd) | `` | -| [Lenovo ThinkPad L14 (Intel)](lenovo/thinkpad/l14/intel) | `` | -| [Lenovo ThinkPad L480](lenovo/thinkpad/l480) | `` | -| [Lenovo ThinkPad P1 Gen 3](lenovo/thinkpad/p1/3th-gen) | `` | -| [Lenovo ThinkPad P14s AMD Gen 1](lenovo/thinkpad/p14s/amd/gen1) | `` | -| [Lenovo ThinkPad P14s AMD Gen 2](lenovo/thinkpad/p14s/amd/gen2) | `` | -| [Lenovo ThinkPad P14s AMD Gen 3](lenovo/thinkpad/p14s/amd/gen3) | `` | -| [Lenovo ThinkPad P14s AMD Gen 4](lenovo/thinkpad/p14s/amd/gen4) | `` | -| [Lenovo ThinkPad P14s Intel Gen 3](lenovo/thinkpad/p14s/intel/gen3) | `` | -| [Lenovo ThinkPad P16s AMD Gen 1](lenovo/thinkpad/p16s/amd/gen1) | `` | -| [Lenovo ThinkPad P1](lenovo/thinkpad/p1) | `` | -| [Lenovo ThinkPad P50](lenovo/thinkpad/p50) | `` | -| [Lenovo ThinkPad P51](lenovo/thinkpad/p51) | `` | -| [Lenovo ThinkPad P52](lenovo/thinkpad/p52) | `` | -| [Lenovo ThinkPad P53](lenovo/thinkpad/p53) | `` | -| [Lenovo ThinkPad T14 AMD Gen 1](lenovo/thinkpad/t14/amd/gen1) | `` | -| [Lenovo ThinkPad T14 AMD Gen 2](lenovo/thinkpad/t14/amd/gen2) | `` | -| [Lenovo ThinkPad T14 AMD Gen 3](lenovo/thinkpad/t14/amd/gen3) | `` | -| [Lenovo ThinkPad T14 AMD Gen 4](lenovo/thinkpad/t14/amd/gen4) | `` | -| [Lenovo ThinkPad T14 AMD Gen 5](lenovo/thinkpad/t14/amd/gen5) | `` | -| [Lenovo ThinkPad T14](lenovo/thinkpad/t14) | `` | -| [Lenovo ThinkPad T14s AMD Gen 1](lenovo/thinkpad/t14s/amd/gen1) | `` | -| [Lenovo ThinkPad T14s AMD Gen 4](lenovo/thinkpad/t14s/amd/gen4) | `` | -| [Lenovo ThinkPad T14s](lenovo/thinkpad/t14s) | `` | -| [Lenovo ThinkPad T410](lenovo/thinkpad/t410) | `` | -| [Lenovo ThinkPad T420](lenovo/thinkpad/t420) | `` | -| [Lenovo ThinkPad T430](lenovo/thinkpad/t430) | `` | -| [Lenovo ThinkPad T440p](lenovo/thinkpad/t440p) | `` | -| [Lenovo ThinkPad T440s](lenovo/thinkpad/t440s) | `` | -| [Lenovo ThinkPad T450s](lenovo/thinkpad/t450s) | `` | -| [Lenovo ThinkPad T460](lenovo/thinkpad/t460) | `` | -| [Lenovo ThinkPad T460p](lenovo/thinkpad/t460p) | `` | -| [Lenovo ThinkPad T460s](lenovo/thinkpad/t460s) | `` | -| [Lenovo ThinkPad T470s](lenovo/thinkpad/t470s) | `` | -| [Lenovo ThinkPad T480](lenovo/thinkpad/t480) | `` | -| [Lenovo ThinkPad T480s](lenovo/thinkpad/t480s) | `` | -| [Lenovo ThinkPad T490](lenovo/thinkpad/t490) | `` | -| [Lenovo ThinkPad T490s](lenovo/thinkpad/t490s) | `` | -| [Lenovo ThinkPad T495](lenovo/thinkpad/t495) | `` | -| [Lenovo ThinkPad T520](lenovo/thinkpad/t520) | `` | -| [Lenovo ThinkPad T550](lenovo/thinkpad/t550) | `` | -| [Lenovo ThinkPad T590](lenovo/thinkpad/t590) | `` | -| [Lenovo ThinkPad W520](lenovo/thinkpad/w520) | `` | -| [Lenovo ThinkPad X1 Yoga](lenovo/thinkpad/x1/yoga) | `` | -| [Lenovo ThinkPad X1 Yoga Gen 7](lenovo/thinkpad/x1/yoga/7th-gen/) | `` | -| [Lenovo ThinkPad X1 (6th Gen)](lenovo/thinkpad/x1/6th-gen) | `` | -| [Lenovo ThinkPad X1 (7th Gen)](lenovo/thinkpad/x1/7th-gen) | `` | -| [Lenovo ThinkPad X1 (9th Gen)](lenovo/thinkpad/x1/9th-gen) | `` | -| [Lenovo ThinkPad X1 (10th Gen)](lenovo/thinkpad/x1/10th-gen) | `` | -| [Lenovo ThinkPad X1 (11th Gen)](lenovo/thinkpad/x1/11th-gen) | `` | -| [Lenovo ThinkPad X1 (12th Gen)](lenovo/thinkpad/x1/12th-gen) | `` | -| [Lenovo ThinkPad X1 Extreme Gen 2](lenovo/thinkpad/x1-extreme/gen2) | `` | -| [Lenovo ThinkPad X1 Extreme Gen 3](lenovo/thinkpad/x1-extreme/gen3) | `` | -| [Lenovo ThinkPad X1 Extreme Gen 4](lenovo/thinkpad/x1-extreme/gen4) | `` | -| [Lenovo ThinkPad X1 Nano Gen 1](lenovo/thinkpad/x1-nano/gen1) | `` | -| [Lenovo ThinkPad X13 Yoga](lenovo/thinkpad/x13/yoga) | `` | -| [Lenovo ThinkPad X13 Yoga (3th Gen)](lenovo/thinkpad/x13/yoga/3th-gen) | `` | -| [Lenovo ThinkPad X13 (Intel)](lenovo/thinkpad/x13/intel) | `` | -| [Lenovo ThinkPad X13 (AMD)](lenovo/thinkpad/x13/amd) | `` | -| [Lenovo ThinkPad X140e](lenovo/thinkpad/x140e) | `` | -| [Lenovo ThinkPad X200s](lenovo/thinkpad/x200s) | `` | -| [Lenovo ThinkPad X220](lenovo/thinkpad/x220) | `` | -| [Lenovo ThinkPad X230](lenovo/thinkpad/x230) | `` | -| [Lenovo ThinkPad X250](lenovo/thinkpad/x250) | `` | -| [Lenovo ThinkPad X260](lenovo/thinkpad/x260) | `` | -| [Lenovo ThinkPad X270](lenovo/thinkpad/x270) | `` | -| [Lenovo ThinkPad X280](lenovo/thinkpad/x280) | `` | -| [Lenovo ThinkPad X390](lenovo/thinkpad/x390) | `` | -| [Lenovo ThinkPad Z Series](lenovo/thinkpad/z) | `` | -| [Lenovo ThinkPad Z13 Gen 1](lenovo/thinkpad/z/gen1/z13) | `` | -| [Lenovo ThinkPad Z13 Gen 2](lenovo/thinkpad/z/gen2/z13) | `` | -| [LENOVO Yoga 6 13ALC6 82ND](lenovo/yoga/6/13ALC6) | `` | -| [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/amdgpu) | `` | -| [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/nvidia) | `` | -| [Lenovo Yoga Slim 7i Pro X 14IAH7 (Integrated)](lenovo/yoga/7/14IAH7/integrated) |`` | -| [Lenovo Yoga Slim 7i Pro X 14IAH7 (Hybrid)](lenovo/yoga/7/14IAH7/hybrid) |`` | -| [LENOVO Yoga 7 Slim Gen8](lenovo/yoga/7/slim/gen8) | `` | -| [MSI B550-A PRO](msi/b550-a-pro) | `` | -| [MSI B350 TOMAHAWK](msi/b350-tomahawk) | `` | -| [MSI GS60 2QE](msi/gs60) | `` | -| [MSI GL62/CX62](msi/gl62) | `` | -| [MSI GL65 10SDR-492](msi/gl65/10SDR-492) | `` | -| [Microchip Icicle Kit](microchip/icicle-kit) | `` | -| [Microsoft Surface Go](microsoft/surface/surface-go) | `` | -| [Microsoft Surface Pro (Intel)](microsoft/surface/surface-pro-intel) | `` | -| [Microsoft Surface Laptop (AMD)](microsoft/surface/surface-laptop-amd) | `` | -| [Microsoft Surface Range (Common Modules)](microsoft/surface/common) | `` | -| [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | -| [Microsoft Surface Pro 9](microsoft/surface-pro/9) | `` | -| [Morefine M600](morefine/m600) | `` | -| [Minisforum V3](minisforum/v3) | `` | -| [NXP iMX8 MPlus Evaluation Kit](nxp/imx8mp-evk) | `` | -| [NXP iMX8 MQuad Evaluation Kit](nxp/imx8mq-evk) | `` | -| [Hardkernel Odroid HC4](hardkernel/odroid-hc4/default.nix) | `` | -| [Hardkernel Odroid H3](hardkernel/odroid-h3/default.nix) | `` | -| [Hardkernel Odroid H4](hardkernel/odroid-h4/default.nix) | `` | -| [Omen 14-fb0798ng](omen/14-fb0798ng) | `` | -| [Omen 15-ce002ns](omen/15-ce002ns) | `` | -| [Omen 15-en0010ca](omen/15-en0010ca) | `` | -| [Omen 16-n0005ne](omen/16-n0005ne) | `` | -| [Omen 16-n0280nd](/omen/16-n0280nd) | `` | -| [Omen 15-en1007sa](omen/15-en1007sa) | `` | -| [Omen 15-en0002np](omen/15-en0002np) | `` | -| [One-Netbook OneNetbook 4](onenetbook/4) | `` | -| [Panasonic Let's Note CF-LX4](panasonic/letsnote/cf-lx4) | `` | -| [PC Engines APU](pcengines/apu) | `` | -| [PINE64 Pinebook Pro](pine64/pinebook-pro/) | `` | -| [PINE64 RockPro64](pine64/rockpro64/) | `` | -| [PINE64 STAR64](pine64/star64/) | `` | -| [Protectli VP4670](protectli/vp4670/) | `` | -| [Purism Librem 13v3](purism/librem/13v3) | `` | -| [Purism Librem 15v3](purism/librem/13v3) | `` | -| [Purism Librem 5r4](purism/librem/5r4) | `` | -| [Radxa ROCK 4C+](radxa/rock-4c-plus) | `` | -| [Raspberry Pi 2](raspberry-pi/2) | `` | -| [Raspberry Pi 3](raspberry-pi/3) | `` | -| [Raspberry Pi 4](raspberry-pi/4) | `` | -| [Raspberry Pi 5](raspberry-pi/5) | `` | -| [Samsung Series 9 NP900X3C](samsung/np900x3c) | `` | -| [Slimbook Hero RPL-RTX](slimbook/hero/rpl-rtx) | `` | -| [StarFive VisionFive v1](starfive/visionfive/v1) | `` | -| [StarFive VisionFive 2](starfive/visionfive/v2) | `` | -| [StarLabs StarLite 5 (I5)](starlabs/starlite/i5) | `` | -| [Supermicro A1SRi-2758F](supermicro/a1sri-2758f) | `` | -| [Supermicro M11SDV-8C-LN4F](supermicro/m11sdv-8c-ln4f) | `` | -| [Supermicro X10SLL-F](supermicro/x10sll-f) | `` | -| [Supermicro X12SCZ-TLN4F](supermicro/x12scz-tln4f) | `` | -| [System76 (generic)](system76) | `` | -| [System76 Darter Pro 6](system76/darp6) | `` | -| [System76 Gazelle 18](system76/gaze18) | `` | -| [System76 Galago Pro 5](system76/galp5-1650) | `` | -| [Toshiba Chromebook 2 `swanky`](toshiba/swanky) | `` | -| [Tuxedo InfinityBook v4](tuxedo/infinitybook/v4) | `` | -| [TUXEDO Aura 15 - Gen1](tuxedo/aura/15/gen1) | `` | -| [TUXEDO InfinityBook Pro 14 - Gen7](tuxedo/infinitybook/pro14/gen7) | `` | -| [TUXEDO Pulse 14 - Gen3](tuxedo/pulse/14/gen3) | `` | -| [TUXEDO Pulse 15 - Gen2](tuxedo/pulse/15/gen2) | `` | -| [Xiaomi Redmibook 16 Pro 2024](xiaomi/redmibook/16-pro-2024) | `` | +| Model | Path | Flake Module | +| --------------------------------------------------------------------------------- | ------------------------------------------------------- | ---------------------------------- | +| [Acer Aspire 4810T](acer/aspire/4810t) | `` | `acer-aspire-4810t` | +| [Airis N990](airis/n990) | `` | `airis-n990` | +| [Apple iMac 14.2](apple/imac/14-2) | `` | `apple-imac-14-2` | +| [Apple iMac 18.2](apple/imac/18-2) | `` | `apple-imac-18-2` | +| [Apple MacBook Air 3,X](apple/macbook-air/3) | `` | `apple-macbook-air-3` | +| [Apple MacBook Air 4,X](apple/macbook-air/4) | `` | `apple-macbook-air-4` | +| [Apple MacBook Air 6,X](apple/macbook-air/6) | `` | `apple-macbook-air-6` | +| [Apple MacBook Air 7,X](apple/macbook-air/7) | `` | `apple-macbook-air-7` | +| [Apple MacBook Pro 8,1](apple/macbook-pro/8-1) | `` | `apple-macbook-pro-8-1` | +| [Apple MacBook Pro 10,1](apple/macbook-pro/10-1) | `` | `apple-macbook-pro-10-1` | +| [Apple MacBook Pro 11,1](apple/macbook-pro/11-1) | `` | `apple-macbook-pro-11-1` | +| [Apple MacBook Pro 11,5](apple/macbook-pro/11-5) | `` | `apple-macbook-pro-11-5` | +| [Apple MacBook Pro 12,1](apple/macbook-pro/12-1) | `` | `apple-macbook-pro-12-1` | +| [Apple MacBook Pro 14,1](apple/macbook-pro/14-1) | `` | `apple-macbook-pro-14-1` | +| [Apple MacMini (2010, Intel, Nvidia)](apple/macmini/4) | `` | `apple-macmini-4-1` | +| [Apple Macs with a T2 Chip](apple/t2) | `` | `apple-t2` | +| [Aoostar R1 N100](aoostar/r1/n100) | `` | `aoostar-r1-n100` | +| [Asus Pro WS X570-ACE](asus/pro-ws-x570-ace) | `` | `asus-pro-ws-x570-ace` | +| [Asus ROG Ally RC71L (2023)](asus/ally/rc71l) | `` | `asus-ally-rc71l` | +| [Asus ROG Flow X13 GV302X\* (2023)](asus/flow/gv302x/amdgpu) | `` | `asus-flow-gv302x-amdgpu` | +| [Asus ROG Flow X13 GV302X\* (2023)](asus/flow/gv302x/nvidia) | `` | `asus-flow-gv302x-nvidia` | +| [Asus ROG Strix G513IM](asus/rog-strix/g513im) | `` | `asus-rog-strix-g513im` | +| [Asus ROG Strix G533ZW](asus/rog-strix/g533zw) | `` | `asus-rog-strix-g533zw` | +| [Asus ROG Strix G713IE](asus/rog-strix/g713ie) | `` | `asus-rog-strix-g713ie` | +| [Asus ROG Strix G733QS](asus/rog-strix/g733qs) | `` | `asus-rog-strix-g733qs` | +| [Asus ROG Strix X570-E GAMING](asus/rog-strix/x570e) | `` | `asus-rog-strix-x570e` | +| [Asus ROG Zephyrus G14 GA401](asus/zephyrus/ga401) | `` | `asus-zephyrus-ga401` | +| [Asus ROG Zephyrus G14 GA402](asus/zephyrus/ga402) | `` | `asus-zephyrus-ga402` | +| [Asus ROG Zephyrus G14 GA402X\* (2023)](asus/zephyrus/ga402x/amdgpu) | `` | `asus-zephyrus-ga402x-amdgpu` | +| [Asus ROG Zephyrus G14 GA402X\* (2023)](asus/zephyrus/ga402x/nvidia) | `` | `asus-zephyrus-ga402x-nvidia` | +| [Asus ROG Zephyrus G15 GA502](asus/zephyrus/ga502) | `` | `asus-zephyrus-ga502` | +| [Asus ROG Zephyrus G15 GA503](asus/zephyrus/ga503) | `` | `asus-zephyrus-ga503` | +| [Asus ROG Zephyrus G16 GU605MY](asus/zephyrus/gu605my) | `` | `asus-zephyrus-gu605my` | +| [Asus ROG Zephyrus M16 GU603H](asus/zephyrus/gu603h) | `` | `asus-zephyrus-gu603h` | +| [Asus TUF FX504GD](asus/fx504gd) | `` | `asus-fx504gd` | +| [Asus TUF FX506HM](asus/fx506hm) | `` | `asus-fx506hm` | +| [Asus TUF FA506IC](asus/fa506ic) | `` | `asus-fa506ic` | +| [Asus TUF FA507RM](asus/fa507rm) | `` | `asus-fa507rm` | +| [Asus TUF FA507NV](asus/fa507nv) | `` | `asus-fa507nv` | +| [Asus Zenbook Duo 14 UX481](asus/zenbook/ux481/intelgpu/) | `` | `asus-zenbook-ux481-intelgpu` | +| [Asus Zenbook Duo 14 UX481](asus/zenbook/ux481/nvidia/) | `` | `asus-zenbook-ux481-nvidia` | +| [Asus Zenbook Flip S13 UX371](asus/zenbook/ux371/) | `` | `asus-zenbook-ux371` | +| [Asus Zenbook Pro 15 UX535](asus/zenbook/ux535/) | `` | `asus-zenbook-ux535` | +| [BeagleBoard PocketBeagle](beagleboard/pocketbeagle) | `` | `beagleboard-pocketbeagle` | +| [Chuwi MiniBook X](chuwi/minibook-x) | `` | `chuwi-minibook-x` | +| [Deciso DEC series](deciso/dec) | `` | `deciso-dec` | +| [Dell G3 3779](dell/g3/3779) | `` | `dell-g3-3779` | +| [Dell G3 3579](dell/g3/3579) | `` | `dell-g3-3579` | +| [Dell Inspiron 3442](dell/inspiron/3442) | `` | `dell-inspiron-3442` | +| [Dell Inspiron 14 5420](dell/inspiron/14-5420) | `` | `dell-inspiron-14-5420` | +| [Dell Inspiron 5509](dell/inspiron/5509) | `` | `dell-inspiron-5509` | +| [Dell Inspiron 5515](dell/inspiron/5515) | `` | `dell-inspiron-5515` | +| [Dell Inspiron 7405](dell/inspiron/7405) | `` | `dell-inspiron-7405` | +| [Dell Inspiron 7460](dell/inspiron/7460) | `` | `dell-inspiron-7460` | +| [Dell Inspiron 7559](dell/inspiron/7559) | `` | `dell-inspiron-7559` | +| [Dell Latitude 3340](dell/latitude/3340) | `` | `dell-latitude-3340` | +| [Dell Latitude 3480](dell/latitude/3480) | `` | `dell-latitude-3480` | +| [Dell Latitude 5490](dell/latitude/5490) | `` | `dell-latitude-5490` | +| [Dell Latitude 5520](dell/latitude/5520) | `` | `dell-latitude-5520` | +| [Dell Latitude 7280](dell/latitude/7280) | `` | `dell-latitude-7280` | +| [Dell Latitude 7390](dell/latitude/7390) | `` | `dell-latitude-7390` | +| [Dell Latitude 7420](dell/latitude/7420) | `` | `dell-latitude-7420` | +| [Dell Latitude 7430](dell/latitude/7430) | `` | `dell-latitude-7430` | +| [Dell Latitude 7490](dell/latitude/7490) | `` | `dell-latitude-7490` | +| [Dell Latitude 9430](dell/latitude/9430) | `` | `dell-latitude-9430` | +| [Dell Latitude E7240](dell/latitude/e7240) | `` | `dell-latitude-e7240` | +| [Dell Optiplex 3050](dell/optiplex/3050) | `` | `dell-optiplex-3050` | +| [Dell Poweredge R7515](dell/poweredge/r7515) | `` | `dell-poweredge-r7515` | +| [Dell Precision 3490, nvidia](dell/precision/3490/nvidia) | `` | `dell-precision-3490-nvidia` | +| [Dell Precision 3490, intel](dell/precision/3490/intel) | `` | `dell-precision-3490-intel` | +| [Dell Precision 3541](dell/precision/3541) | `` | `dell-precision-3541` | +| [Dell Precision 5490](dell/precision/5490) | `` | `dell-precision-5490` | +| [Dell Precision 5530](dell/precision/5530) | `` | `dell-precision-5530` | +| [Dell Precision 7520](dell/precision/7520) | `` | `dell-precision-7520` | +| [Dell XPS 13 7390](dell/xps/13-7390) | `` | `dell-xps-13-7390` | +| [Dell XPS 13 9300](dell/xps/13-9300) | `` | `dell-xps-13-9300` | +| [Dell XPS 13 9310](dell/xps/13-9310) | `` | `dell-xps-13-9310` | +| [Dell XPS 13 9315](dell/xps/13-9315) | `` | `dell-xps-13-9315` | +| [Dell XPS 13 9333](dell/xps/13-9333) | `` | `dell-xps-13-9333` | +| [Dell XPS 13 9343](dell/xps/13-9343) | `` | `dell-xps-13-9343` | +| [Dell XPS 13 9350](dell/xps/13-9350) | `` | `dell-xps-13-9350` | +| [Dell XPS 13 9360](dell/xps/13-9360) | `` | `dell-xps-13-9360` | +| [Dell XPS 13 9370](dell/xps/13-9370) | `` | `dell-xps-13-9370` | +| [Dell XPS 13 9380](dell/xps/13-9380) | `` | `dell-xps-13-9380` | +| [Dell XPS 15 7590, nvidia](dell/xps/15-7590/nvidia) | `` | `dell-xps-15-7590-nvidia` | +| [Dell XPS 15 7590](dell/xps/15-7590) | `` | `dell-xps-15-7590` | +| [Dell XPS 15 9500, nvidia](dell/xps/15-9500/nvidia) | `` | `dell-xps-15-9500-nvidia` | +| [Dell XPS 15 9500](dell/xps/15-9500) | `` | `dell-xps-15-9500` | +| [Dell XPS 15 9510, nvidia](dell/xps/15-9510/nvidia) | `` | `dell-xps-15-9510-nvidia` | +| [Dell XPS 15 9510](dell/xps/15-9510) | `` | `dell-xps-15-9510` | +| [Dell XPS 15 9520, nvidia](dell/xps/15-9520/nvidia) | `` | `dell-xps-15-9520-nvidia` | +| [Dell XPS 15 9520](dell/xps/15-9520) | `` | `dell-xps-15-9520` | +| [Dell XPS 15 9530, nvidia](dell/xps/15-9530/nvidia) | `` | `dell-xps-15-9530-nvidia` | +| [Dell XPS 15 9530](dell/xps/15-9530) | `` | `dell-xps-15-9530` | +| [Dell XPS 15 9550, nvidia](dell/xps/15-9550/nvidia) | `` | `dell-xps-15-9550-nvidia` | +| [Dell XPS 15 9550](dell/xps/15-9550) | `` | `dell-xps-15-9550` | +| [Dell XPS 15 9560, intel only](dell/xps/15-9560/intel) | `` | `dell-xps-15-9560-intel` | +| [Dell XPS 15 9560, nvidia only](dell/xps/15-9560/nvidia) | `` | `dell-xps-15-9560-nvidia` | +| [Dell XPS 15 9560](dell/xps/15-9560) | `` | `dell-xps-15-9560` | +| [Dell XPS 15 9570, intel only](dell/xps/15-9570/intel) | `` | `dell-xps-15-9570-intel` | +| [Dell XPS 15 9570, nvidia](dell/xps/15-9570/nvidia) | `` | `dell-xps-15-9570-nvidia` | +| [Dell XPS 15 9570](dell/xps/15-9570) | `` | `dell-xps-15-9570` | +| [Dell XPS 17 9700, intel](dell/xps/17-9700/intel) | `` | `dell-xps-17-9700-nvidia` | +| [Dell XPS 17 9710, intel only](dell/xps/17-9710/intel) | `` | `dell-xps-17-9710-intel` | +| [Framework 11th Gen Intel Core](framework/13-inch/11th-gen-intel) | `` | `framework-11th-gen-intel` | +| [Framework 12th Gen Intel Core](framework/12-inch/13th-gen-intel) | `` | `framework-12th-gen-intel` | +| [Framework 13th Gen Intel Core](framework/13-inch/13th-gen-intel) | `` | `framework-13th-gen-intel` | +| [Framework Intel Core Ultra Series 1](framework/13-inch/intel-core-ultra-series1) | `` | `framework-intel-core-ultra-series1` | +| [Framework 13 AMD Ryzen 7040 Series](framework/13-inch/7040-amd) | `` | `framework-13-7040-amd` | +| [Framework 13 AMD AI 300 Series](framework/13-inch/amd-ai-300-series) | `` | `framework-amd-ai-300-series` | +| [Framework 12 13th Gen Intel Core](framework/12-inch/13th-gen-intel) | `` | `framework-12-13th-gen-intel` | +| [Framework 16 AMD Ryzen 7040 Series](framework/16-inch/7040-amd) | `` | `framework-16-7040-amd` | +| [FriendlyARM NanoPC-T4](friendlyarm/nanopc-t4) | `` | `friendlyarm-nanopc-t4` | +| [FriendlyARM NanoPi R5s](friendlyarm/nanopi-r5s) | `` | `friendlyarm-nanopi-r5s` | +| [Focus M2 Gen 1](focus/m2/gen1) | `` | `focus-m2-gen1` | +| [Gigabyte B550](gigabyte/b550) | `` | `gigabyte-b550` | +| [Gigabyte B650](gigabyte/b650) | `` | `gigabyte-b650` | +| [GMKtec NucBox G3 Plus](gmktec/nucbox/g3-plus) | `` | `gmktec-nucbox-g3-plus` | +| [GPD MicroPC](gpd/micropc) | `` | `gpd-micropc` | +| [GPD P2 Max](gpd/p2-max) | `` | `gpd-p2-max` | +| [GPD Pocket 3](gpd/pocket-3) | `` | `gpd-pocket-3` | +| [GPD Pocket 4](gpd/pocket-4) | `` | `gpd-pocket-4` | +| [GPD WIN 2](gpd/win-2) | `` | `gpd-win-2` | +| [GPD WIN Max 2 2023](gpd/win-max-2/2023) | `` | `gpd-win-max-2-2023` | +| [GPD WIN Mini 2024](gpd/win-mini/2024) | `` | `gpd-win-mini-2024` | +| [Google Pixelbook](google/pixelbook) | `` | `google-pixelbook` | +| [HP Elitebook 2560p](hp/elitebook/2560p) | `` | `hp-elitebook-2560p` | +| [HP Elitebook 830g6](hp/elitebook/830/g6) | `` | `hp-elitebook-830g6` | +| [HP Elitebook 845g7](hp/elitebook/845/g7) | `` | `hp-elitebook-845g7` | +| [HP Elitebook 845g8](hp/elitebook/845/g8) | `` | `hp-elitebook-845g8` | +| [HP Elitebook 845g9](hp/elitebook/845/g9) | `` | `hp-elitebook-845g9` | +| [HP Laptop 14s-dq2024nf](hp/laptop/14s-dq2024nf) | `` | `hp-laptop-14s-dq2024nf` | +| [HP Notebook 14-df0023](hp/notebook/14-df0023) | `` | `hp-notebook-14-df0023` | +| [HP Probook 440G5](hp/probook/440g5) | `` | `hp-probook-440G5` | +| [Huawei Matebook X Pro (2020)](huawei/machc-wa) | `` | `huawei-machc-wa` | +| [i.MX8QuadMax Multisensory Enablement Kit](nxp/imx8qm-mek/) | `` | `nxp-imx8qm-mek` | +| [Intel NUC 8i7BEH](intel/nuc/8i7beh/) | `` | `intel-nuc-8i7beh` | +| [Lenovo IdeaCentre K330](lenovo/ideacentre/k330) | `` | `lenovo-ideacentre-k330` | +| [Lenovo IdeaPad 3 15alc6](lenovo/ideapad/15alc6) | `` | `lenovo-ideapad-15alc6` | +| [Lenovo IdeaPad Gaming 3 15arh05](lenovo/ideapad/15arh05) | `` | `lenovo-ideapad-15arh05` | +| [Lenovo IdeaPad Gaming 3 15ach6](lenovo/ideapad/15ach6) | `` | `lenovo-ideapad-15ach6` | +| [Lenovo IdeaPad 5 Pro 14imh9](lenovo/ideapad/14imh9) | `` | `lenovo-ideapad-14imh9` | +| [Lenovo IdeaPad 5 Pro 16ach6](lenovo/ideapad/16ach6) | `` | `lenovo-ideapad-16ach6` | +| [Lenovo IdeaPad Z510](lenovo/ideapad/z510) | `` | `lenovo-ideapad-z510` | +| [Lenovo IdeaPad Slim 5](lenovo/ideapad/slim-5) | `` | `lenovo-ideapad-slim-5` | +| [Lenovo IdeaPad Slim 5 16iah8](lenovo/ideapad/16iah8) | `` | `lenovo-ideapad-16ahp9` | +| [Lenovo IdeaPad S145 15api](lenovo/ideapad/s145-15api) | `` | `lenovo-ideapad-s145-15api` | +| [Lenovo Legion 5 15ach6h](lenovo/legion/15ach6h) | `` | `lenovo-legion-15ach6h` | +| [Lenovo Legion 5 15arh05h](lenovo/legion/15arh05h) | `` | `lenovo-legion-15arh05h` | +| [Lenovo Legion 7 Slim 15ach6](lenovo/legion/15ach6) | `` | `lenovo-legion-15ach6` | +| [Lenovo Legion 5 Pro 16ach6h](lenovo/legion/16ach6h) | `` | `lenovo-legion-16ach6h` | +| [Lenovo Legion 5 Pro 16ach6h (Hybrid)](lenovo/legion/16ach6h/hybrid) | `` | `lenovo-legion-16ach6h-hybrid` | +| [Lenovo Legion 5 Pro 16ach6h (Nvidia)](lenovo/legion/16ach6h/nvidia) | `` | `lenovo-legion-16ach6h-nvidia` | +| [Lenovo Legion 5 Pro 16arh7h (IGPU Only)](lenovo/legion/16arh7h/igpu-only) | `` | `lenovo-legion-16arh7h-igpu-only` | +| [Lenovo Legion 5 Pro 16arh7h (Hybrid)](lenovo/legion/16arh7h/hybrid) | `` | `lenovo-legion-16arh7h-hybrid` | +| [Lenovo Legion 5 Pro 16IAH7H (Intel)](lenovo/legion/16iah7h/) | `` | `lenovo-legion-16iah7h` | +| [Lenovo Legion 7 16achg6 (Hybrid)](lenovo/legion/16achg6/hybrid) | `` | `lenovo-legion-16achg6-hybrid` | +| [Lenovo Legion 7 16achg6 (Nvidia)](lenovo/legion/16achg6/nvidia) | `` | `lenovo-legion-16achg6-nvidia` | +| [Lenovo Legion 7i Pro 16irx8h (Intel)](lenovo/legion/16irx8h) | `` | `lenovo-legion-16irx8h` | +| [Lenovo Legion 7 Pro 16irx9h (Intel)](lenovo/legion/16irx9h) | `` | `lenovo-legion-16irx9h` | +| [Lenovo Legion Slim 7 Gen 7 (AMD)](lenovo/legion/16arha7/) | `` | `lenovo-legion-16arha7` | +| [Lenovo Legion T5 AMR5](lenovo/legion/t526amr5) | `` | `lenovo-legion-t526amr5` | +| [Lenovo Legion Y530 15ICH](lenovo/legion/15ich) | `` | `lenovo-legion-15ich` | +| [Lenovo ThinkPad A475](lenovo/thinkpad/a475) | `` | `lenovo-thinkpad-a475` | +| [Lenovo ThinkPad E14 (AMD)](lenovo/thinkpad/e14/amd) | `` | `lenovo-thinkpad-e14-amd` | +| [Lenovo ThinkPad E14 (Intel - Gen 1)](lenovo/thinkpad/e14/intel) | `` | `lenovo-thinkpad-e14-intel` | +| [Lenovo ThinkPad E14 (Intel - Gen 4)](lenovo/thinkpad/e14/intel/gen4) | `` | `lenovo-thinkpad-e14-intel-gen4` | +| [Lenovo ThinkPad E14 (Intel - Gen 6)](lenovo/thinkpad/e14/intel/gen6) | `` | `lenovo-thinkpad-e14-intel-gen6` | +| [Lenovo ThinkPad E15 (Intel)](lenovo/thinkpad/e15/intel) | `` | `lenovo-thinkpad-e15-intel` | +| [Lenovo ThinkPad E470](lenovo/thinkpad/e470) | `` | `lenovo-thinkpad-e470` | +| [Lenovo ThinkPad E495](lenovo/thinkpad/e495) | `` | `lenovo-thinkpad-e495` | +| [Lenovo ThinkPad L13 Yoga](lenovo/thinkpad/l13/yoga) | `` | `lenovo-thinkpad-l13-yoga` | +| [Lenovo ThinkPad L13](lenovo/thinkpad/l13) | `` | `lenovo-thinkpad-l13` | +| [Lenovo ThinkPad L14 (AMD)](lenovo/thinkpad/l14/amd) | `` | `lenovo-thinkpad-l14-amd` | +| [Lenovo ThinkPad L14 (Intel)](lenovo/thinkpad/l14/intel) | `` | `lenovo-thinkpad-l14-intel` | +| [Lenovo ThinkPad L480](lenovo/thinkpad/l480) | `` | `lenovo-thinkpad-l480` | +| [Lenovo ThinkPad P1 Gen 3](lenovo/thinkpad/p1/3th-gen) | `` | `lenovo-thinkpad-p1-gen3` | +| [Lenovo ThinkPad P14s AMD Gen 1](lenovo/thinkpad/p14s/amd/gen1) | `` | `lenovo-thinkpad-p14s-amd-gen1` | +| [Lenovo ThinkPad P14s AMD Gen 2](lenovo/thinkpad/p14s/amd/gen2) | `` | `lenovo-thinkpad-p14s-amd-gen2` | +| [Lenovo ThinkPad P14s AMD Gen 3](lenovo/thinkpad/p14s/amd/gen3) | `` | `lenovo-thinkpad-p14s-amd-gen3` | +| [Lenovo ThinkPad P14s AMD Gen 4](lenovo/thinkpad/p14s/amd/gen4) | `` | `lenovo-thinkpad-p14s-amd-gen4` | +| [Lenovo ThinkPad P14s AMD Gen 5](lenovo/thinkpad/p14s/amd/gen5) | `` | `lenovo-thinkpad-p14s-amd-gen5` | +| [Lenovo ThinkPad P14s Intel Gen 3](lenovo/thinkpad/p14s/intel/gen3) | `` | `lenovo-thinkpad-p14s-intel-gen3`| +| [Lenovo ThinkPad P14s Intel Gen 5](lenovo/thinkpad/p14s/intel/gen5) | `` | `lenovo-thinkpad-p14s-intel-gen5`| +| [Lenovo ThinkPad P16s AMD Gen 1](lenovo/thinkpad/p16s/amd/gen1) | `` | `lenovo-thinkpad-p16s-amd-gen1` | +| [Lenovo ThinkPad P16s AMD Gen 2](lenovo/thinkpad/p16s/amd/gen2) | `` | `lenovo-thinkpad-p16s-amd-gen2` | +| [Lenovo ThinkPad P16s Intel Gen 2](lenovo/thinkpad/p16s/intel/gen2) | `` | `lenovo-thinkpad-p16s-intel-gen2`| +| [Lenovo ThinkPad P1](lenovo/thinkpad/p1) | `` | `lenovo-thinkpad-p1` | +| [Lenovo ThinkPad P43s](lenovo/thinkpad/p43s) | `` | `lenovo-thinkpad-p43s` | +| [Lenovo ThinkPad P50](lenovo/thinkpad/p50) | `` | `lenovo-thinkpad-p50` | +| [Lenovo ThinkPad P51](lenovo/thinkpad/p51) | `` | `lenovo-thinkpad-p51` | +| [Lenovo ThinkPad P52](lenovo/thinkpad/p52) | `` | `lenovo-thinkpad-p52` | +| [Lenovo ThinkPad P53](lenovo/thinkpad/p53) | `` | `lenovo-thinkpad-p53` | +| [Lenovo ThinkPad T14 AMD Gen 1](lenovo/thinkpad/t14/amd/gen1) | `` | `lenovo-thinkpad-t14-amd-gen1` | +| [Lenovo ThinkPad T14 AMD Gen 2](lenovo/thinkpad/t14/amd/gen2) | `` | `lenovo-thinkpad-t14-amd-gen2` | +| [Lenovo ThinkPad T14 AMD Gen 3](lenovo/thinkpad/t14/amd/gen3) | `` | `lenovo-thinkpad-t14-amd-gen3` | +| [Lenovo ThinkPad T14 AMD Gen 4](lenovo/thinkpad/t14/amd/gen4) | `` | `lenovo-thinkpad-t14-amd-gen4` | +| [Lenovo ThinkPad T14 AMD Gen 5](lenovo/thinkpad/t14/amd/gen5) | `` | `lenovo-thinkpad-t14-amd-gen5` | +| [Lenovo ThinkPad T14](lenovo/thinkpad/t14) | `` | `lenovo-thinkpad-t14` | +| [Lenovo ThinkPad T14s AMD Gen 1](lenovo/thinkpad/t14s/amd/gen1) | `` | `lenovo-thinkpad-t14s-amd-gen1` | +| [Lenovo ThinkPad T14s AMD Gen 4](lenovo/thinkpad/t14s/amd/gen4) | `` | `lenovo-thinkpad-t14s-amd-gen4` | +| [Lenovo ThinkPad T14s](lenovo/thinkpad/t14s) | `` | `lenovo-thinkpad-t14s` | +| [Lenovo ThinkPad T410](lenovo/thinkpad/t410) | `` | `lenovo-thinkpad-t410` | +| [Lenovo ThinkPad T420](lenovo/thinkpad/t420) | `` | `lenovo-thinkpad-t420` | +| [Lenovo ThinkPad T430](lenovo/thinkpad/t430) | `` | `lenovo-thinkpad-t430` | +| [Lenovo ThinkPad T440p](lenovo/thinkpad/t440p) | `` | `lenovo-thinkpad-t440p` | +| [Lenovo ThinkPad T440s](lenovo/thinkpad/t440s) | `` | `lenovo-thinkpad-t440s` | +| [Lenovo ThinkPad T450s](lenovo/thinkpad/t450s) | `` | `lenovo-thinkpad-t450s` | +| [Lenovo ThinkPad T460](lenovo/thinkpad/t460) | `` | `lenovo-thinkpad-t460` | +| [Lenovo ThinkPad T460p](lenovo/thinkpad/t460p) | `` | `lenovo-thinkpad-t460p` | +| [Lenovo ThinkPad T460s](lenovo/thinkpad/t460s) | `` | `lenovo-thinkpad-t460s` | +| [Lenovo ThinkPad T470s](lenovo/thinkpad/t470s) | `` | `lenovo-thinkpad-t470s` | +| [Lenovo ThinkPad T480](lenovo/thinkpad/t480) | `` | `lenovo-thinkpad-t480` | +| [Lenovo ThinkPad T480s](lenovo/thinkpad/t480s) | `` | `lenovo-thinkpad-t480s` | +| [Lenovo ThinkPad T490](lenovo/thinkpad/t490) | `` | `lenovo-thinkpad-t490` | +| [Lenovo ThinkPad T490s](lenovo/thinkpad/t490s) | `` | `lenovo-thinkpad-t490s` | +| [Lenovo ThinkPad T495](lenovo/thinkpad/t495) | `` | `lenovo-thinkpad-t495` | +| [Lenovo ThinkPad T520](lenovo/thinkpad/t520) | `` | `lenovo-thinkpad-t520` | +| [Lenovo ThinkPad T550](lenovo/thinkpad/t550) | `` | `lenovo-thinkpad-t550` | +| [Lenovo ThinkPad T590](lenovo/thinkpad/t590) | `` | `lenovo-thinkpad-t590` | +| [Lenovo ThinkPad W520](lenovo/thinkpad/w520) | `` | `lenovo-thinkpad-w520` | +| [Lenovo ThinkPad X1 Yoga](lenovo/thinkpad/x1/yoga) | `` | `lenovo-thinkpad-x1-yoga` | +| [Lenovo ThinkPad X1 Yoga Gen 7](lenovo/thinkpad/x1/yoga/7th-gen/) | `` | `lenovo-thinkpad-x1-yoga-7th-gen` | +| [Lenovo ThinkPad X1 Yoga Gen 8](lenovo/thinkpad/x1/yoga/8th-gen/) | `` | `lenovo-thinkpad-x1-yoga-8th-gen` | +| [Lenovo ThinkPad X1 (2nd Gen)](lenovo/thinkpad/x1/2nd-gen) | `` | `lenovo-thinkpad-x1-2nd-gen` | +| [Lenovo ThinkPad X1 (6th Gen)](lenovo/thinkpad/x1/6th-gen) | `` | `lenovo-thinkpad-x1-6th-gen` | +| [Lenovo ThinkPad X1 (7th Gen)](lenovo/thinkpad/x1/7th-gen) | `` | `lenovo-thinkpad-x1-7th-gen` | +| [Lenovo ThinkPad X1 (9th Gen)](lenovo/thinkpad/x1/9th-gen) | `` | `lenovo-thinkpad-x1-9th-gen` | +| [Lenovo ThinkPad X1 (10th Gen)](lenovo/thinkpad/x1/10th-gen) | `` | `lenovo-thinkpad-x1-10th-gen` | +| [Lenovo ThinkPad X1 (11th Gen)](lenovo/thinkpad/x1/11th-gen) | `` | `lenovo-thinkpad-x1-11th-gen` | +| [Lenovo ThinkPad X1 (12th Gen)](lenovo/thinkpad/x1/12th-gen) | `` | `lenovo-thinkpad-x1-12th-gen` | +| [Lenovo ThinkPad X1 (13th Gen)](lenovo/thinkpad/x1/13th-gen) | `` | `lenovo-thinkpad-x1-13th-gen` | +| [Lenovo ThinkPad X1 Extreme Gen 2](lenovo/thinkpad/x1-extreme/gen2) | `` | `lenovo-thinkpad-x1-extreme-gen2` | +| [Lenovo ThinkPad X1 Extreme Gen 3](lenovo/thinkpad/x1-extreme/gen3) | `` | `lenovo-thinkpad-x1-extreme-gen3` | +| [Lenovo ThinkPad X1 Extreme Gen 4](lenovo/thinkpad/x1-extreme/gen4) | `` | `lenovo-thinkpad-x1-extreme-gen4` | +| [Lenovo ThinkPad X1 Nano Gen 1](lenovo/thinkpad/x1-nano/gen1) | `` | `lenovo-thinkpad-x1-nano-gen1` | +| [Lenovo ThinkPad X13s](lenovo/thinkpad/x13s) | `` | `lenovo-thinkpad-x13s` | +| [Lenovo ThinkPad X13 Yoga](lenovo/thinkpad/x13/yoga) | `` | `lenovo-thinkpad-x13-yoga` | +| [Lenovo ThinkPad X13 Yoga (3th Gen)](lenovo/thinkpad/x13/yoga/3th-gen) | `` | `lenovo-thinkpad-x13-yoga-3th-gen` | +| [Lenovo ThinkPad X13 (Intel)](lenovo/thinkpad/x13/intel) | `` | `lenovo-thinkpad-x13-intel` | +| [Lenovo ThinkPad X13 (AMD)](lenovo/thinkpad/x13/amd) | `` | `lenovo-thinkpad-x13-amd` | +| [Lenovo ThinkPad X140e](lenovo/thinkpad/x140e) | `` | `lenovo-thinkpad-x140e` | +| [Lenovo ThinkPad X200s](lenovo/thinkpad/x200s) | `` | `lenovo-thinkpad-x200s` | +| [Lenovo ThinkPad X220](lenovo/thinkpad/x220) | `` | `lenovo-thinkpad-x220` | +| [Lenovo ThinkPad X230](lenovo/thinkpad/x230) | `` | `lenovo-thinkpad-x230` | +| [Lenovo ThinkPad X250](lenovo/thinkpad/x250) | `` | `lenovo-thinkpad-x250` | +| [Lenovo ThinkPad X260](lenovo/thinkpad/x260) | `` | `lenovo-thinkpad-x260` | +| [Lenovo ThinkPad X270](lenovo/thinkpad/x270) | `` | `lenovo-thinkpad-x270` | +| [Lenovo ThinkPad X280](lenovo/thinkpad/x280) | `` | `lenovo-thinkpad-x280` | +| [Lenovo ThinkPad X390](lenovo/thinkpad/x390) | `` | `lenovo-thinkpad-x390` | +| [Lenovo ThinkPad Z Series](lenovo/thinkpad/z) | `` | `lenovo-thinkpad-z` | +| [Lenovo ThinkPad Z13 Gen 1](lenovo/thinkpad/z/gen1/z13) | `` | `lenovo-thinkpad-z-gen1-z13` | +| [Lenovo ThinkPad Z13 Gen 2](lenovo/thinkpad/z/gen2/z13) | `` | `lenovo-thinkpad-z-gen2-z13` | +| [Lenovo XiaoXin Pro 14imh9 2024](lenovo/ideapad/14imh9) | `` | `lenovo-ideapad-14imh9` | +| [LENOVO Yoga 6 13ALC6 82ND](lenovo/yoga/6/13ALC6) | `` | `lenovo-yoga-6-13ALC6` | +| [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/amdgpu) | `` | `lenovo-yoga-7-14ARH7-amdgpu` | +| [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/nvidia) | `` | `lenovo-yoga-7-14ARH7-nvidia` | +| [Lenovo Yoga Slim 7i Pro X 14IAH7 (Integrated)](lenovo/yoga/7/14IAH7/integrated) | `` | `lenovo-yoga-7-14IAH7-integrated` | +| [Lenovo Yoga Slim 7i Pro X 14IAH7 (Hybrid)](lenovo/yoga/7/14IAH7/hybrid) | `` | `lenovo-yoga-7-14IAH7-hybrid` | +| [Lenovo Yoga Slim 7 14ILL10](lenovo/yoga/7/14ILL10) | `` | `lenovo-yoga-7-14ILL10` | +| [LENOVO Yoga 7 Slim Gen8](lenovo/yoga/7/slim/gen8) | `` | `lenovo-yoga-7-slim-gen8` | +| [MSI B550-A PRO](msi/b550-a-pro) | `` | `msi-b550-a-pro` | +| [MSI B350 TOMAHAWK](msi/b350-tomahawk) | `` | `msi-b350-tomahawk` | +| [MSI GS60 2QE](msi/gs60) | `` | `msi-gs60` | +| [MSI GL62/CX62](msi/gl62) | `` | `msi-gl62` | +| [MSI GL65 10SDR-492](msi/gl65/10SDR-492) | `` | `msi-gl65-10SDR-492` | +| [Microchip Icicle Kit](microchip/icicle-kit) | `` | `microchip-icicle-kit` | +| [Microsoft Surface Go](microsoft/surface/surface-go) | `` | `microsoft-surface-surface-go` | +| [Microsoft Surface Pro (Intel)](microsoft/surface/surface-pro-intel) | `` | `microsoft-surface-surface-pro-intel` | +| [Microsoft Surface Laptop (AMD)](microsoft/surface/surface-laptop-amd) | `` | `microsoft-surface-surface-laptop-amd` | +| [Microsoft Surface Range (Common Modules)](microsoft/surface/common) | `` | `microsoft-surface-common` | +| [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | `microsoft-surface-pro-3` | +| [Microsoft Surface Pro 9](microsoft/surface-pro/9) | `` | `microsoft-surface-pro-9` | +| [Morefine M600](morefine/m600) | `` | `morefine-m600` | +| [Minisforum V3](minisforum/v3) | `` | `minisforum-v3` | +| [NXP iMX8 MPlus Evaluation Kit](nxp/imx8mp-evk) | `` | `nxp-imx8mp-evk` | +| [NXP iMX8 MQuad Evaluation Kit](nxp/imx8mq-evk) | `` | `nxp-imx8mq-evk` | +| [Hardkernel Odroid HC4](hardkernel/odroid-hc4/default.nix) | `` | `hardkernel-odroid-hc4` | +| [Hardkernel Odroid H3](hardkernel/odroid-h3/default.nix) | `` | `hardkernel-odroid-h3` | +| [Hardkernel Odroid H4](hardkernel/odroid-h4/default.nix) | `` | `hardkernel-odroid-h4` | +| [Omen 14-fb0798ng](omen/14-fb0798ng) | `` | `omen-14-fb0798ng` | +| [Omen 15-ce002ns](omen/15-ce002ns) | `` | `omen-15-ce002ns` | +| [Omen 15-en0010ca](omen/15-en0010ca) | `` | `omen-15-en0010ca` | +| [Omen 16-n0005ne](omen/16-n0005ne) | `` | `omen-16-n0005ne` | +| [Omen 16-n0280nd](/omen/16-n0280nd) | `` | `omen-16-n0280nd` | +| [Omen 15-en1007sa](omen/15-en1007sa) | `` | `omen-15-en1007sa` | +| [Omen 15-en0002np](omen/15-en0002np) | `` | `omen-15-en0002np` | +| [One-Netbook OneNetbook 4](onenetbook/4) | `` | `onenetbook-4` | +| [Panasonic Let's Note CF-LX4](panasonic/letsnote/cf-lx4) | `` | `panasonic-letsnote-cf-lx4` | +| [PC Engines APU](pcengines/apu) | `` | `pcengines-apu` | +| [PINE64 Pinebook Pro](pine64/pinebook-pro/) | `` | `pine64-pinebook-pro` | +| [PINE64 RockPro64](pine64/rockpro64/) | `` | `pine64-rockpro64` | +| [PINE64 STAR64](pine64/star64/) | `` | `pine64-star64` | +| [Protectli VP4670](protectli/vp4670/) | `` | `protectli-vp4670` | +| [Purism Librem 13v3](purism/librem/13v3) | `` | `purism-librem-13v3` | +| [Purism Librem 15v3](purism/librem/15v3) | `` | `purism-librem-15v3` | +| [Purism Librem 5r4](purism/librem/5r4) | `` | `purism-librem-5r4` | +| [Radxa ROCK 4C+](radxa/rock-4c-plus) | `` | `rock-4c-plus` | +| [Radxa ROCK 5 Model B](radxa/rock-5b) | `` | `rock-5b` | +| [Radxa ROCK Pi 4](radxa/rock-pi-4) | `` | `rock-pi-4` | +| [Radxa ROCK Pi E](radxa/rock-pi-e) | `` | `rock-pi-e`| +| [Raspberry Pi 2](raspberry-pi/2) | `` | `raspberry-pi-2`| +| [Raspberry Pi 3](raspberry-pi/3) | `` | `raspberry-pi-3`| +| [Raspberry Pi 4](raspberry-pi/4) | `` | `raspberry-pi-4`| +| [Raspberry Pi 5](raspberry-pi/5) | `` | `raspberry-pi-5`| +| [Samsung Series 9 NP900X3C](samsung/np900x3c) | `` | `samsung-np900x3c`| +| [Slimbook Hero RPL-RTX](slimbook/hero/rpl-rtx) | `` | `slimbook-hero-rpl-rtx`| +| [StarFive VisionFive v1](starfive/visionfive/v1) | `` | `starfive-visionfive-v1`| +| [StarFive VisionFive 2](starfive/visionfive/v2) | `` | `starfive-visionfive-2`| +| [StarLabs StarLite 5 (I5)](starlabs/starlite/i5) | `` | `starlabs-starlite-i5`| +| [Supermicro A1SRi-2758F](supermicro/a1sri-2758f) | `` | `supermicro-a1sri-2758f`| +| [Supermicro M11SDV-8C-LN4F](supermicro/m11sdv-8c-ln4f) | `` | `supermicro-m11sdv-8c-ln4f`| +| [Supermicro X10SLL-F](supermicro/x10sll-f) | `` | `supermicro-x10sll-f`| +| [Supermicro X12SCZ-TLN4F](supermicro/x12scz-tln4f) | `` | `supermicro-x12scz-tln4f`| +| [System76 (generic)](system76) | `` | `system76`| +| [System76 Darter Pro 6](system76/darp6) | `` | `system76-darp6`| +| [System76 Gazelle 18](system76/gaze18) | `` | `system76-gaze18`| +| [System76 Galago Pro 5](system76/galp5-1650) | `` | `system76-galp5-1650`| +| [System76 Thelio Mega](system76/thelio-mega) | `` | `system76-thelio-mega`| +| [Toshiba Chromebook 2 `swanky`](toshiba/swanky) | `` | `toshiba-swanky`| +| [Tuxedo InfinityBook v4](tuxedo/infinitybook/v4) | `` | `tuxedo-infinitybook-v4`| +| [TUXEDO Aura 15 - Gen1](tuxedo/aura/15/gen1) | `` | `tuxedo-aura-15-gen1`| +| [TUXEDO InfinityBook Pro 14 - Gen7](tuxedo/infinitybook/pro14/gen7) | `` | `tuxedo-infinitybook-pro14-gen7`| +| [TUXEDO InfinityBook Pro 14 - Gen9 - AMD](tuxedo/infinitybook/pro14/gen9/amd) | `` | `tuxedo-infinitybook-pro14-gen9-amd`| +| [TUXEDO InfinityBook Pro 14 - Gen9 - INTEL](tuxedo/infinitybook/pro14/gen9/intel) | `` | `tuxedo-infinitybook-pro14-gen9-intel`| +| [TUXEDO Pulse 14 - Gen3](tuxedo/pulse/14/gen3) | `` | `tuxedo-pulse-14-gen3`| +| [TUXEDO Pulse 15 - Gen2](tuxedo/pulse/15/gen2) | `` | `tuxedo-pulse-15-gen2`| +| [Xiaomi Redmibook 15 Pro 2021](xiaomi/redmibook/15-pro-2021) | `` | `xiaomi-redmibook-15-pro-2021`| +| [Xiaomi Redmibook 16 Pro 2024](xiaomi/redmibook/16-pro-2024) | `` | `xiaomi-redmibook-16-pro-2024`| diff --git a/airis/n990/default.nix b/airis/n990/default.nix index e4711419..ab450958 100644 --- a/airis/n990/default.nix +++ b/airis/n990/default.nix @@ -9,10 +9,10 @@ kernelParams = [ "apm=on" "acpi=on" - "vga=0x317" # 1024x768 + "vga=0x317" # 1024x768 "console=tty1" - "video=vesafb:ywrap" # Faster scroll - ]; + "video=vesafb:ywrap" # Faster scroll + ]; }; hardware.firmware = with pkgs; [ intel2200BGFirmware ]; diff --git a/aoostar/r1/n100/default.nix b/aoostar/r1/n100/default.nix new file mode 100644 index 00000000..b80e0654 --- /dev/null +++ b/aoostar/r1/n100/default.nix @@ -0,0 +1,12 @@ +{ + imports = [ + ../../../common/cpu/intel/alder-lake + ]; + + # lopter@(2025-02-06): according to sensors-detect this comes with an ITE + # IT8613E super io chip, which is not officialy supported yet. See also: + # + # - unofficial driver: https://github.com/frankcrawford/it87 + # - reddit thread on with useful information to configure pwm from the bios: + # https://www.reddit.com/r/MiniPCs/comments/1bnkg1u/aoostar_r1r7_question_does_the_fan_header_support/ +} diff --git a/apple/default.nix b/apple/default.nix index a2ee2623..5663cfeb 100644 --- a/apple/default.nix +++ b/apple/default.nix @@ -5,8 +5,7 @@ "hid_apple.iso_layout=0" ]; - hardware.facetimehd.enable = lib.mkDefault - (config.nixpkgs.config.allowUnfree or false); + hardware.facetimehd.enable = lib.mkDefault (config.nixpkgs.config.allowUnfree or false); services.mbpfan.enable = lib.mkDefault true; } diff --git a/apple/imac/18-2/default.nix b/apple/imac/18-2/default.nix index 4770e10b..6849037d 100644 --- a/apple/imac/18-2/default.nix +++ b/apple/imac/18-2/default.nix @@ -3,18 +3,24 @@ lib, pkgs, ... -}: { +}: +{ imports = [ ../. ../../../common/cpu/intel/kaby-lake ../../../common/gpu/amd ../../../common/hidpi.nix - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # apple smc (TODO: check spi) boot = { - initrd.kernelModules = ["applespi" "spi_pxa2xx_platform" "intel_lpss_pci" "applesmc" ]; + initrd.kernelModules = [ + "applespi" + "spi_pxa2xx_platform" + "intel_lpss_pci" + "applesmc" + ]; kernelParams = [ "intel_iommu=on" ]; kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.0") pkgs.linuxPackages_latest; }; diff --git a/apple/imac/default.nix b/apple/imac/default.nix index ea15175d..86d48299 100644 --- a/apple/imac/default.nix +++ b/apple/imac/default.nix @@ -3,6 +3,6 @@ ../. ../../common/cpu/intel ../../common/pc/laptop - ../../common/pc/laptop/ssd + ../../common/pc/ssd ]; } diff --git a/apple/macbook-air/3/default.nix b/apple/macbook-air/3/default.nix index 9589e762..72fbdb31 100644 --- a/apple/macbook-air/3/default.nix +++ b/apple/macbook-air/3/default.nix @@ -1,7 +1,7 @@ { config, lib, ... }: { - imports = [ + imports = [ ../../. ../../../common/cpu/intel ../../../common/pc/laptop diff --git a/apple/macbook-air/7/default.nix b/apple/macbook-air/7/default.nix index f6c82282..f6dd654a 100644 --- a/apple/macbook-air/7/default.nix +++ b/apple/macbook-air/7/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ diff --git a/apple/macbook-air/default.nix b/apple/macbook-air/default.nix index ea15175d..86d48299 100644 --- a/apple/macbook-air/default.nix +++ b/apple/macbook-air/default.nix @@ -3,6 +3,6 @@ ../. ../../common/cpu/intel ../../common/pc/laptop - ../../common/pc/laptop/ssd + ../../common/pc/ssd ]; } diff --git a/apple/macbook-pro/10-1/default.nix b/apple/macbook-pro/10-1/default.nix index 08302289..8967b1cb 100644 --- a/apple/macbook-pro/10-1/default.nix +++ b/apple/macbook-pro/10-1/default.nix @@ -3,7 +3,7 @@ { imports = [ ../. - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../../common/gpu/24.05-compat.nix ../../../common/gpu/nvidia/kepler ]; diff --git a/apple/macbook-pro/11-1/default.nix b/apple/macbook-pro/11-1/default.nix index 17525084..6c9509b2 100644 --- a/apple/macbook-pro/11-1/default.nix +++ b/apple/macbook-pro/11-1/default.nix @@ -2,7 +2,7 @@ { imports = [ ../. - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../../common/cpu/intel/haswell ]; diff --git a/apple/macbook-pro/11-5/default.nix b/apple/macbook-pro/11-5/default.nix index 81eda9b2..0dcd557f 100644 --- a/apple/macbook-pro/11-5/default.nix +++ b/apple/macbook-pro/11-5/default.nix @@ -9,7 +9,7 @@ in { imports = [ ../. - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Enable broadcom-43xx firmware @@ -18,7 +18,6 @@ in services.udev.extraRules = # Disable XHC1 wakeup signal to avoid resume getting triggered some time # after suspend. Reboot required for this to take effect. - lib.optionalString - (lib.versionAtLeast kernelPackages.kernel.version "3.13") + lib.optionalString (lib.versionAtLeast kernelPackages.kernel.version "3.13") ''SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"''; } diff --git a/apple/macbook-pro/12-1/default.nix b/apple/macbook-pro/12-1/default.nix index 7497b2ff..e48dbc24 100644 --- a/apple/macbook-pro/12-1/default.nix +++ b/apple/macbook-pro/12-1/default.nix @@ -1,9 +1,14 @@ -{ lib, pkgs, modulesPath, ... }: +{ + lib, + pkgs, + modulesPath, + ... +}: { imports = [ ../. - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd "${modulesPath}/hardware/network/broadcom-43xx.nix" ]; @@ -19,7 +24,7 @@ powerDownCommands = lib.mkBefore '' ${pkgs.kmod}/bin/rmmod -f -v brcmfmac_wcc 2>/dev/null || true ${pkgs.kmod}/bin/rmmod brcmfmac - ''; + ''; }; # USB subsystem wakes up MBP right after suspend unless we disable it. diff --git a/apple/macbook-pro/14-1/default.nix b/apple/macbook-pro/14-1/default.nix index cec9e262..ad8c5d1d 100644 --- a/apple/macbook-pro/14-1/default.nix +++ b/apple/macbook-pro/14-1/default.nix @@ -3,19 +3,25 @@ lib, pkgs, ... -}: { +}: +{ imports = [ ../. ../../../common/cpu/intel/kaby-lake ../../../common/hidpi.nix - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Make the keyboard work in stage1, enable iommu # https://www.kernelconfig.io/config_keyboard_applespi boot = { - initrd.kernelModules = ["applespi" "spi_pxa2xx_platform" "intel_lpss_pci" "applesmc" ]; + initrd.kernelModules = [ + "applespi" + "spi_pxa2xx_platform" + "intel_lpss_pci" + "applesmc" + ]; kernelParams = [ "intel_iommu=on" ]; kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.0") pkgs.linuxPackages_latest; }; diff --git a/apple/macbook-pro/8-1/default.nix b/apple/macbook-pro/8-1/default.nix index bc77ea6a..0b6eef12 100644 --- a/apple/macbook-pro/8-1/default.nix +++ b/apple/macbook-pro/8-1/default.nix @@ -1,10 +1,15 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ ../. ../../../common/cpu/intel/sandy-bridge - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; networking.enableB43Firmware = lib.mkDefault true; diff --git a/apple/t2/README.md b/apple/t2/README.md index 44423955..351c6092 100644 --- a/apple/t2/README.md +++ b/apple/t2/README.md @@ -8,29 +8,5 @@ Following [this guide](https://wiki.t2linux.org/distributions/nixos/installation You can consult the [wiki](https://wiki.t2linux.org/) for information specific to T2 Macs. -## Unlocking Internal iGPU - -The `apple-set-os-loader-installer` module serves as an installer for the [`apple-set-os-loader`](https://github.com/Redecorating/apple_set_os-loader). This tool is designed to unlock the internal integrated GPU (iGPU) on certain MacBooks. See https://wiki.t2linux.org/guides/hybrid-graphics/ for more details. - -### What it Does: - -Upon activation, this module performs the following: - -- Renames the existing `BOOTX64.EFI` file to `bootx64_original.efi`. -- Installs the `apple-set-os-loader` hook in its place as `bootx64.efi`. -- Before the system boots the hook unlocks the iGPU and subsequently calls the original `bootx64_original.efi`. -- Enables the iGPU by default. - -### How to Implement: - -1. Add this into your `configuration.nix`: -``` -hardware.apple-t2.enableAppleSetOsLoader = true; -``` - -2. **Rebuild your system**: -``` -sudo nixos-rebuild switch -``` - -> **Note**: Always ensure compatibility and make backups of your data before making any system changes. +> [!warning] +> Always ensure compatibility and make backups of your data before making any system changes. diff --git a/apple/t2/default.nix b/apple/t2/default.nix index 9eb8ff3c..825a181a 100644 --- a/apple/t2/default.nix +++ b/apple/t2/default.nix @@ -1,6 +1,14 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib) types; + nixosVersion = lib.versions.majorMinor lib.version; + audioFiles = pkgs.fetchFromGitHub { owner = "kekrby"; repo = "t2-better-audio"; @@ -8,19 +16,22 @@ let hash = "sha256-x7K0qa++P1e1vuCGxnsFxL1d9+nwMtZUJ6Kd9e27TFs="; }; - audioFilesUdevRules = pkgs.runCommand "audio-files-udev-rules" {} '' + audioFilesUdevRules = pkgs.runCommand "audio-files-udev-rules" { } '' mkdir -p $out/lib/udev/rules.d cp ${audioFiles}/files/*.rules $out/lib/udev/rules.d substituteInPlace $out/lib/udev/rules.d/*.rules --replace "/usr/bin/sed" "${pkgs.gnused}/bin/sed" ''; - overrideAudioFiles = package: pluginsPath: - package.overrideAttrs (new: old: { - preConfigurePhases = old.preConfigurePhases or [ ] ++ [ "postPatchPhase" ]; - postPatchPhase = '' - cp -r ${audioFiles}/files/{profile-sets,paths} ${pluginsPath}/alsa/mixer/ - ''; - }); + overrideAudioFiles = + package: pluginsPath: + package.overrideAttrs ( + _new: old: { + preConfigurePhases = old.preConfigurePhases or [ ] ++ [ "postPatchPhase" ]; + postPatchPhase = '' + cp -r ${audioFiles}/files/{profile-sets,paths} ${pluginsPath}/alsa/mixer/ + ''; + } + ); pipewirePackage = overrideAudioFiles pkgs.pipewire "spa/plugins/"; @@ -29,12 +40,12 @@ let in { imports = [ - (lib.mkRemovedOptionModule ["hardware" "apple-t2" "enableTinyDfr"] '' + (lib.mkRemovedOptionModule [ "hardware" "apple-t2" "enableTinyDfr" ] '' The hardware.apple-t2.enableTinyDfr option was deprecated and removed since upstream Nixpkgs now has an identical module. Please migrate to hardware.apple.touchBar. '') - (lib.mkRemovedOptionModule ["hardware" "apple-t2" "enableAppleSetOsLoader"] '' + (lib.mkRemovedOptionModule [ "hardware" "apple-t2" "enableAppleSetOsLoader" ] '' The hardware.apple-t2.enableAppleSetOsLoader option was removed as the apple_set_os functionality was integrated into the kernel. Please uninstall the loader by replacing /esp/EFI/BOOTX64.EFI with /esp/EFI/BOOTX64_original.EFI, where esp is the EFI partition mount point. @@ -43,20 +54,48 @@ in ]; options.hardware.apple-t2 = { enableIGPU = lib.mkEnableOption "the usage of the iGPU on specific Apple devices with an AMD dGPU"; + kernelChannel = lib.mkOption { + type = types.enum [ + "stable" + "latest" + ]; + default = "stable"; + example = "latest"; + description = "The kernel release stream to use."; + }; + firmware = { + enable = lib.mkEnableOption "automatic and declarative Wi-Fi and Bluetooth firmware configuration"; + version = lib.mkOption { + type = types.enum [ + "monterey" + "ventura" + "sonoma" + ]; + default = "sonoma"; + example = "ventura"; + description = "The macOS version to use."; + }; + }; }; config = lib.mkMerge [ { - # For keyboard and touchbar - boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./pkgs/linux-t2.nix { }); + # Specialized kernel for keyboard, touchpad, touchbar and audio. + boot.kernelPackages = pkgs.linuxPackagesFor ( + pkgs.callPackage ( + if t2Cfg.kernelChannel == "stable" then ./pkgs/linux-t2 else ./pkgs/linux-t2/latest.nix + ) { } + ); boot.initrd.kernelModules = [ "apple-bce" ]; services.udev.packages = [ audioFilesUdevRules ]; # For audio - boot.kernelParams = [ "pcie_ports=compat" "intel_iommu=on" "iommu=pt" ]; - - hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/"; + boot.kernelParams = [ + "pcie_ports=compat" + "intel_iommu=on" + "iommu=pt" + ]; services.pipewire.package = pipewirePackage; services.pipewire.wireplumber.package = pkgs.wireplumber.override { @@ -66,11 +105,29 @@ in # Make sure post-resume.service exists powerManagement.enable = true; } + + ( + if lib.versionAtLeast nixosVersion "25.05" then + { + services.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/"; + } + else + { + hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/"; + } + ) + (lib.mkIf t2Cfg.enableIGPU { # Enable the iGPU by default if present environment.etc."modprobe.d/apple-gmux.conf".text = '' options apple-gmux force_igd=y ''; }) + (lib.mkIf t2Cfg.firmware.enable { + # Configure Wi-Fi and Bluetooth firmware + hardware.firmware = [ + (pkgs.callPackage ./pkgs/brcm-firmware { version = t2Cfg.firmware.version; }) + ]; + }) ]; } diff --git a/apple/t2/pkgs/brcm-firmware/default.nix b/apple/t2/pkgs/brcm-firmware/default.nix new file mode 100644 index 00000000..742d6ff6 --- /dev/null +++ b/apple/t2/pkgs/brcm-firmware/default.nix @@ -0,0 +1,89 @@ +{ + lib, + stdenvNoCC, + callPackage, + vmTools, + util-linux, + linux, + kmod, + version, +}: + +let + get-firmware = callPackage ./get-firmware.nix { }; + fetchmacos = callPackage ./fetchmacos.nix { }; + + # See https://github.com/kholia/OSX-KVM/blob/master/fetch-macOS-v2.py#L534-L546. + # Versions before macOS Monterey don't have Bluetooth firmware. + # Whereas macOS Sequoia doesn't have firmware for MacBook Air 2018 and 2019. + boards = { + monterey = { + boardId = "Mac-B809C3757DA9BB8D"; + mlb = "00000000000000000"; + osType = "latest"; + hash = "sha256-My8FLnqHZn+THfGPIhTSApW/kIWM0ZZhjBxWujhhWPM="; + }; + ventura = { + boardId = "Mac-4B682C642B45593E"; + mlb = "00000000000000000"; + osType = "latest"; + hash = "sha256-Qy9Whu8pqHo+m6wHnCIqURAR53LYQKc0r87g9eHgnS4="; + }; + sonoma = { + boardId = "Mac-827FAC58A8FDFA22"; + mlb = "00000000000000000"; + osType = "default"; + hash = "sha256-phlpwNTYhugqX2KGljqxpbfGtCFDgggQPzB7U29XSmM="; + }; + }; +in + +vmTools.runInLinuxVM ( + stdenvNoCC.mkDerivation { + pname = "brcm-firmware"; + inherit version; + + src = fetchmacos { + name = version; + inherit (boards.${version}) + boardId + mlb + osType + hash + ; + }; + dontUnpack = true; + + nativeBuildInputs = [ + util-linux + get-firmware + ]; + buildPhase = '' + ln -s ${linux}/lib /lib + ${kmod}/bin/modprobe loop + ${kmod}/bin/modprobe hfsplus + + imgdir=$(mktemp -d) + loopdev=$(losetup -f | cut -d "/" -f 3) + losetup -P $loopdev $src + loopdev_partition=/dev/$(lsblk -o KNAME,TYPE,MOUNTPOINT -n | grep $loopdev | tail -1 | awk '{print $1}') + mount $loopdev_partition $imgdir + + get-bluetooth $imgdir/usr/share/firmware/bluetooth bluetooth/ + get-wifi $imgdir/usr/share/firmware/wifi wifi/ + ''; + + installPhase = '' + mkdir -p $out/lib/firmware/brcm + cp bluetooth/brcm/* $out/lib/firmware/brcm/ + cp wifi/brcm/* $out/lib/firmware/brcm/ + ''; + + meta = with lib; { + description = "Wi-Fi and Bluetooth firmware for T2 Macs"; + license = licenses.unfree; + maintainers = with maintainers; [ mkorje ]; + platforms = platforms.linux; + }; + } +) diff --git a/apple/t2/pkgs/brcm-firmware/fetchmacos.nix b/apple/t2/pkgs/brcm-firmware/fetchmacos.nix new file mode 100644 index 00000000..8af21291 --- /dev/null +++ b/apple/t2/pkgs/brcm-firmware/fetchmacos.nix @@ -0,0 +1,42 @@ +{ + lib, + stdenvNoCC, + fetchFromGitHub, + callPackage, + dmg2img, +}: + +let + macrecovery = callPackage ./macrecovery.nix { }; +in + +{ + name, + boardId, + mlb, + osType, + hash, +}: + +stdenvNoCC.mkDerivation { + name = name; + + dontUnpack = true; + + nativeBuildInputs = [ + macrecovery + dmg2img + ]; + buildPhase = '' + macrecovery download -o . -b ${boardId} -m ${mlb} -os ${osType} + dmg2img -s BaseSystem.dmg fw.img + ''; + + installPhase = '' + cp fw.img $out + ''; + + outputHashMode = "recursive"; + outputHashAlgo = "sha256"; + outputHash = hash; +} diff --git a/apple/t2/pkgs/brcm-firmware/get-firmware-standalone.patch b/apple/t2/pkgs/brcm-firmware/get-firmware-standalone.patch new file mode 100644 index 00000000..f0b13f22 --- /dev/null +++ b/apple/t2/pkgs/brcm-firmware/get-firmware-standalone.patch @@ -0,0 +1,133 @@ +diff --git a/asahi_firmware/bluetooth.py b/asahi_firmware/bluetooth.py +index 0934225..3eaa442 100644 +--- a/asahi_firmware/bluetooth.py ++++ b/asahi_firmware/bluetooth.py +@@ -1,8 +1,25 @@ ++#!/usr/bin/env python3 + # SPDX-License-Identifier: MIT + import logging, os, os.path, re, sys + from collections import namedtuple, defaultdict ++from hashlib import sha256 + +-from .core import FWFile ++class FWFile(object): ++ def __init__(self, name, data): ++ self.name = name ++ self.data = data ++ self.sha = sha256(data).hexdigest() ++ ++ def __repr__(self): ++ return f"FWFile({self.name!r}, <{self.sha[:16]}>)" ++ ++ def __eq__(self, other): ++ if other is None: ++ return False ++ return self.sha == other.sha ++ ++ def __hash__(self): ++ return hash(self.sha) + + log = logging.getLogger("asahi_firmware.bluetooth") + +@@ -127,16 +144,16 @@ class BluetoothFWCollection(object): + + if __name__ == "__main__": + col = BluetoothFWCollection(sys.argv[1]) +- +- if len(sys.argv) > 2: +- from . import FWPackage +- +- pkg = FWPackage(sys.argv[2]) +- pkg.add_files(sorted(col.files())) +- pkg.close() +- +- for i in pkg.manifest: +- print(i) +- else: +- for name, fwfile in col.files(): +- print(name, f"{fwfile.name} ({len(fwfile.data)} bytes)") ++ ++ dir = os.path.join(sys.argv[2], "brcm") ++ os.makedirs(dir) ++ ++ hashes = {} ++ for name, data in sorted(col.files()): ++ path = os.path.join(sys.argv[2], name) ++ if data.sha in hashes: ++ os.link(hashes[data.sha], path) ++ else: ++ with open(path, "wb") as f: ++ f.write(data.data) ++ hashes[data.sha] = path +diff --git a/asahi_firmware/wifi.py b/asahi_firmware/wifi.py +index 346965c..261aa32 100644 +--- a/asahi_firmware/wifi.py ++++ b/asahi_firmware/wifi.py +@@ -1,6 +1,24 @@ ++#!/usr/bin/env python3 + # SPDX-License-Identifier: MIT + import sys, os, os.path, pprint, statistics, logging +-from .core import FWFile ++from hashlib import sha256 ++ ++class FWFile(object): ++ def __init__(self, name, data): ++ self.name = name ++ self.data = data ++ self.sha = sha256(data).hexdigest() ++ ++ def __repr__(self): ++ return f"FWFile({self.name!r}, <{self.sha[:16]}>)" ++ ++ def __eq__(self, other): ++ if other is None: ++ return False ++ return self.sha == other.sha ++ ++ def __hash__(self): ++ return hash(self.sha) + + log = logging.getLogger("asahi_firmware.wifi") + +@@ -40,7 +58,9 @@ class WiFiFWCollection(object): + self.prune() + + def load(self, source_path): ++ included_folders = ["C-4355__s-C1", "C-4364__s-B2", "C-4364__s-B3", "C-4377__s-B3"] + for dirpath, dirnames, filenames in os.walk(source_path): ++ dirnames[:] = [d for d in dirnames if d in included_folders] + if "perf" in dirnames: + dirnames.remove("perf") + if "assert" in dirnames: +@@ -141,18 +161,16 @@ class WiFiFWCollection(object): + + if __name__ == "__main__": + col = WiFiFWCollection(sys.argv[1]) +- if len(sys.argv) > 2: +- from .core import FWPackage +- +- pkg = FWPackage(sys.argv[2]) +- pkg.add_files(sorted(col.files())) +- pkg.close() +- +- for i in pkg.manifest: +- print(i) +- else: +- for name, fwfile in col.files(): +- if isinstance(fwfile, str): +- print(name, "->", fwfile) +- else: +- print(name, f"({len(fwfile.data)} bytes)") ++ ++ dir = os.path.join(sys.argv[2], "brcm") ++ os.makedirs(dir) ++ ++ hashes = {} ++ for name, data in sorted(col.files()): ++ path = os.path.join(sys.argv[2], name) ++ if data.sha in hashes: ++ os.link(hashes[data.sha], path) ++ else: ++ with open(path, "wb") as f: ++ f.write(data.data) ++ hashes[data.sha] = path diff --git a/apple/t2/pkgs/brcm-firmware/get-firmware.nix b/apple/t2/pkgs/brcm-firmware/get-firmware.nix new file mode 100644 index 00000000..9c294016 --- /dev/null +++ b/apple/t2/pkgs/brcm-firmware/get-firmware.nix @@ -0,0 +1,35 @@ +{ + lib, + stdenvNoCC, + fetchFromGitHub, + python3, +}: + +stdenvNoCC.mkDerivation { + name = "get-firmware"; + + src = fetchFromGitHub { + owner = "AsahiLinux"; + repo = "asahi-installer"; + rev = "v0.7.9"; + hash = "sha256-vbhepoZ52k5tW2Gd7tfQTZ5CLqzhV7dUcVh6+AYwECk="; + }; + + patches = [ ./get-firmware-standalone.patch ]; + + buildInputs = [ python3 ]; + + installPhase = '' + cd asahi_firmware + install -Dm755 bluetooth.py $out/bin/get-bluetooth + install -Dm755 wifi.py $out/bin/get-wifi + ''; + + meta = with lib; { + description = "Patched Asahi Linux Installer scripts to get brcm firmware"; + homepage = "https://github.com/AsahiLinux/asahi-installer"; + license = licenses.mit; + maintainers = with maintainers; [ mkorje ]; + platforms = platforms.all; + }; +} diff --git a/apple/t2/pkgs/brcm-firmware/macrecovery.nix b/apple/t2/pkgs/brcm-firmware/macrecovery.nix new file mode 100644 index 00000000..eb4a867a --- /dev/null +++ b/apple/t2/pkgs/brcm-firmware/macrecovery.nix @@ -0,0 +1,36 @@ +{ + lib, + stdenvNoCC, + fetchFromGitHub, + python3, +}: + +stdenvNoCC.mkDerivation { + name = "macrecovery"; + + src = fetchFromGitHub { + owner = "acidanthera"; + repo = "OpenCorePkg"; + rev = "1.0.4"; + hash = "sha256-5Eypza9teSJSulHaK7Sxh562cTKedXKn3y+Z3+fC6sM="; + }; + + buildInputs = [ python3 ]; + + installPhase = '' + cd Utilities/macrecovery + install -Dm755 macrecovery.py $out/opt/macrecovery + cp boards.json $out/opt/boards.json + mkdir $out/bin + ln -s $out/opt/macrecovery $out/bin/macrecovery + ''; + + meta = with lib; { + description = "A tool that helps to automate recovery interaction"; + homepage = "https://github.com/acidanthera/OpenCorePkg"; + license = licenses.bsd3; + maintainers = with maintainers; [ mkorje ]; + mainProgram = "macrecovery"; + platforms = platforms.all; + }; +} diff --git a/apple/t2/pkgs/linux-t2.nix b/apple/t2/pkgs/linux-t2.nix deleted file mode 100644 index 6b0696f3..00000000 --- a/apple/t2/pkgs/linux-t2.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ lib, buildLinux, fetchFromGitHub, fetchzip, runCommand -, ... } @ args: - -let - version = "6.13"; - majorVersion = lib.elemAt (lib.take 1 (lib.splitVersion version)) 0; - - patchRepo = fetchFromGitHub { - owner = "t2linux"; - repo = "linux-t2-patches"; - rev = "07cba1a25b43834f24f8be302bd025f2f89493c5"; - hash = "sha256-kRSzqOApTmTTv3rfNmP9/RQ7zV4jptlEOLWixtgwTLk="; - }; - - kernel = fetchzip { - url = "mirror://kernel/linux/kernel/v${majorVersion}.x/linux-${version}.tar.xz"; - hash = "sha256-FD22KmTFrIhED5X3rcjPTot1UOq1ir1zouEpRWZkRC0="; - }; -in -buildLinux (args // { - inherit version; - - pname = "linux-t2"; - # Snippet from nixpkgs - modDirVersion = "${lib.concatStringsSep "." (lib.take 3 (lib.splitVersion "${version}.0"))}"; - - src = runCommand "patched-source" {} '' - cp -r ${kernel} $out - chmod -R u+w $out - cd $out - while read -r patch; do - echo "Applying patch $patch"; - patch -p1 < $patch; - done < <(find ${patchRepo} -type f -name "*.patch" | sort) - ''; - - structuredExtraConfig = with lib.kernel; { - APPLE_BCE = module; - APPLE_GMUX = module; - APFS_FS = module; - BRCMFMAC = module; - BT_BCM = module; - BT_HCIBCM4377 = module; - BT_HCIUART_BCM = yes; - BT_HCIUART = module; - HID_APPLETB_BL = module; - HID_APPLETB_KBD = module; - HID_APPLE = module; - DRM_APPLETBDRM = module; - HID_SENSOR_ALS = module; - SND_PCM = module; - STAGING = yes; - }; - - kernelPatches = []; -} // (args.argsOverride or {})) diff --git a/apple/t2/pkgs/linux-t2/default.nix b/apple/t2/pkgs/linux-t2/default.nix new file mode 100644 index 00000000..76247b8b --- /dev/null +++ b/apple/t2/pkgs/linux-t2/default.nix @@ -0,0 +1,6 @@ +{ callPackage, linux_6_12, ... }@args: + +callPackage ./generic.nix args { + kernel = linux_6_12; + patchesFile = ./stable.json; +} diff --git a/apple/t2/pkgs/linux-t2/generic.nix b/apple/t2/pkgs/linux-t2/generic.nix new file mode 100644 index 00000000..a4e6e284 --- /dev/null +++ b/apple/t2/pkgs/linux-t2/generic.nix @@ -0,0 +1,60 @@ +{ + lib, + fetchurl, # fetchpatch does unnecessary normalization + ... +}@args: + +{ + kernel, + patchesFile, +}: +let + inherit (builtins) readFile fromJSON; + + patchset = fromJSON (readFile patchesFile); + t2-patches = map ( + { name, hash }: + { + inherit name; + patch = fetchurl { + inherit name hash; + url = patchset.base_url + name; + }; + } + ) patchset.patches; +in +kernel.override ( + args + // { + pname = "linux-t2"; + + structuredExtraConfig = with lib.kernel; { + APPLE_BCE = module; + APPLE_GMUX = module; + APFS_FS = module; + BRCMFMAC = module; + BT_BCM = module; + BT_HCIBCM4377 = module; + BT_HCIUART_BCM = yes; + BT_HCIUART = module; + HID_APPLETB_BL = module; + HID_APPLETB_KBD = module; + HID_APPLE = module; + HID_MAGICMOUSE = module; + DRM_APPLETBDRM = module; + HID_SENSOR_ALS = module; + SND_PCM = module; + STAGING = yes; + }; + + kernelPatches = t2-patches ++ (args.kernelPatches or [ ]); + + argsOverride.extraMeta = { + description = "The Linux kernel (with patches from the T2 Linux project)"; + + # take responsibility for the downstream kernel + maintainers = with lib.maintainers; [ soopyc ]; + }; + } + // (args.argsOverride or { }) +) diff --git a/apple/t2/pkgs/linux-t2/latest.json b/apple/t2/pkgs/linux-t2/latest.json new file mode 100644 index 00000000..629d74d2 --- /dev/null +++ b/apple/t2/pkgs/linux-t2/latest.json @@ -0,0 +1,141 @@ +{ + "base_url": "https://raw.githubusercontent.com/t2linux/linux-t2-patches/8ec11f3aaa314d25e18842851a2124c0031e2e3f/", + "patches": [ + { + "name": "1001-Add-apple-bce-driver.patch", + "hash": "sha256-00K3LmId2Ag6s5K76p7mB2a0oEXp815yRd+U5wxWPMc=" + }, + { + "name": "1002-Put-apple-bce-in-drivers-staging.patch", + "hash": "sha256-wkveNo1qwAwXWDGTFed4ZDbuBnJbwKgWLmTHK9qq0oM=" + }, + { + "name": "1003-Fix-sparse-errors.patch", + "hash": "sha256-nuCOPWa4Hp+HCCBe6Y++M4g1k4plOWzy2hqHXlJbp9g=" + }, + { + "name": "1004-Fix-freezing-on-turning-off-camera.patch", + "hash": "sha256-rFrSUhiNXgQbfgKjryJktYxYcchXE1PI49Q1gW001+0=" + }, + { + "name": "1007-HID-multitouch-Get-the-contact-ID-from-HID_DG_TRANSD.patch", + "hash": "sha256-JF5PjByo4S1Rd/B5luAzOXDv+iakCnJfmujIQuUiT1A=" + }, + { + "name": "1008-HID-multitouch-support-getting-the-tip-state-from-HI.patch", + "hash": "sha256-m/NAKoHRC/HwxG5fFZxFl6DtY4Xv8kPBWvdKdtadrrk=" + }, + { + "name": "1009-HID-multitouch-take-cls-maxcontacts-into-account-for.patch", + "hash": "sha256-h6jk9yw/4txd8PATpMxB9mIzik9+X1zP6p4K35AqdXw=" + }, + { + "name": "1010-HID-multitouch-specify-that-Apple-Touch-Bar-is-direc.patch", + "hash": "sha256-5PbLynVnQqlJKPTWhcmwXCkYDEopLBQWnxWvZUt0EN4=" + }, + { + "name": "1011-HID-multitouch-add-device-ID-for-Apple-Touch-Bar.patch", + "hash": "sha256-dIzEOj89D2rIEc2/mjq3TkIfI3ZHzu0VRDQQOzp+Snc=" + }, + { + "name": "1013-lib-vsprintf-Add-support-for-generic-FourCCs-by-exte.patch", + "hash": "sha256-g8M3j1ZPND10/LtPD/txaSoJGV9Lp+g5bgn+vQc56p4=" + }, + { + "name": "1014-printf-add-tests-for-generic-FourCCs.patch", + "hash": "sha256-5Z4cFBMAY695OEU/CxiGQkUz68zmKdxssD+yp1DCYgs=" + }, + { + "name": "1015-drm-appletbdrm-use-p4cl-instead-of-p4cc.patch", + "hash": "sha256-rZej0ZbpPv+8NROuYnf4Jpu9scCsmbKWyz7yf5A3G3s=" + }, + { + "name": "1016-vsprintf-Use-p4chR-instead-of-p4cn-for-reading-data-.patch", + "hash": "sha256-/Ork2CmYk6SG213Owk+nGsw7KTEVDLRzQTeWcKrPZGw=" + }, + { + "name": "1017-checkpatch-remove-p4cn.patch", + "hash": "sha256-lnMnjnMiR9WSNf/XYsiOwFdC9xKv8zSluWiR584xFPU=" + }, + { + "name": "2008-i915-4-lane-quirk-for-mbp15-1.patch", + "hash": "sha256-Ui9tK4IGSWfEscmD92emX/NfulO0m8zwLc9ivIClCFQ=" + }, + { + "name": "2009-apple-gmux-allow-switching-to-igpu-at-probe.patch", + "hash": "sha256-aE+MEu/jRrZBa+3Q03quOHUsIseRED6A7N/K9kEVtbM=" + }, + { + "name": "3001-applesmc-convert-static-structures-to-drvdata.patch", + "hash": "sha256-7KGC0pCos351wKNhwJI/Qoc7w+orOPpiTkdCN50G8nI=" + }, + { + "name": "3002-applesmc-make-io-port-base-addr-dynamic.patch", + "hash": "sha256-1fnmMP/3WSy2JqjdCvxu8tWoshCPr8eiG6ttYK/N9WA=" + }, + { + "name": "3003-applesmc-switch-to-acpi_device-from-platform.patch", + "hash": "sha256-3S6BzyoPLoirfyAu4yDyE9aYjUYr/7etmAvN3uKSDLE=" + }, + { + "name": "3004-applesmc-key-interface-wrappers.patch", + "hash": "sha256-9Bq28WcqiOnef0br6bATOudr1ViSpajQs7fv7o8Tg0I=" + }, + { + "name": "3005-applesmc-basic-mmio-interface-implementation.patch", + "hash": "sha256-Hh9DymQ+Y74oSs1zv9F0lTU3jfAenKTM+cmFH9tmN9Q=" + }, + { + "name": "3006-applesmc-fan-support-on-T2-Macs.patch", + "hash": "sha256-D5IQHE8QFo49mnUawSau7xUsMFkHKayyhnHW4hi+fWE=" + }, + { + "name": "3007-applesmc-Add-iMacPro-to-applesmc_whitelist.patch", + "hash": "sha256-rLDuyQYzAaWuu/u6nRRVvGdwyfpLvkGPu1OoD8KS0os=" + }, + { + "name": "3008-applesmc-make-applesmc_remove-void.patch", + "hash": "sha256-j2Rj1PW/bFEYh9IkGkkG9b+G27IAPCInyd828z4WE1s=" + }, + { + "name": "3009-applesmc-battery-charge-limiter.patch", + "hash": "sha256-skYKmLsJ6O42/wINLccZWoKS0XhVlC1Nfxi1Ekloxns=" + }, + { + "name": "4001-asahi-trackpad.patch", + "hash": "sha256-QM/FtDft4N4imJBuEHg6cH3e8vEyMPLt0alDhugLPy8=" + }, + { + "name": "4002-HID-quirks-remove-T2-devices-from-hid_mouse_ignore_l.patch", + "hash": "sha256-0PMCE3IWHekir5YV1BD6Jakc7dOV6Fj2HfIGWZnXZV0=" + }, + { + "name": "4003-HID-apple-ignore-the-trackpad-on-T2-Macs.patch", + "hash": "sha256-JTeYtaBqMyTu5IdGb8x7wbP9ZE1rXT4lpEjudR1ySFI=" + }, + { + "name": "4004-HID-magicmouse-Add-support-for-trackpads-found-on-T2.patch", + "hash": "sha256-HcPX7gY3hnlwM/tY06pbtXnch04AqwHgC596E8ZqGY8=" + }, + { + "name": "4005-HID-apple-Add-necessary-IDs-and-support-for-replacem.patch", + "hash": "sha256-SRKESCbpxSYm7U0VyCmvkmT/er6/GEHhwo8tgJDO6mQ=" + }, + { + "name": "4006-HID-magicmouse-Add-MacBookPro15-1-replacement-trackp.patch", + "hash": "sha256-uAlT/4ADwYyKvbuPQaGwqCjZ2/myruC63etVV6cfFLk=" + }, + { + "name": "7001-drm-i915-fbdev-Discard-BIOS-framebuffers-exceeding-h.patch", + "hash": "sha256-O6RHFxmKZn7aCq1D+r5z2T3jLt0r5+01EABD9rs0E5M=" + }, + { + "name": "8001-Add-APFS-driver.patch", + "hash": "sha256-io17Kk6FDscDoDshddK9TqSPuXVFTzjvRUwOGTl5cjM=" + }, + { + "name": "8002-Necessary-modifications-to-build-APFS-with-the-kerne.patch", + "hash": "sha256-n1SH5vC//LRJdWOavH9/BHqBTjkUj5f+dFGitSeHksw=" + } + ] +} diff --git a/apple/t2/pkgs/linux-t2/latest.nix b/apple/t2/pkgs/linux-t2/latest.nix new file mode 100644 index 00000000..747db71e --- /dev/null +++ b/apple/t2/pkgs/linux-t2/latest.nix @@ -0,0 +1,6 @@ +{ callPackage, linux_6_15, ... }@args: + +callPackage ./generic.nix args { + kernel = linux_6_15; + patchesFile = ./latest.json; +} diff --git a/apple/t2/pkgs/linux-t2/stable.json b/apple/t2/pkgs/linux-t2/stable.json new file mode 100644 index 00000000..325f42e4 --- /dev/null +++ b/apple/t2/pkgs/linux-t2/stable.json @@ -0,0 +1,141 @@ +{ + "base_url": "https://raw.githubusercontent.com/t2linux/linux-t2-patches/e08a76e1f1234885b9b68be6c843bf91833e8b0a/", + "patches": [ + { + "name": "1001-Add-apple-bce-driver.patch", + "hash": "sha256-e3RPvWPj2QASGOS4kieO8YFekrXsBCJtfF82OPlOn2E=" + }, + { + "name": "1002-Put-apple-bce-in-drivers-staging.patch", + "hash": "sha256-DXj4CmE7TKMGrAhQDOR5RVw9YHmyQMiXZsmxYfkKAEA=" + }, + { + "name": "1003-Fix-sparse-errors.patch", + "hash": "sha256-nuCOPWa4Hp+HCCBe6Y++M4g1k4plOWzy2hqHXlJbp9g=" + }, + { + "name": "1004-Fix-freezing-on-turning-off-camera.patch", + "hash": "sha256-rFrSUhiNXgQbfgKjryJktYxYcchXE1PI49Q1gW001+0=" + }, + { + "name": "1005-HID-hid-appletb-bl-add-driver-for-the-backlight-of-A.patch", + "hash": "sha256-kEscS1FAyDxLZPOPInYTXFEf4fouBEa4zGctX14hSu8=" + }, + { + "name": "1006-HID-hid-appletb-kbd-add-driver-for-the-keyboard-mode.patch", + "hash": "sha256-eVEuvnoRItaDjwWu41nn9bTkgHgY+1SL/hFAvUR2IlY=" + }, + { + "name": "1007-HID-multitouch-Get-the-contact-ID-from-HID_DG_TRANSD.patch", + "hash": "sha256-JF5PjByo4S1Rd/B5luAzOXDv+iakCnJfmujIQuUiT1A=" + }, + { + "name": "1008-HID-multitouch-support-getting-the-tip-state-from-HI.patch", + "hash": "sha256-m/NAKoHRC/HwxG5fFZxFl6DtY4Xv8kPBWvdKdtadrrk=" + }, + { + "name": "1009-HID-multitouch-take-cls-maxcontacts-into-account-for.patch", + "hash": "sha256-h6jk9yw/4txd8PATpMxB9mIzik9+X1zP6p4K35AqdXw=" + }, + { + "name": "1010-HID-multitouch-specify-that-Apple-Touch-Bar-is-direc.patch", + "hash": "sha256-5PbLynVnQqlJKPTWhcmwXCkYDEopLBQWnxWvZUt0EN4=" + }, + { + "name": "1011-HID-multitouch-add-device-ID-for-Apple-Touch-Bar.patch", + "hash": "sha256-dIzEOj89D2rIEc2/mjq3TkIfI3ZHzu0VRDQQOzp+Snc=" + }, + { + "name": "1013-lib-vsprintf-Add-support-for-generic-FourCCs-by-exte.patch", + "hash": "sha256-h3gxaKtvdm/GSd+AP1sPC9avWHOsceUxTmoua/3rIf4=" + }, + { + "name": "1014-drm-format-helper-Add-conversion-from-XRGB8888-to-BG.patch", + "hash": "sha256-Ky19+cCiYDaHBh2o5IhZO8J1ExDT7o8K9cgPz+AL8Cg=" + }, + { + "name": "1015-drm-tiny-add-driver-for-Apple-Touch-Bars-in-x86-Macs.patch", + "hash": "sha256-tDjK/VipVQbuNOURW38gssqeRLy3s8I+DVq0+4zGnHs=" + }, + { + "name": "2008-i915-4-lane-quirk-for-mbp15-1.patch", + "hash": "sha256-lZ7MWXZubmAlJCqBmuzueg7agENJbikxP1SE46SmwNw=" + }, + { + "name": "2009-apple-gmux-allow-switching-to-igpu-at-probe.patch", + "hash": "sha256-XKwlyJZjJLQz39mc0/S7sPnRnwrqMsq9OKy+QCO+oho=" + }, + { + "name": "3001-applesmc-convert-static-structures-to-drvdata.patch", + "hash": "sha256-7KGC0pCos351wKNhwJI/Qoc7w+orOPpiTkdCN50G8nI=" + }, + { + "name": "3002-applesmc-make-io-port-base-addr-dynamic.patch", + "hash": "sha256-1fnmMP/3WSy2JqjdCvxu8tWoshCPr8eiG6ttYK/N9WA=" + }, + { + "name": "3003-applesmc-switch-to-acpi_device-from-platform.patch", + "hash": "sha256-3S6BzyoPLoirfyAu4yDyE9aYjUYr/7etmAvN3uKSDLE=" + }, + { + "name": "3004-applesmc-key-interface-wrappers.patch", + "hash": "sha256-9Bq28WcqiOnef0br6bATOudr1ViSpajQs7fv7o8Tg0I=" + }, + { + "name": "3005-applesmc-basic-mmio-interface-implementation.patch", + "hash": "sha256-Hh9DymQ+Y74oSs1zv9F0lTU3jfAenKTM+cmFH9tmN9Q=" + }, + { + "name": "3006-applesmc-fan-support-on-T2-Macs.patch", + "hash": "sha256-D5IQHE8QFo49mnUawSau7xUsMFkHKayyhnHW4hi+fWE=" + }, + { + "name": "3007-applesmc-Add-iMacPro-to-applesmc_whitelist.patch", + "hash": "sha256-rLDuyQYzAaWuu/u6nRRVvGdwyfpLvkGPu1OoD8KS0os=" + }, + { + "name": "3008-applesmc-make-applesmc_remove-void.patch", + "hash": "sha256-j2Rj1PW/bFEYh9IkGkkG9b+G27IAPCInyd828z4WE1s=" + }, + { + "name": "3009-applesmc-battery-charge-limiter.patch", + "hash": "sha256-skYKmLsJ6O42/wINLccZWoKS0XhVlC1Nfxi1Ekloxns=" + }, + { + "name": "4001-asahi-trackpad.patch", + "hash": "sha256-NOuGgUxDQEfFPlij/EnhWmgqeG3/l+j+r2T1YJG7raY=" + }, + { + "name": "4002-HID-quirks-remove-T2-devices-from-hid_mouse_ignore_l.patch", + "hash": "sha256-0PMCE3IWHekir5YV1BD6Jakc7dOV6Fj2HfIGWZnXZV0=" + }, + { + "name": "4003-HID-apple-ignore-the-trackpad-on-T2-Macs.patch", + "hash": "sha256-JTeYtaBqMyTu5IdGb8x7wbP9ZE1rXT4lpEjudR1ySFI=" + }, + { + "name": "4004-HID-magicmouse-Add-support-for-trackpads-found-on-T2.patch", + "hash": "sha256-HcPX7gY3hnlwM/tY06pbtXnch04AqwHgC596E8ZqGY8=" + }, + { + "name": "4005-HID-apple-Add-necessary-IDs-and-support-for-replacem.patch", + "hash": "sha256-SRKESCbpxSYm7U0VyCmvkmT/er6/GEHhwo8tgJDO6mQ=" + }, + { + "name": "4006-HID-magicmouse-Add-MacBookPro15-1-replacement-trackp.patch", + "hash": "sha256-uAlT/4ADwYyKvbuPQaGwqCjZ2/myruC63etVV6cfFLk=" + }, + { + "name": "7001-drm-i915-fbdev-Discard-BIOS-framebuffers-exceeding-h.patch", + "hash": "sha256-O6RHFxmKZn7aCq1D+r5z2T3jLt0r5+01EABD9rs0E5M=" + }, + { + "name": "8001-Add-APFS-driver.patch", + "hash": "sha256-O3RNtpeZQENPEfyYi/0ZTLhAWBAw6pmxMS30NUxOTdk=" + }, + { + "name": "8002-Necessary-modifications-to-build-APFS-with-the-kerne.patch", + "hash": "sha256-n1SH5vC//LRJdWOavH9/BHqBTjkUj5f+dFGitSeHksw=" + } + ] +} diff --git a/apple/t2/pkgs/linux-t2/update-patches.py b/apple/t2/pkgs/linux-t2/update-patches.py new file mode 100755 index 00000000..7b907293 --- /dev/null +++ b/apple/t2/pkgs/linux-t2/update-patches.py @@ -0,0 +1,99 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i python -p nix -p "python3.withPackages (p: [p.requests])" + +import argparse +import json +import re +import subprocess +import sys +from tempfile import NamedTemporaryFile +from concurrent.futures import ThreadPoolExecutor, as_completed + +import requests + +API_BASE = "https://api.github.com" +PATCH_PATTERN = re.compile(r"^\d{4}-.*\.patch$") + +parser = argparse.ArgumentParser( + description="Update linux-t2 patches from a GitHub repository." +) +parser.add_argument("filename", help="the output filename") +parser.add_argument( + "--repository", + help="the source github repository", + default="t2linux/linux-t2-patches", + nargs="?", +) +ref_group = parser.add_mutually_exclusive_group() +ref_group.add_argument( + "--reference", help="the git reference for the patches", default=None, nargs="?" +) +ref_group.add_argument( + "--branch", help="the git branch to fetch", default=None, nargs="?" +) + + +def get_api(endpoint, *args, **kwargs): + kwargs["headers"] = {"X-GitHub-Api-Version": "2022-11-28"} + response = requests.get(API_BASE + endpoint, *args, **kwargs) + response.raise_for_status() + return response.json() + + +def get_sri_hash(data: bytes): + with NamedTemporaryFile() as tmpfile: + tmpfile.write(data) + tmpfile.flush() + proc = subprocess.run( + ["nix-hash", "--sri", "--flat", "--type", "sha256", tmpfile.name], + check=True, + capture_output=True, + ) + return proc.stdout.decode("utf8").strip() + +def download_task(patch: dict): + patch_content = requests.get(patch["download_url"]) + patch_hash = get_sri_hash(patch_content.content) + print(f"{patch['name']}: {patch_hash}") + return {"name": patch["name"], "hash": patch_hash} + +def main(): + args = parser.parse_args() + reference = args.reference + branch = args.branch + + if reference is None: + if branch is None: + print("Branch and reference not provided, fetching default branch") + branch = get_api(f"/repos/{args.repository}")["default_branch"] + + print(f"Reference not provided, fetching from branch {branch}") + branch_data = get_api(f"/repos/{args.repository}/branches/{branch}") + reference = branch_data["commit"]["sha"] + + print(f"Repository: {args.repository}") + print(f" Reference: {reference}") + + base_url = f"https://raw.githubusercontent.com/{args.repository}/{reference}/" + contents = get_api(f"/repos/{args.repository}/contents", {"ref": reference}) + patches = filter(lambda e: PATCH_PATTERN.match(e.get("name")), contents) + + patches_with_hash = [] + with ThreadPoolExecutor() as executor: + futures = {executor.submit(download_task, patch) for patch in patches} + + for future in as_completed(futures): + patches_with_hash.append(future.result()) + + result = {"base_url": base_url, "patches": sorted(patches_with_hash, key=lambda p: p["name"])} + + with open(args.filename, "w+") as f: + json.dump(result, f, indent=2) + f.write("\n") # write final newline + print(f"Wrote to {args.filename}") + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/asus/ally/rc71l/default.nix b/asus/ally/rc71l/default.nix index 9cc83fed..5d1e58a7 100644 --- a/asus/ally/rc71l/default.nix +++ b/asus/ally/rc71l/default.nix @@ -5,11 +5,13 @@ ../../../common/cpu/amd/pstate.nix ../../../common/gpu/amd ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../battery.nix ]; # 6.5 adds many fixes and improvements for the Ally # This includes for example performance, audio and bluetooth - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.5") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.5") ( + lib.mkDefault pkgs.linuxPackages_latest + ); } diff --git a/asus/battery.nix b/asus/battery.nix index d61e3502..4bdf6b64 100644 --- a/asus/battery.nix +++ b/asus/battery.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let p = pkgs.writeScriptBin "charge-upto" '' echo ''${0:-100} > /sys/class/power_supply/BAT?/charge_control_end_threshold @@ -22,8 +27,14 @@ in config = { environment.systemPackages = lib.mkIf cfg.enableChargeUptoScript [ p ]; systemd.services.battery-charge-threshold = { - wantedBy = [ "local-fs.target" "suspend.target" ]; - after = [ "local-fs.target" "suspend.target" ]; + wantedBy = [ + "local-fs.target" + "suspend.target" + ]; + after = [ + "local-fs.target" + "suspend.target" + ]; description = "Set the battery charge threshold to ${toString cfg.chargeUpto}%"; startLimitBurst = 5; startLimitIntervalSec = 1; diff --git a/asus/fa506ic/default.nix b/asus/fa506ic/default.nix index 10d08fbc..c9591fd7 100644 --- a/asus/fa506ic/default.nix +++ b/asus/fa506ic/default.nix @@ -8,7 +8,7 @@ ../../common/gpu/nvidia/prime.nix ../../common/gpu/nvidia/ampere ../../common/pc/laptop - ../../common/pc/laptop/ssd + ../../common/pc/ssd ]; hardware.nvidia = { diff --git a/asus/fa507nv/default.nix b/asus/fa507nv/default.nix index 3a304012..01fafbb2 100644 --- a/asus/fa507nv/default.nix +++ b/asus/fa507nv/default.nix @@ -3,7 +3,8 @@ pkgs, config, ... -}: { +}: +{ imports = [ ../../common/cpu/amd ../../common/cpu/amd/raphael/igpu.nix @@ -20,7 +21,9 @@ # The bottom 2 parts are taken from the framework 16-inch laptops configurations. # Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/ - boot.kernelParams = lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") ["rtc_cmos.use_acpi_alarm=1"]; + boot.kernelParams = + lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") + [ "rtc_cmos.use_acpi_alarm=1" ]; # AMD has better battery life with PPD over TLP: # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13 diff --git a/asus/fa507rm/default.nix b/asus/fa507rm/default.nix index a07a6413..ffbae513 100644 --- a/asus/fa507rm/default.nix +++ b/asus/fa507rm/default.nix @@ -1,16 +1,16 @@ { ... }: { - imports = [ - ../../common/cpu/amd - ../../common/gpu/nvidia/prime.nix - ../../common/gpu/nvidia/ampere - ../../common/pc/laptop - ../../common/pc/ssd - ]; + imports = [ + ../../common/cpu/amd + ../../common/gpu/nvidia/prime.nix + ../../common/gpu/nvidia/ampere + ../../common/pc/laptop + ../../common/pc/ssd + ]; - hardware.nvidia.prime = { - amdgpuBusId = "PCI:5:0:0"; - nvidiaBusId = "PCI:1:0:0"; - }; - } + hardware.nvidia.prime = { + amdgpuBusId = "PCI:5:0:0"; + nvidiaBusId = "PCI:1:0:0"; + }; +} diff --git a/asus/flow/gv302x/amdgpu/default.nix b/asus/flow/gv302x/amdgpu/default.nix index 833e298f..8cfb2403 100644 --- a/asus/flow/gv302x/amdgpu/default.nix +++ b/asus/flow/gv302x/amdgpu/default.nix @@ -1,4 +1,5 @@ -{ config, +{ + config, lib, ... }: @@ -7,15 +8,22 @@ let inherit (lib) mkEnableOption mkIf mkMerge; cfg = config.hardware.asus.flow.gv302x; -in { +in +{ imports = [ ../shared.nix ]; options.hardware.asus.flow.gv302x.amdgpu = { - recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = false; }; - sg_display.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = true; }; - psr.enable = (mkEnableOption "Enable amdgpu.dcdebugmask=0x10 kernel boot param") // { default = true; }; + recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { + default = false; + }; + sg_display.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { + default = true; + }; + psr.enable = (mkEnableOption "Enable amdgpu.dcdebugmask=0x10 kernel boot param") // { + default = true; + }; }; config = mkMerge [ diff --git a/asus/flow/gv302x/nvidia/default.nix b/asus/flow/gv302x/nvidia/default.nix index 0c490c93..7abfea1d 100644 --- a/asus/flow/gv302x/nvidia/default.nix +++ b/asus/flow/gv302x/nvidia/default.nix @@ -1,4 +1,5 @@ -{ lib, +{ + lib, pkgs, config, ... @@ -7,7 +8,8 @@ let inherit (lib) mkDefault; -in { +in +{ imports = [ ../shared.nix ## "prime.nix" loads this, aleady: @@ -23,8 +25,6 @@ in { blacklistedKernelModules = [ "nouveau" ]; }; - - hardware = { ## Enable the Nvidia card, as well as Prime and Offload: amdgpu.initrd.enable = mkDefault true; @@ -49,7 +49,7 @@ in { }; dynamicBoost.enable = mkDefault true; - + }; }; } diff --git a/asus/flow/gv302x/shared.nix b/asus/flow/gv302x/shared.nix index 474eb584..a556e7d0 100644 --- a/asus/flow/gv302x/shared.nix +++ b/asus/flow/gv302x/shared.nix @@ -1,14 +1,23 @@ -{ config, +{ + config, pkgs, lib, ... }: let - inherit (lib) mkDefault mkEnableOption mkIf mkMerge version versionAtLeast versionOlder; + inherit (lib) + mkDefault + mkEnableOption + mkIf + mkMerge + version + versionAtLeast + ; cfg = config.hardware.asus.flow.gv302x; -in { +in +{ imports = [ ../../../common/cpu/amd @@ -26,12 +35,12 @@ in { # enables it for kernel 6.9.x onwards. # # Note: the device name is "ASUS N-KEY Device". - keyboard.autosuspend.enable = ( - mkEnableOption "Enable auto-suspend on the internal USB keyboard (ASUS N-KEY Device) on Flow GV302X" - ) // { - default = versionAtLeast config.boot.kernelPackages.kernel.version "6.9"; - defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\""; - }; + keyboard.autosuspend.enable = + (mkEnableOption "Enable auto-suspend on the internal USB keyboard (ASUS N-KEY Device) on Flow GV302X") + // { + default = versionAtLeast config.boot.kernelPackages.kernel.version "6.9"; + defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\""; + }; # The ASUS 8295 ITE device will cause an immediate wake-up when trying to suspend the laptop. # After the first successful hibernate, it will work as expected, however. # NOTE: I'm not actually sure what this device, as neither the touchpad nor the M1-M4 keys cause a wake-up. @@ -63,7 +72,7 @@ in { evdev:name:*:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:* KEYBOARD_KEY_ff31007c=f20 ''; - }; + }; }; #flow devices are 2 in 1 laptops @@ -71,7 +80,7 @@ in { } - (mkIf (! cfg.keyboard.autosuspend.enable) { + (mkIf (!cfg.keyboard.autosuspend.enable) { services.udev.extraRules = '' # Disable power auto-suspend for the ASUS N-KEY device, i.e. USB Keyboard. # Otherwise on certain kernel-versions, it will tend to take 1-2 key-presses to wake-up after the device suspends. @@ -79,7 +88,7 @@ in { ''; }) - (mkIf (! cfg.ite-device.wakeup.enable) { + (mkIf (!cfg.ite-device.wakeup.enable) { services.udev.extraRules = '' # Disable power wakeup for the 8295 ITE device. # Otherwise on certain kernel-versions, it will tend to cause the laptop to immediately wake-up when suspending. diff --git a/asus/fx504gd/default.nix b/asus/fx504gd/default.nix index 45132509..244eaae4 100644 --- a/asus/fx504gd/default.nix +++ b/asus/fx504gd/default.nix @@ -2,7 +2,7 @@ { imports = [ ../../common/cpu/intel - ../../common/pc/laptop + ../../common/pc/laptop ]; #Nouveau doesn't work at all on this model. diff --git a/asus/fx506hm/default.nix b/asus/fx506hm/default.nix index a50ffdf4..6f29a8b8 100644 --- a/asus/fx506hm/default.nix +++ b/asus/fx506hm/default.nix @@ -1,8 +1,7 @@ { config, lib, ... }: { - imports = - [ + imports = [ ../../common/cpu/intel ../../common/gpu/nvidia ../../common/gpu/nvidia/prime.nix @@ -11,14 +10,12 @@ ../battery.nix ]; - hardware.nvidia = - { + hardware.nvidia = { modesetting.enable = lib.mkDefault true; open = lib.mkIf (lib.versionAtLeast config.hardware.nvidia.package.version "555") true; - prime = - { - intelBusId = "PCI:0:2:0"; + prime = { + intelBusId = "PCI:0:2:0"; nvidiaBusId = "PCI:1:0:0"; }; }; diff --git a/asus/rog-strix/g513im/default.nix b/asus/rog-strix/g513im/default.nix index 654cdd14..12320165 100644 --- a/asus/rog-strix/g513im/default.nix +++ b/asus/rog-strix/g513im/default.nix @@ -1,17 +1,17 @@ { - imports = [ - ../../../common/cpu/amd - ../../../common/cpu/amd/pstate.nix - ../../../common/gpu/nvidia - ../../../common/gpu/nvidia/prime.nix - ../../../common/gpu/nvidia/ampere - ../../../common/pc/laptop - ../../../common/pc/ssd - ../../battery.nix - ]; + imports = [ + ../../../common/cpu/amd + ../../../common/cpu/amd/pstate.nix + ../../../common/gpu/nvidia + ../../../common/gpu/nvidia/prime.nix + ../../../common/gpu/nvidia/ampere + ../../../common/pc/laptop + ../../../common/pc/ssd + ../../battery.nix + ]; - hardware.nvidia.prime = { - amdgpuBusId = "PCI:05:00:0"; - nvidiaBusId = "PCI:01:00:0"; - }; + hardware.nvidia.prime = { + amdgpuBusId = "PCI:05:00:0"; + nvidiaBusId = "PCI:01:00:0"; + }; } diff --git a/asus/rog-strix/g533zw/default.nix b/asus/rog-strix/g533zw/default.nix new file mode 100644 index 00000000..d93f4f4a --- /dev/null +++ b/asus/rog-strix/g533zw/default.nix @@ -0,0 +1,17 @@ +{ ... }: + +{ + imports = [ + ../../../common/cpu/intel + ../../../common/gpu/nvidia/prime.nix + ../../../common/gpu/nvidia/ampere + ../../../common/pc/laptop + ../../../common/pc/ssd + ../../battery.nix + ]; + + hardware.nvidia.prime = { + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + }; +} diff --git a/asus/rog-strix/g713ie/default.nix b/asus/rog-strix/g713ie/default.nix index f82ddb9b..3ef4c23f 100644 --- a/asus/rog-strix/g713ie/default.nix +++ b/asus/rog-strix/g713ie/default.nix @@ -1,16 +1,16 @@ { - imports = [ - ../../../common/cpu/amd - ../../../common/cpu/amd/pstate.nix - ../../../common/gpu/nvidia - ../../../common/gpu/nvidia/prime.nix - ../../../common/gpu/nvidia/ampere - ../../../common/pc/laptop - ../../../common/pc/ssd - ../../battery.nix - ]; + imports = [ + ../../../common/cpu/amd + ../../../common/cpu/amd/pstate.nix + ../../../common/gpu/nvidia + ../../../common/gpu/nvidia/prime.nix + ../../../common/gpu/nvidia/ampere + ../../../common/pc/laptop + ../../../common/pc/ssd + ../../battery.nix + ]; - hardware.nvidia.prime = { + hardware.nvidia.prime = { amdgpuBusId = "PCI:5:0:0"; nvidiaBusId = "PCI:1:0:0"; }; diff --git a/asus/rog-strix/g733qs/default.nix b/asus/rog-strix/g733qs/default.nix index b09142af..41fda8ad 100644 --- a/asus/rog-strix/g733qs/default.nix +++ b/asus/rog-strix/g733qs/default.nix @@ -20,7 +20,9 @@ options snd-hda-intel patch=hda-jack-retask.fw ''; # before 5.12 it would interpret every keystroke as the power button - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") ( + lib.mkDefault pkgs.linuxPackages_latest + ); hardware.nvidia.prime = { amdgpuBusId = "PCI:5:0:0"; diff --git a/asus/zenbook/ux371/default.nix b/asus/zenbook/ux371/default.nix index 8e387c0c..1b4b7f26 100644 --- a/asus/zenbook/ux371/default.nix +++ b/asus/zenbook/ux371/default.nix @@ -7,7 +7,7 @@ imports = [ ../../../common/cpu/intel/tiger-lake ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../battery.nix ]; diff --git a/asus/zenbook/ux481/README.md b/asus/zenbook/ux481/README.md new file mode 100644 index 00000000..9c03bcf2 --- /dev/null +++ b/asus/zenbook/ux481/README.md @@ -0,0 +1,53 @@ +# Asus Zenbook Duo 14 UX481 + +These profiles has been tested on a slightly modified device as I have swapped the Intel Optane NVME for a Kingston NVME with a higher capacity. + +# GPU + +You need to pick between running only Intel iGPU or running both Intel iGPU and NVIDIA dGPU. By only running iGPU the battery life is a bit better as the dGPU is turned off. You can offload applications if running on NVIDIA dGPU using + +```bash +nvidia-offload +``` + +## Battery charging limit: + +Using the ASUS module you can limit the charging percentage. This can be done as follows: + +```nix +hardware.asus.battery = +{ + chargeUpto = 90; # Maximum level of charge for your battery, as a percentage. + enableChargeUptoScript = true; # Whether to add charge-upto to environment.systemPackages. `charge-upto 100` temporarily sets the charge limit to 100%, useful if you're going to need the extra battery on a longer journey. +}; +``` + +## Hardware: + +```bash +$ lspci -nn +00:00.0 Host bridge [0600]: Intel Corporation Comet Lake-U v1 4c Host Bridge/DRAM Controller [8086:9b61] (rev 0c) +00:02.0 VGA compatible controller [0300]: Intel Corporation CometLake-U GT2 [UHD Graphics] [8086:9b41] (rev 02) +00:04.0 Signal processing controller [1180]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem [8086:1903] (rev 0c) +00:08.0 System peripheral [0880]: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model [8086:1911] +00:12.0 Signal processing controller [1180]: Intel Corporation Comet Lake Thermal Subsytem [8086:02f9] +00:14.0 USB controller [0c03]: Intel Corporation Comet Lake PCH-LP USB 3.1 xHCI Host Controller [8086:02ed] +00:14.2 RAM memory [0500]: Intel Corporation Comet Lake PCH-LP Shared SRAM [8086:02ef] +00:14.3 Network controller [0280]: Intel Corporation Comet Lake PCH-LP CNVi WiFi [8086:02f0] +00:15.0 Serial bus controller [0c80]: Intel Corporation Serial IO I2C Host Controller [8086:02e8] +00:15.1 Serial bus controller [0c80]: Intel Corporation Comet Lake Serial IO I2C Host Controller [8086:02e9] +00:15.2 Serial bus controller [0c80]: Intel Corporation Comet Lake PCH-LP LPSS: I2C Controller #2 [8086:02ea] +00:15.3 Serial bus controller [0c80]: Intel Corporation Device [8086:02eb] +00:16.0 Communication controller [0780]: Intel Corporation Comet Lake Management Engine Interface [8086:02e0] +00:1c.0 PCI bridge [0604]: Intel Corporation Comet Lake PCI Express Root Port #1 [8086:02b8] (rev f0) +00:1c.4 PCI bridge [0604]: Intel Corporation Comet Lake PCI Express Root Port #5 [8086:02bc] (rev f0) +00:1d.0 PCI bridge [0604]: Intel Corporation Comet Lake PCI Express Root Port #9 [8086:02b0] (rev f0) +00:1d.4 PCI bridge [0604]: Intel Corporation Comet Lake PCI Express Root Port #13 [8086:02b4] (rev f0) +00:1f.0 ISA bridge [0601]: Intel Corporation Comet Lake PCH-LP LPC Premium Controller/eSPI Controller [8086:0284] +00:1f.3 Audio device [0403]: Intel Corporation Comet Lake PCH-LP cAVS [8086:02c8] +00:1f.4 SMBus [0c05]: Intel Corporation Comet Lake PCH-LP SMBus Host Controller [8086:02a3] +00:1f.5 Serial bus controller [0c80]: Intel Corporation Comet Lake SPI (flash) Controller [8086:02a4] +02:00.0 3D controller [0302]: NVIDIA Corporation GP108BM [GeForce MX250] [10de:1d52] (rev a1) +03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader [10ec:522a] (rev 01) +04:00.0 Non-Volatile memory controller [0108]: Kingston Technology Company, Inc. NV2 NVMe SSD [TC2200] (DRAM-less) [2646:501d] +``` diff --git a/asus/zenbook/ux481/intelgpu/default.nix b/asus/zenbook/ux481/intelgpu/default.nix new file mode 100644 index 00000000..b69d9097 --- /dev/null +++ b/asus/zenbook/ux481/intelgpu/default.nix @@ -0,0 +1,8 @@ +{ lib, ... }: +{ + imports = [ + ../shared.nix + ../../../../common/gpu/intel/comet-lake + ../../../../common/gpu/nvidia/disable.nix # Disabling nvidia + ]; +} diff --git a/asus/zenbook/ux481/nvidia/default.nix b/asus/zenbook/ux481/nvidia/default.nix new file mode 100644 index 00000000..e65ed0bc --- /dev/null +++ b/asus/zenbook/ux481/nvidia/default.nix @@ -0,0 +1,17 @@ +{ lib, ... }: +{ + imports = [ + ../shared.nix + ../../../../common/gpu/nvidia/pascal + ../../../../common/gpu/nvidia/prime.nix + ]; + + hardware.nvidia = { + prime = { + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:2:0:0"; + }; + + dynamicBoost.enable = lib.mkForce false; # Dynamic boost is not supported on Pascal architeture + }; +} diff --git a/asus/zenbook/ux481/shared.nix b/asus/zenbook/ux481/shared.nix new file mode 100644 index 00000000..a9842c7d --- /dev/null +++ b/asus/zenbook/ux481/shared.nix @@ -0,0 +1,25 @@ +{ + config, + lib, + ... +}: +{ + imports = [ + ../../../common/cpu/intel/comet-lake/cpu-only.nix + ../../../common/pc/laptop + ../../../common/pc/ssd + ../../battery.nix + ]; + + boot.kernelParams = [ + # These options are needed for suspend to work, + # otherwise the nvme will be mounted read-only on resume + "pcie_aspm=off" + "pcie_port_pm=off" + "nvme_core.default_ps_max_latency_us=0" + "mem_sleep_default=deep" + ]; + + services.thermald.enable = lib.mkDefault true; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +} diff --git a/asus/zenbook/ux535/default.nix b/asus/zenbook/ux535/default.nix index a6df788d..f2b3da6e 100644 --- a/asus/zenbook/ux535/default.nix +++ b/asus/zenbook/ux535/default.nix @@ -8,7 +8,7 @@ ../../../common/gpu/nvidia/prime.nix ../../../common/cpu/intel ../../../common/gpu/intel/comet-lake - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../../common/hidpi.nix # 4K screen is HiDPI ../../battery.nix ]; diff --git a/asus/zephyrus/ga401/default.nix b/asus/zephyrus/ga401/default.nix index 9dad2c17..f7469f1c 100644 --- a/asus/zephyrus/ga401/default.nix +++ b/asus/zephyrus/ga401/default.nix @@ -8,7 +8,7 @@ ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/ampere ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; hardware.nvidia = { diff --git a/asus/zephyrus/ga402/default.nix b/asus/zephyrus/ga402/default.nix index 2002fd09..e38e52e5 100644 --- a/asus/zephyrus/ga402/default.nix +++ b/asus/zephyrus/ga402/default.nix @@ -6,7 +6,7 @@ ../../../common/cpu/amd/pstate.nix ../../../common/gpu/amd ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; services = { diff --git a/asus/zephyrus/ga402x/amdgpu/default.nix b/asus/zephyrus/ga402x/amdgpu/default.nix index 2610db89..09acc327 100644 --- a/asus/zephyrus/ga402x/amdgpu/default.nix +++ b/asus/zephyrus/ga402x/amdgpu/default.nix @@ -1,4 +1,5 @@ -{ config, +{ + config, lib, ... }: @@ -7,15 +8,22 @@ let inherit (lib) mkEnableOption mkIf mkMerge; cfg = config.hardware.asus.zephyrus.ga402x; -in { +in +{ imports = [ ../shared.nix ]; options.hardware.asus.zephyrus.ga402x.amdgpu = { - recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = false; }; - sg_display.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = true; }; - psr.enable = (mkEnableOption "Enable amdgpu.dcdebugmask=0x10 kernel boot param") // { default = true; }; + recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { + default = false; + }; + sg_display.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { + default = true; + }; + psr.enable = (mkEnableOption "Enable amdgpu.dcdebugmask=0x10 kernel boot param") // { + default = true; + }; }; config = mkMerge [ diff --git a/asus/zephyrus/ga402x/nvidia/default.nix b/asus/zephyrus/ga402x/nvidia/default.nix index 7c5b1d7f..c2750490 100644 --- a/asus/zephyrus/ga402x/nvidia/default.nix +++ b/asus/zephyrus/ga402x/nvidia/default.nix @@ -1,4 +1,5 @@ -{ lib, +{ + lib, pkgs, ... }: @@ -6,7 +7,8 @@ let inherit (lib) mkDefault; -in { +in +{ imports = [ ../shared.nix ## "prime.nix" loads this, aleady: diff --git a/asus/zephyrus/ga402x/shared.nix b/asus/zephyrus/ga402x/shared.nix index f1069037..bd0eda35 100644 --- a/asus/zephyrus/ga402x/shared.nix +++ b/asus/zephyrus/ga402x/shared.nix @@ -1,14 +1,24 @@ -{ config, +{ + config, pkgs, lib, ... }: let - inherit (lib) mkDefault mkEnableOption mkIf mkMerge version versionAtLeast versionOlder; + inherit (lib) + mkDefault + mkEnableOption + mkIf + mkMerge + version + versionAtLeast + versionOlder + ; cfg = config.hardware.asus.zephyrus.ga402x; -in { +in +{ imports = [ ../../../common/cpu/amd @@ -26,12 +36,12 @@ in { # enables it for kernel 6.9.x onwards. # # Note: the device name is "ASUS N-KEY Device". - keyboard.autosuspend.enable = ( - mkEnableOption "Enable auto-suspend on the internal USB keyboard (ASUS N-KEY Device) on Zephyrus GA402X" - ) // { - default = versionAtLeast config.boot.kernelPackages.kernel.version "6.9"; - defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\""; - }; + keyboard.autosuspend.enable = + (mkEnableOption "Enable auto-suspend on the internal USB keyboard (ASUS N-KEY Device) on Zephyrus GA402X") + // { + default = versionAtLeast config.boot.kernelPackages.kernel.version "6.9"; + defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\""; + }; # The ASUS 8295 ITE device will cause an immediate wake-up when trying to suspend the laptop. # After the first successful hibernate, it will work as expected, however. # NOTE: I'm not actually sure what this device, as neither the touchpad nor the M1-M4 keys cause a wake-up. @@ -67,7 +77,7 @@ in { }; } - (mkIf (! cfg.keyboard.autosuspend.enable) { + (mkIf (!cfg.keyboard.autosuspend.enable) { services.udev.extraRules = '' # Disable power auto-suspend for the ASUS N-KEY device, i.e. USB Keyboard. # Otherwise on certain kernel-versions, it will tend to take 1-2 key-presses to wake-up after the device suspends. @@ -75,7 +85,7 @@ in { ''; }) - (mkIf (! cfg.ite-device.wakeup.enable) { + (mkIf (!cfg.ite-device.wakeup.enable) { services.udev.extraRules = '' # Disable power wakeup for the 8295 ITE device. # Otherwise on certain kernel-versions, it will tend to cause the laptop to immediately wake-up when suspending. diff --git a/asus/zephyrus/gu605my/default.nix b/asus/zephyrus/gu605my/default.nix index f9f1d9ac..3ccbdbfd 100644 --- a/asus/zephyrus/gu605my/default.nix +++ b/asus/zephyrus/gu605my/default.nix @@ -7,6 +7,7 @@ ../../../common/gpu/nvidia/ada-lovelace ../../../common/pc/laptop ../../../common/pc/ssd + ../shared/backlight.nix ]; hardware.nvidia = { @@ -15,6 +16,7 @@ nvidiaBusId = "PCI:1:0:0"; }; + modesetting.enable = lib.mkDefault true; dynamicBoost.enable = lib.mkDefault true; }; @@ -23,7 +25,9 @@ udev.extraHwdb = '' evdev:name:*:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:* - KEYBOARD_KEY_ff31007c=f20 # fixes mic mute button + KEYBOARD_KEY_ff31007c=f20 # fixes mic mute button + KEYBOARD_KEY_ff3100b2=home # Set fn+LeftArrow as Home + KEYBOARD_KEY_ff3100b3=end # Set fn+RightArrow as End ''; }; } diff --git a/asus/zephyrus/shared/backlight.nix b/asus/zephyrus/shared/backlight.nix new file mode 100644 index 00000000..938ce4ac --- /dev/null +++ b/asus/zephyrus/shared/backlight.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + # These flags are used to enable backlight control when the dGPU is working in hybrid mode + boot.kernelParams = [ + "i915.enable_dpcd_backlight=1" + "nvidia.NVreg_EnableBacklightHandler=0" + "nvidia.NVReg_RegistryDwords=EnableBrightnessControl=0" + ]; +} diff --git a/chuwi/minibook-x/default.nix b/chuwi/minibook-x/default.nix index 39bc9ccc..480909e2 100644 --- a/chuwi/minibook-x/default.nix +++ b/chuwi/minibook-x/default.nix @@ -1,11 +1,14 @@ -{ ... }: { +{ ... }: +{ imports = [ ../../common/cpu/intel ../../common/pc/laptop - ../../common/pc/laptop/ssd + ../../common/pc/ssd ../../common/hidpi.nix ]; # Fixes the display being rotated 90 degrees. - boot.kernelParams = - [ "fbcon=rotate:1" "video=DSI-1:panel_orientation=right_side_up" ]; + boot.kernelParams = [ + "fbcon=rotate:1" + "video=DSI-1:panel_orientation=right_side_up" + ]; } diff --git a/common/cpu/amd/default.nix b/common/cpu/amd/default.nix index d8c48a26..10ec6fd5 100644 --- a/common/cpu/amd/default.nix +++ b/common/cpu/amd/default.nix @@ -1,6 +1,5 @@ { config, lib, ... }: { - hardware.cpu.amd.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/common/cpu/amd/pstate.nix b/common/cpu/amd/pstate.nix index 6a84027a..19f1d74f 100644 --- a/common/cpu/amd/pstate.nix +++ b/common/cpu/amd/pstate.nix @@ -8,23 +8,13 @@ in imports = [ ./. ]; boot = lib.mkMerge [ - (lib.mkIf - ( - (lib.versionAtLeast kver "5.17") - && (lib.versionOlder kver "6.1") - ) - { - kernelParams = [ "initcall_blacklist=acpi_cpufreq_init" ]; - kernelModules = [ "amd-pstate" ]; - }) - (lib.mkIf - ( - (lib.versionAtLeast kver "6.1") - && (lib.versionOlder kver "6.3") - ) - { - kernelParams = [ "amd_pstate=passive" ]; - }) + (lib.mkIf ((lib.versionAtLeast kver "5.17") && (lib.versionOlder kver "6.1")) { + kernelParams = [ "initcall_blacklist=acpi_cpufreq_init" ]; + kernelModules = [ "amd-pstate" ]; + }) + (lib.mkIf ((lib.versionAtLeast kver "6.1") && (lib.versionOlder kver "6.3")) { + kernelParams = [ "amd_pstate=passive" ]; + }) (lib.mkIf (lib.versionAtLeast kver "6.3") { kernelParams = [ "amd_pstate=active" ]; }) diff --git a/common/cpu/intel/comet-lake/default.nix b/common/cpu/intel/comet-lake/default.nix index 3c688f50..25af65fe 100644 --- a/common/cpu/intel/comet-lake/default.nix +++ b/common/cpu/intel/comet-lake/default.nix @@ -3,4 +3,6 @@ ./cpu-only.nix ../../../gpu/intel/comet-lake ]; + + hardware.intelgpu.vaapiDriver = "intel-media-driver"; } diff --git a/common/cpu/intel/meteor-lake/default.nix b/common/cpu/intel/meteor-lake/default.nix new file mode 100644 index 00000000..1330e1c5 --- /dev/null +++ b/common/cpu/intel/meteor-lake/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ../cpu-only.nix + ../../../gpu/intel/meteor-lake + ]; +} diff --git a/common/cpu/intel/raptor-lake/default.nix b/common/cpu/intel/raptor-lake/default.nix new file mode 100644 index 00000000..665d3d41 --- /dev/null +++ b/common/cpu/intel/raptor-lake/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../. + ]; +} diff --git a/common/cpu/intel/skylake/cpu-only.nix b/common/cpu/intel/skylake/cpu-only.nix new file mode 100644 index 00000000..82892615 --- /dev/null +++ b/common/cpu/intel/skylake/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/common/cpu/intel/skylake/default.nix b/common/cpu/intel/skylake/default.nix new file mode 100644 index 00000000..80deef3f --- /dev/null +++ b/common/cpu/intel/skylake/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/skylake + ]; +} diff --git a/common/cpu/intel/whiskey-lake/cpu-only.nix b/common/cpu/intel/whiskey-lake/cpu-only.nix new file mode 100644 index 00000000..82892615 --- /dev/null +++ b/common/cpu/intel/whiskey-lake/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/common/cpu/intel/whiskey-lake/default.nix b/common/cpu/intel/whiskey-lake/default.nix new file mode 100644 index 00000000..2cb88597 --- /dev/null +++ b/common/cpu/intel/whiskey-lake/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/whiskey-lake + ]; +} diff --git a/common/gpu/24.05-compat.nix b/common/gpu/24.05-compat.nix index 17508882..bcccd2ca 100644 --- a/common/gpu/24.05-compat.nix +++ b/common/gpu/24.05-compat.nix @@ -6,9 +6,18 @@ # Backward-compat for 24.05, can be removed after we drop 24.05 support imports = lib.optionals (lib.versionOlder lib.version "24.11pre") [ (lib.mkAliasOptionModule [ "hardware" "graphics" "enable" ] [ "hardware" "opengl" "enable" ]) - (lib.mkAliasOptionModule [ "hardware" "graphics" "extraPackages" ] [ "hardware" "opengl" "extraPackages" ]) - (lib.mkAliasOptionModule [ "hardware" "graphics" "extraPackages32" ] [ "hardware" "opengl" "extraPackages32" ]) - (lib.mkAliasOptionModule [ "hardware" "graphics" "enable32Bit" ] [ "hardware" "opengl" "driSupport32Bit" ]) + (lib.mkAliasOptionModule + [ "hardware" "graphics" "extraPackages" ] + [ "hardware" "opengl" "extraPackages" ] + ) + (lib.mkAliasOptionModule + [ "hardware" "graphics" "extraPackages32" ] + [ "hardware" "opengl" "extraPackages32" ] + ) + (lib.mkAliasOptionModule + [ "hardware" "graphics" "enable32Bit" ] + [ "hardware" "opengl" "driSupport32Bit" ] + ) (lib.mkAliasOptionModule [ "hardware" "graphics" "package" ] [ "hardware" "opengl" "package" ]) (lib.mkAliasOptionModule [ "hardware" "graphics" "package32" ] [ "hardware" "opengl" "package32" ]) ]; diff --git a/common/gpu/amd/sea-islands/default.nix b/common/gpu/amd/sea-islands/default.nix index 697e8250..593d7437 100644 --- a/common/gpu/amd/sea-islands/default.nix +++ b/common/gpu/amd/sea-islands/default.nix @@ -1,5 +1,8 @@ { imports = [ ../. ]; # Explicitly set amdgpu support in place of radeon - boot.kernelParams = [ "radeon.cik_support=0" "amdgpu.cik_support=1" ]; + boot.kernelParams = [ + "radeon.cik_support=0" + "amdgpu.cik_support=1" + ]; } diff --git a/common/gpu/amd/southern-islands/default.nix b/common/gpu/amd/southern-islands/default.nix index 4939117f..fa98cb1a 100644 --- a/common/gpu/amd/southern-islands/default.nix +++ b/common/gpu/amd/southern-islands/default.nix @@ -1,5 +1,8 @@ { imports = [ ../. ]; # Explicitly set amdgpu support in place of radeon - boot.kernelParams = [ "radeon.si_support=0" "amdgpu.si_support=1" ]; + boot.kernelParams = [ + "radeon.si_support=0" + "amdgpu.si_support=1" + ]; } diff --git a/common/gpu/intel/default.nix b/common/gpu/intel/default.nix index 28c6e93e..a8671d41 100644 --- a/common/gpu/intel/default.nix +++ b/common/gpu/intel/default.nix @@ -45,11 +45,15 @@ intel-vaapi-driver = (pkgs.intel-vaapi-driver or pkgs.vaapiIntel).override { enableHybridCodec = cfg.enableHybridCodec; }; - intel-vaapi-driver-32 = (pkgs.driversi686Linux.intel-vaapi-driver or pkgs.driversi686Linux.vaapiIntel).override { - enableHybridCodec = cfg.enableHybridCodec; - }; + intel-vaapi-driver-32 = + (pkgs.driversi686Linux.intel-vaapi-driver or pkgs.driversi686Linux.vaapiIntel).override + { + enableHybridCodec = cfg.enableHybridCodec; + }; - useIntelOcl = useIntelVaapiDriver && (config.hardware.enableAllFirmware or config.nixpkgs.config.allowUnfree or false); + useIntelOcl = + useIntelVaapiDriver + && (config.hardware.enableAllFirmware or config.nixpkgs.config.allowUnfree or false); intel-ocl = pkgs.intel-ocl; useIntelMediaDriver = cfg.vaapiDriver == "intel-media-driver" || cfg.vaapiDriver == null; diff --git a/common/gpu/intel/meteor-lake/default.nix b/common/gpu/intel/meteor-lake/default.nix new file mode 100644 index 00000000..eb5abe99 --- /dev/null +++ b/common/gpu/intel/meteor-lake/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ ../. ]; + + hardware.intelgpu.vaapiDriver = "intel-media-driver"; +} diff --git a/common/gpu/intel/raptor-lake/default.nix b/common/gpu/intel/raptor-lake/default.nix new file mode 100644 index 00000000..665d3d41 --- /dev/null +++ b/common/gpu/intel/raptor-lake/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../. + ]; +} diff --git a/common/gpu/intel/skylake/default.nix b/common/gpu/intel/skylake/default.nix new file mode 100644 index 00000000..e9c24279 --- /dev/null +++ b/common/gpu/intel/skylake/default.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: + +{ + imports = [ ../. ]; + + boot.kernelParams = [ + "i915.enable_guc=2" + ]; + + # VP9 decoding not supported when using intel-media-driver + # https://github.com/intel/media-driver/issues/1024 + # NixOS Wiki recommends using the legacy intel-vaapi-driver with the hybrid codec over that one for Skylake. + # https://wiki.nixos.org/wiki/Accelerated_Video_Playback + hardware.intelgpu = { + vaapiDriver = "intel-vaapi-driver"; + enableHybridCodec = true; + }; +} diff --git a/common/gpu/intel/whiskey-lake/default.nix b/common/gpu/intel/whiskey-lake/default.nix new file mode 100644 index 00000000..43ed1c46 --- /dev/null +++ b/common/gpu/intel/whiskey-lake/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ ../. ]; + + boot.kernelParams = [ "i915.enable_guc=2" ]; + + hardware.intelgpu.vaapiDriver = "intel-media-driver"; +} diff --git a/common/gpu/nvidia/ada-lovelace/default.nix b/common/gpu/nvidia/ada-lovelace/default.nix index 461ae914..5e8d48f6 100644 --- a/common/gpu/nvidia/ada-lovelace/default.nix +++ b/common/gpu/nvidia/ada-lovelace/default.nix @@ -1,4 +1,4 @@ -{lib, config, ...}: +{ lib, config, ... }: let nvidiaPackage = config.hardware.nvidia.package; in diff --git a/common/gpu/nvidia/ampere/default.nix b/common/gpu/nvidia/ampere/default.nix index 461ae914..5e8d48f6 100644 --- a/common/gpu/nvidia/ampere/default.nix +++ b/common/gpu/nvidia/ampere/default.nix @@ -1,4 +1,4 @@ -{lib, config, ...}: +{ lib, config, ... }: let nvidiaPackage = config.hardware.nvidia.package; in diff --git a/common/gpu/nvidia/default.nix b/common/gpu/nvidia/default.nix index df28c06a..281e33f7 100644 --- a/common/gpu/nvidia/default.nix +++ b/common/gpu/nvidia/default.nix @@ -3,6 +3,4 @@ { imports = [ ../24.05-compat.nix ]; services.xserver.videoDrivers = lib.mkDefault [ "nvidia" ]; - # TODO: this will be a default after https://github.com/NixOS/nixpkgs/pull/326369 - hardware.nvidia.modesetting.enable = lib.mkDefault true; } diff --git a/common/gpu/nvidia/disable.nix b/common/gpu/nvidia/disable.nix index 6ea07adc..550da56e 100644 --- a/common/gpu/nvidia/disable.nix +++ b/common/gpu/nvidia/disable.nix @@ -8,7 +8,7 @@ blacklist nouveau options nouveau modeset=0 ''; - + services.udev.extraRules = '' # Remove NVIDIA USB xHCI Host Controller devices, if present ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1" @@ -22,5 +22,10 @@ # Remove NVIDIA VGA/3D controller devices ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1" ''; - boot.blacklistedKernelModules = [ "nouveau" "nvidia" "nvidia_drm" "nvidia_modeset" ]; + boot.blacklistedKernelModules = [ + "nouveau" + "nvidia" + "nvidia_drm" + "nvidia_modeset" + ]; } diff --git a/common/gpu/nvidia/fermi/default.nix b/common/gpu/nvidia/fermi/default.nix new file mode 100644 index 00000000..0f5c47f0 --- /dev/null +++ b/common/gpu/nvidia/fermi/default.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + imports = [ ../. ]; + + # The open source driver does not support Fermi GPUs. + hardware.nvidia.open = false; +} diff --git a/common/gpu/nvidia/kepler/default.nix b/common/gpu/nvidia/kepler/default.nix index f8d89a1e..129bcad4 100644 --- a/common/gpu/nvidia/kepler/default.nix +++ b/common/gpu/nvidia/kepler/default.nix @@ -1,4 +1,4 @@ -{lib, ...}: +{ lib, ... }: { imports = [ ../. ]; diff --git a/common/gpu/nvidia/maxwell/default.nix b/common/gpu/nvidia/maxwell/default.nix index 89565090..194f39c9 100644 --- a/common/gpu/nvidia/maxwell/default.nix +++ b/common/gpu/nvidia/maxwell/default.nix @@ -1,4 +1,4 @@ -{lib, ...}: +{ lib, ... }: { imports = [ ../. ]; diff --git a/common/gpu/nvidia/pascal/default.nix b/common/gpu/nvidia/pascal/default.nix index ad3555dc..acd77a2b 100644 --- a/common/gpu/nvidia/pascal/default.nix +++ b/common/gpu/nvidia/pascal/default.nix @@ -1,4 +1,4 @@ -{lib, ...}: +{ lib, ... }: { imports = [ ../. ]; diff --git a/common/gpu/nvidia/prime.nix b/common/gpu/nvidia/prime.nix index e54f942c..edfda26d 100644 --- a/common/gpu/nvidia/prime.nix +++ b/common/gpu/nvidia/prime.nix @@ -3,11 +3,35 @@ { imports = [ ./. ]; - hardware.nvidia.prime = { - offload = { - enable = lib.mkOverride 990 true; - enableOffloadCmd = lib.mkIf config.hardware.nvidia.prime.offload.enable true; # Provides `nvidia-offload` command. + options = { + hardware.nvidia.primeBatterySaverSpecialisation = lib.mkEnableOption "configure a specialisation which turns on NVIDIA Prime battery saver"; + }; + + config = { + + hardware.nvidia.prime = { + offload = { + enable = lib.mkOverride 990 true; + enableOffloadCmd = lib.mkIf config.hardware.nvidia.prime.offload.enable true; # Provides `nvidia-offload` command. + }; + # Hardware should specify the bus ID for intel/nvidia devices + }; + + specialisation = lib.mkIf config.hardware.nvidia.primeBatterySaverSpecialisation { + battery-saver.configuration = { + system.nixos.tags = [ "battery-saver" ]; + imports = [ + # Leave only the integrated GPU enabled + ./disable.nix + ]; + hardware.nvidia = { + prime.offload.enable = lib.mkForce false; + powerManagement = { + enable = lib.mkForce false; + finegrained = lib.mkForce false; + }; + }; + }; }; - # Hardware should specify the bus ID for intel/nvidia devices }; } diff --git a/common/gpu/nvidia/turing/default.nix b/common/gpu/nvidia/turing/default.nix index 461ae914..5e8d48f6 100644 --- a/common/gpu/nvidia/turing/default.nix +++ b/common/gpu/nvidia/turing/default.nix @@ -1,4 +1,4 @@ -{lib, config, ...}: +{ lib, config, ... }: let nvidiaPackage = config.hardware.nvidia.package; in diff --git a/common/pc/laptop/default.nix b/common/pc/laptop/default.nix index 9121b5f0..abc76fa7 100644 --- a/common/pc/laptop/default.nix +++ b/common/pc/laptop/default.nix @@ -6,6 +6,8 @@ # Gnome 40 introduced a new way of managing power, without tlp. # However, these 2 services clash when enabled simultaneously. # https://github.com/NixOS/nixos-hardware/issues/260 - services.tlp.enable = lib.mkDefault ((lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") - || !config.services.power-profiles-daemon.enable); + services.tlp.enable = lib.mkDefault ( + (lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") + || !config.services.power-profiles-daemon.enable + ); } diff --git a/common/pc/laptop/ssd b/common/pc/laptop/ssd deleted file mode 120000 index e313834a..00000000 --- a/common/pc/laptop/ssd +++ /dev/null @@ -1 +0,0 @@ -../ssd \ No newline at end of file diff --git a/default.nix b/default.nix index fbb5b770..c73bd5ad 100644 --- a/default.nix +++ b/default.nix @@ -1,3 +1,3 @@ # This file is necessary so nix-env -qa does not break, # when nixos-hardware is used as a channel -{} +{ } diff --git a/dell/e7240/default.nix b/dell/e7240/default.nix index 102da6bb..5b819abf 100644 --- a/dell/e7240/default.nix +++ b/dell/e7240/default.nix @@ -1,6 +1,13 @@ { imports = [ - ../../common/cpu/intel - ../../common/pc/laptop + ../latitude/e7240/default.nix + ]; + + warnings = [ + '' + DEPRECATED: Importing dell/e7240 is deprecated. Use dell/latitude/e7240 instead. + + This module will be removed in a future release. + '' ]; } diff --git a/dell/g3/3579/default.nix b/dell/g3/3579/default.nix index e5246c4c..9b74d522 100644 --- a/dell/g3/3579/default.nix +++ b/dell/g3/3579/default.nix @@ -6,7 +6,7 @@ ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/pascal ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Specify bus id of Nvidia and Intel graphics diff --git a/dell/g3/3779/default.nix b/dell/g3/3779/default.nix index c9afd482..4e345a02 100644 --- a/dell/g3/3779/default.nix +++ b/dell/g3/3779/default.nix @@ -6,7 +6,7 @@ ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/pascal ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Specify bus id of Nvidia and Intel graphics diff --git a/dell/inspiron/14-5420/default.nix b/dell/inspiron/14-5420/default.nix index 658f0b3b..8958afe6 100644 --- a/dell/inspiron/14-5420/default.nix +++ b/dell/inspiron/14-5420/default.nix @@ -1,22 +1,22 @@ { lib, ... }: - + { - imports = [ - ../../../common/cpu/intel - ../../../common/pc/laptop - ../../../common/pc/ssd - ]; + imports = [ + ../../../common/cpu/intel + ../../../common/pc/laptop + ../../../common/pc/ssd + ]; - hardware = { - enableRedistributableFirmware = lib.mkDefault true; - }; + hardware = { + enableRedistributableFirmware = lib.mkDefault true; + }; - services = { - fwupd = { - enable = lib.mkDefault true; - }; - thermald = { - enable = lib.mkDefault true; - }; - }; + services = { + fwupd = { + enable = lib.mkDefault true; + }; + thermald = { + enable = lib.mkDefault true; + }; + }; } diff --git a/dell/inspiron/3442/default.nix b/dell/inspiron/3442/default.nix index 44b65ce6..0d298ff3 100644 --- a/dell/inspiron/3442/default.nix +++ b/dell/inspiron/3442/default.nix @@ -2,9 +2,8 @@ { imports = [ - ../../../common/cpu/intel + ../../../common/cpu/intel/haswell ../../../common/pc/laptop - ../../../common/gpu/intel/haswell ]; hardware.enableAllFirmware = lib.mkDefault true; diff --git a/dell/inspiron/5515/default.nix b/dell/inspiron/5515/default.nix index c2e8e310..452e9fae 100644 --- a/dell/inspiron/5515/default.nix +++ b/dell/inspiron/5515/default.nix @@ -16,7 +16,10 @@ serviceConfig.Type = "oneshot"; description = "reload touchpad driver"; # must run at boot (and not too early), and after suspend - wantedBy = [ "display-manager.service" "post-resume.target" ]; + wantedBy = [ + "display-manager.service" + "post-resume.target" + ]; # prevent running before suspend after = [ "post-resume.target" ]; }; @@ -24,7 +27,6 @@ # so that post-resume.service exists powerManagement.enable = true; - # fix suspend # https://bbs.archlinux.org/viewtopic.php?id=266108 says linux >= 5.12 required boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") pkgs.linuxPackages_latest; diff --git a/dell/inspiron/7405/default.nix b/dell/inspiron/7405/default.nix index 06ccf92f..8068e8eb 100644 --- a/dell/inspiron/7405/default.nix +++ b/dell/inspiron/7405/default.nix @@ -7,11 +7,14 @@ with lib; ../../../common/cpu/amd ../../../common/gpu/amd ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # TSC is unstable - boot.kernelParams = [ "notsc" "trace_clock=local" ]; + boot.kernelParams = [ + "notsc" + "trace_clock=local" + ]; hardware.enableRedistributableFirmware = mkDefault true; } diff --git a/dell/inspiron/7460/default.nix b/dell/inspiron/7460/default.nix index 5a268970..aacbacaa 100644 --- a/dell/inspiron/7460/default.nix +++ b/dell/inspiron/7460/default.nix @@ -3,7 +3,7 @@ { imports = [ ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../../common/gpu/intel/kaby-lake ../../../common/gpu/nvidia/maxwell ../../../common/gpu/nvidia/prime.nix diff --git a/dell/inspiron/7559/README.md b/dell/inspiron/7559/README.md new file mode 100644 index 00000000..6a4b2033 --- /dev/null +++ b/dell/inspiron/7559/README.md @@ -0,0 +1,58 @@ +## Dell Inspiron 7559 + +### Tested Hardware + +```shellsession +$ lspci -nn +00:00.0 Host bridge [0600]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers [8086:1910] (rev 07) +00:01.0 PCI bridge [0604]: Intel Corporation 6th-10th Gen Core Processor PCIe Controller (x16) [8086:1901] (rev 07) +00:01.1 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x8) [8086:1905] (rev 07) +00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 530 [8086:191b] (rev 06) +00:04.0 Signal processing controller [1180]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem [8086:1903] (rev 07) +00:14.0 USB controller [0c03]: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller [8086:a12f] (rev 31) +00:14.2 Signal processing controller [1180]: Intel Corporation 100 Series/C230 Series Chipset Family Thermal Subsystem [8086:a131] (rev 31) +00:15.0 Signal processing controller [1180]: Intel Corporation 100 Series/C230 Series Chipset Family Serial IO I2C Controller #0 [8086:a160] (rev 31) +00:16.0 Communication controller [0780]: Intel Corporation 100 Series/C230 Series Chipset Family MEI Controller #1 [8086:a13a] (rev 31) +00:17.0 SATA controller [0106]: Intel Corporation HM170/QM170 Chipset SATA Controller [AHCI Mode] [8086:a103] (rev 31) +00:1c.0 PCI bridge [0604]: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #1 [8086:a110] (rev f1) +00:1c.4 PCI bridge [0604]: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #5 [8086:a114] (rev f1) +00:1c.5 PCI bridge [0604]: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #6 [8086:a115] (rev f1) +00:1c.6 PCI bridge [0604]: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #7 [8086:a116] (rev f1) +00:1f.0 ISA bridge [0601]: Intel Corporation HM170 Chipset LPC/eSPI Controller [8086:a14e] (rev 31) +00:1f.2 Memory controller [0580]: Intel Corporation 100 Series/C230 Series Chipset Family Power Management Controller [8086:a121] (rev 31) +00:1f.3 Audio device [0403]: Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller [8086:a170] (rev 31) +00:1f.4 SMBus [0c05]: Intel Corporation 100 Series/C230 Series Chipset Family SMBus [8086:a123] (rev 31) +02:00.0 3D controller [0302]: NVIDIA Corporation GM107M [GeForce GTX 960M] [10de:139b] (rev a2) +04:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 10) +05:00.0 Network controller [0280]: Intel Corporation Wireless 3165 [8086:3165] (rev 79) +06:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader [10ec:522a] (rev 01) + +``` + +### Extra Configuration + +#### Bluetooth + +To enable bluetooth support, set `hardware.bluetooth.enable = true;`. + +#### Prime Offloading + +This configuration uses Nvidia Prime offloading, which allows use of the `nvidia-offload` script for running commands on the dGPU. For example, you can instruct Steam to launch a game offloaded to the GPU by setting the launch options for that game to `nvidia-offload %command%`. + +#### SSD + +This laptop has an optional M.2 SSD slot, which isn't accounted for here. If you are using the SSD, you could look into implementing the options in [ssd](common/pc/ssd) manually. Some sources also say you should ensure your SATA Mode is set to AHCI in your BIOS for it to be detected, however I think this is a prerequisite to installing Linux on this laptop in the first place so you probably already have that set. + +#### Subwoofer + +Tested with the default PipeWire configuration on Plasma, the subwoofer appears to work depending on the device Profile in sound settings ("Analog Stereo Duplex" works best for me). I have had issues with it in the past on other distros, so if it's not working on your system you could try the solution in [this thread](https://bbs.archlinux.org/viewtopic.php?id=207222). + +#### Other issues + +There are plenty of documented bugs and threads around issues on Dell laptops like this. Some of them stem from using the nouveau drivers, but we're using the proprietary Nvidia drivers here. Some things to look into if you're experiencing issues: + +* I/O is slow: `nouveau` could be added as a kernel blocklist item: searching this repo shows other laptops with this configuration +* Power drain while sleeping: add the following as boot.kernelParams: `"mem_sleep_default=deep"` +* Issues coming back from suspend (particularly if the previous kernelParam is applied): add the following as boot.kernelParams: `"acpi_rev_override=1"` `"acpi_osi=Linux"` + * I also spotted [one person recommending](https://connorkuehl.github.io/dell-inspiron-7559-linux-guide/) setting just `"acpi_osi="`. This article is quite old though and I haven't tested the difference. +* Brightness function keys don't work: add the following as boot.kernelParams: `"acpi_backlight=vendor"` or `"acpi_backlight=native"` diff --git a/dell/inspiron/7559/default.nix b/dell/inspiron/7559/default.nix new file mode 100644 index 00000000..d742d249 --- /dev/null +++ b/dell/inspiron/7559/default.nix @@ -0,0 +1,24 @@ +{ lib, ... }: + +{ + imports = [ + ../../../common/pc/laptop + ../../../common/pc/laptop/hdd + ../../../common/cpu/intel/skylake + ../../../common/gpu/nvidia/maxwell + ../../../common/gpu/nvidia/prime.nix + ]; + + hardware = { + nvidia.prime = { + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:2:0:0"; + }; + + enableRedistributableFirmware = lib.mkDefault true; + }; + + services = { + thermald.enable = lib.mkDefault true; + }; +} diff --git a/dell/latitude/3340/default.nix b/dell/latitude/3340/default.nix index d50b024c..dda36a88 100644 --- a/dell/latitude/3340/default.nix +++ b/dell/latitude/3340/default.nix @@ -4,6 +4,6 @@ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; } diff --git a/dell/latitude/3480/default.nix b/dell/latitude/3480/default.nix index 0b16e0aa..e54673cb 100644 --- a/dell/latitude/3480/default.nix +++ b/dell/latitude/3480/default.nix @@ -4,7 +4,7 @@ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # touchpad goes over i2c diff --git a/dell/latitude/5490/default.nix b/dell/latitude/5490/default.nix index ee99f414..9790967c 100644 --- a/dell/latitude/5490/default.nix +++ b/dell/latitude/5490/default.nix @@ -4,18 +4,21 @@ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Important Firmware hardware.enableRedistributableFirmware = lib.mkDefault true; - + boot = { # Kernel Panic on suspend fix, taken from ArchLinux wiki. - kernelParams = [ "acpi_enforce_resources=lax" "i915.enable_dc=0" ]; + kernelParams = [ + "acpi_enforce_resources=lax" + "i915.enable_dc=0" + ]; # Audio Mute LED extraModprobeConfig = '' - options snd-hda-intel model=mute-led-gpio + options snd-hda-intel model=mute-led-gpio ''; }; } diff --git a/dell/latitude/5520/default.nix b/dell/latitude/5520/default.nix index 6ad43309..b72a1830 100644 --- a/dell/latitude/5520/default.nix +++ b/dell/latitude/5520/default.nix @@ -4,7 +4,7 @@ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Essential Firmware diff --git a/dell/latitude/7280/default.nix b/dell/latitude/7280/default.nix index 3b57a289..c98daed5 100644 --- a/dell/latitude/7280/default.nix +++ b/dell/latitude/7280/default.nix @@ -4,6 +4,6 @@ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; } diff --git a/dell/latitude/7420/default.nix b/dell/latitude/7420/default.nix index a100101a..7e1f49f1 100644 --- a/dell/latitude/7420/default.nix +++ b/dell/latitude/7420/default.nix @@ -4,6 +4,6 @@ imports = [ ../../../common/cpu/intel/tiger-lake ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; } diff --git a/dell/latitude/7430/default.nix b/dell/latitude/7430/default.nix index 7d2f6f98..18f4bb21 100644 --- a/dell/latitude/7430/default.nix +++ b/dell/latitude/7430/default.nix @@ -4,16 +4,16 @@ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; - boot.kernelParams = [ + boot.kernelParams = [ # needed for Intel Iris Xe "i915.force_probe=46a8" "i915.enable_guc=3" "i915.fastboot=1" # needed for keyboard - "i8042.dumbkbd=1" - "i8042.nopnp=1" + "i8042.dumbkbd=1" + "i8042.nopnp=1" ]; } diff --git a/dell/latitude/9430/default.nix b/dell/latitude/9430/default.nix index f652e9ac..0441f53d 100644 --- a/dell/latitude/9430/default.nix +++ b/dell/latitude/9430/default.nix @@ -4,7 +4,7 @@ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; boot.kernelParams = [ diff --git a/dell/e7240/README.md b/dell/latitude/e7240/README.md similarity index 100% rename from dell/e7240/README.md rename to dell/latitude/e7240/README.md diff --git a/dell/latitude/e7240/default.nix b/dell/latitude/e7240/default.nix new file mode 100644 index 00000000..14701f94 --- /dev/null +++ b/dell/latitude/e7240/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ../../../common/cpu/intel + ../../../common/pc/laptop + ]; +} diff --git a/dell/precision/3490/default.nix b/dell/precision/3490/default.nix new file mode 100644 index 00000000..08d80d2f --- /dev/null +++ b/dell/precision/3490/default.nix @@ -0,0 +1,16 @@ +{ + warnings = [ + '' + DEPRECATED: The module has been deprecated. + + Either use + + for NVIDIA graphics or + + for Intel graphics. + '' + ]; + imports = [ + ./nvidia/default.nix + ]; +} diff --git a/dell/precision/3490/intel/default.nix b/dell/precision/3490/intel/default.nix new file mode 100644 index 00000000..a5678040 --- /dev/null +++ b/dell/precision/3490/intel/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../shared.nix + ]; +} diff --git a/dell/precision/3490/nvidia/default.nix b/dell/precision/3490/nvidia/default.nix new file mode 100644 index 00000000..3418debe --- /dev/null +++ b/dell/precision/3490/nvidia/default.nix @@ -0,0 +1,11 @@ +{ + imports = [ + ../shared.nix + ../../../../common/gpu/nvidia/ada-lovelace + ]; + + hardware.nvidia.prime = { + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + }; +} diff --git a/dell/precision/3490/shared.nix b/dell/precision/3490/shared.nix new file mode 100644 index 00000000..a4de2011 --- /dev/null +++ b/dell/precision/3490/shared.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ../../../common/cpu/intel/meteor-lake + ../../../common/pc/laptop + ]; +} diff --git a/dell/precision/5490/default.nix b/dell/precision/5490/default.nix index b2cbabe4..d3619547 100644 --- a/dell/precision/5490/default.nix +++ b/dell/precision/5490/default.nix @@ -4,7 +4,9 @@ ../../../common/gpu/nvidia/ada-lovelace ]; - boot.kernelParams = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.7") [ "i915.force_probe=7d55" ]; + boot.kernelParams = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.7") [ + "i915.force_probe=7d55" + ]; hardware.nvidia.prime = { intelBusId = "PCI:0:2:0"; diff --git a/dell/precision/5530/default.nix b/dell/precision/5530/default.nix index 6f270c26..38390c8d 100644 --- a/dell/precision/5530/default.nix +++ b/dell/precision/5530/default.nix @@ -1,9 +1,9 @@ -{ lib, config, ... }: +{ lib, ... }: { imports = [ ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../../common/gpu/nvidia/pascal ../../../common/gpu/nvidia/prime.nix ../../../common/cpu/intel/coffee-lake @@ -29,19 +29,17 @@ hardware = { nvidia = { - open = lib.mkDefault false; nvidiaSettings = lib.mkDefault true; modesetting.enable = lib.mkDefault true; - package = lib.mkDefault config.boot.kernelPackages.nvidiaPackages.stable; prime = { intelBusId = lib.mkDefault "PCI:0:2:0"; nvidiaBusId = lib.mkDefault "PCI:1:0:0"; }; }; }; - # This will save you money and possibly your life! services = { fwupd.enable = lib.mkDefault true; + # This will save you money and possibly your life! thermald.enable = lib.mkDefault true; }; } diff --git a/dell/precision/5560/default.nix b/dell/precision/5560/default.nix index a17ef775..efd227ca 100644 --- a/dell/precision/5560/default.nix +++ b/dell/precision/5560/default.nix @@ -2,7 +2,7 @@ { imports = [ ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../../common/cpu/intel/tiger-lake ../../../common/gpu/nvidia/turing ]; diff --git a/dell/precision/7520/default.nix b/dell/precision/7520/default.nix index 59fa95e6..4742afb3 100644 --- a/dell/precision/7520/default.nix +++ b/dell/precision/7520/default.nix @@ -2,22 +2,29 @@ config, lib, ... -}: { +}: +{ imports = [ ../../../common/cpu/intel/kaby-lake ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../../common/gpu/nvidia ]; hardware.enableRedistributableFirmware = lib.mkDefault true; - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "usb_storage" + "sd_mod" + "rtsx_pci_sdmmc" + ]; boot = { - kernelModules = ["kvm-intel"]; - blacklistedKernelModules = ["nouveau"]; + kernelModules = [ "kvm-intel" ]; + blacklistedKernelModules = [ "nouveau" ]; }; - boot.kernelParams = ["i915.modeset=1"]; + boot.kernelParams = [ "i915.modeset=1" ]; hardware = { graphics = { diff --git a/dell/xps/13-7390/default.nix b/dell/xps/13-7390/default.nix index 1f1c4561..c5e8a698 100644 --- a/dell/xps/13-7390/default.nix +++ b/dell/xps/13-7390/default.nix @@ -4,7 +4,7 @@ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; boot.kernelParams = [ "mem_sleep_default=deep" ]; diff --git a/dell/xps/13-9300/default.nix b/dell/xps/13-9300/default.nix index 53828cfa..046fde85 100644 --- a/dell/xps/13-9300/default.nix +++ b/dell/xps/13-9300/default.nix @@ -3,7 +3,8 @@ let inherit (lib) mkDefault; -in { +in +{ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index d5fcdc62..0f10b25f 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -1,16 +1,18 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop ../../../common/pc/ssd ]; - # Includes the Wi-Fi and Bluetooth firmware for the QCA6390. hardware.enableRedistributableFirmware = true; # Requires at least 5.12 for working wi-fi and bluetooth. - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") ( + lib.mkDefault pkgs.linuxPackages_latest + ); # Touchpad goes over i2c. # Without this we get errors in dmesg on boot and hangs when shutting down. diff --git a/dell/xps/13-9315/default.nix b/dell/xps/13-9315/default.nix index 03e16533..c2a696b3 100644 --- a/dell/xps/13-9315/default.nix +++ b/dell/xps/13-9315/default.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop @@ -14,7 +15,7 @@ hardware.enableRedistributableFirmware = true; # touchpad uses I²C, so PS/2 is unnecessary - boot.blacklistedKernelModules = ["psmouse"]; + boot.blacklistedKernelModules = [ "psmouse" ]; # enable finger print sensor # configure with `sudo fprintd-enroll ` @@ -27,4 +28,7 @@ # enable cooling management, see NixOS/nixos-hardware#127 services.thermald.enable = lib.mkDefault true; + + # fix laptop's screen flickering, see https://wiki.archlinux.org/title/Intel_graphics#Screen_flickering + boot.kernelParams = [ "i915.enable_psr=0" ]; } diff --git a/dell/xps/13-9333/default.nix b/dell/xps/13-9333/default.nix index a17c094d..c848e808 100644 --- a/dell/xps/13-9333/default.nix +++ b/dell/xps/13-9333/default.nix @@ -7,6 +7,9 @@ # Required to allow the touchpad to work boot.kernelParams = [ "i8042.nopnp=1" ]; - boot.blacklistedKernelModules = [ "i2c_hid" "i2c_hid_acpi" ]; - boot.kernelModules = [ "synaptics_i2c"]; + boot.blacklistedKernelModules = [ + "i2c_hid" + "i2c_hid_acpi" + ]; + boot.kernelModules = [ "synaptics_i2c" ]; } diff --git a/dell/xps/13-9343/default.nix b/dell/xps/13-9343/default.nix index 2904a773..e98bb09b 100644 --- a/dell/xps/13-9343/default.nix +++ b/dell/xps/13-9343/default.nix @@ -1,12 +1,23 @@ -{ lib, ... }: +{ config, lib, ... }: { imports = [ ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; - # This will save you money and possibly your life! - services.thermald.enable = lib.mkDefault true; + services = { + fwupd.enable = lib.mkDefault true; + thermald.enable = lib.mkDefault true; + }; + + boot = { + # needs to be explicitly loaded or else bluetooth/wifi won't work + kernelModules = [ + "kvm-intel" + "wl" + ]; + extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; + }; } diff --git a/dell/xps/13-9350/default.nix b/dell/xps/13-9350/default.nix index 38c27865..2157e642 100644 --- a/dell/xps/13-9350/default.nix +++ b/dell/xps/13-9350/default.nix @@ -2,9 +2,9 @@ { imports = [ - ../../../common/cpu/intel + ../../../common/cpu/intel/lunar-lake ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # The touchpad uses I²C, so PS/2 is unnecessary diff --git a/dell/xps/15-7590/nvidia/default.nix b/dell/xps/15-7590/nvidia/default.nix index 78da989d..dc80a2a3 100644 --- a/dell/xps/15-7590/nvidia/default.nix +++ b/dell/xps/15-7590/nvidia/default.nix @@ -1,4 +1,4 @@ -{lib, ...}: +{ lib, ... }: { imports = [ ../. diff --git a/dell/xps/15-9500/default.nix b/dell/xps/15-9500/default.nix index 7d346a27..b11ecd16 100644 --- a/dell/xps/15-9500/default.nix +++ b/dell/xps/15-9500/default.nix @@ -6,7 +6,7 @@ in imports = [ ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Boot loader @@ -18,7 +18,7 @@ in # Thermald doesn't have a default config for the 9500 yet, the one in this repo # was generated with dptfxtract-static (https://github.com/intel/dptfxtract) services.thermald.configFile = lib.mkDefault thermald-conf; - + # WiFi speed is slow and crashes by default (https://bugzilla.kernel.org/show_bug.cgi?id=213381) # disable_11ax - required until ax driver support is fixed # power_save - works well on this card diff --git a/dell/xps/15-9510/default.nix b/dell/xps/15-9510/default.nix index 066039c6..14779f0f 100644 --- a/dell/xps/15-9510/default.nix +++ b/dell/xps/15-9510/default.nix @@ -1,8 +1,9 @@ -{ lib, ... }: { +{ lib, ... }: +{ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # This will save you money and possibly your life! diff --git a/dell/xps/15-9510/nvidia/default.nix b/dell/xps/15-9510/nvidia/default.nix index 6ca0fd5a..248738a4 100644 --- a/dell/xps/15-9510/nvidia/default.nix +++ b/dell/xps/15-9510/nvidia/default.nix @@ -1,4 +1,5 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ imports = [ ../../../../common/gpu/nvidia/prime.nix ../../../../common/gpu/nvidia/ampere @@ -11,7 +12,10 @@ graphics = { enable = lib.mkDefault true; enable32Bit = lib.mkDefault true; - extraPackages = with pkgs; [ intel-media-driver intel-compute-runtime ]; + extraPackages = with pkgs; [ + intel-media-driver + intel-compute-runtime + ]; }; nvidia = { prime = { diff --git a/dell/xps/15-9520/default.nix b/dell/xps/15-9520/default.nix index 19205454..b30eee31 100644 --- a/dell/xps/15-9520/default.nix +++ b/dell/xps/15-9520/default.nix @@ -4,7 +4,7 @@ ../../../common/cpu/intel ../../../common/gpu/intel/alder-lake ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # This will save you money and possibly your life! diff --git a/dell/xps/15-9530/default.nix b/dell/xps/15-9530/default.nix index 95df2da6..eb7a184b 100644 --- a/dell/xps/15-9530/default.nix +++ b/dell/xps/15-9530/default.nix @@ -3,7 +3,7 @@ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # This will save you money and possibly your life! @@ -14,7 +14,7 @@ # - 00:14.3 Network controller: Intel Corporation Raptor Lake PCH CNVi WiFi (rev 01) # > sudo lspci -vv -s 00:14.3 # 00:14.3 Network controller: Intel Corporation Raptor Lake PCH CNVi WiFi (rev 01) - # Subsystem: Intel Corporation Wi-Fi 6E AX211 160MHz + # Subsystem: Intel Corporation Wi-Fi 6E AX211 160MHz # # WiFi speed is slow and crashes by default (https://bugzilla.kernel.org/show_bug.cgi?id=213381) # disable_11ax - required until ax driver support is fixed diff --git a/dell/xps/15-9530/nvidia/default.nix b/dell/xps/15-9530/nvidia/default.nix index 257462a4..e82bada6 100644 --- a/dell/xps/15-9530/nvidia/default.nix +++ b/dell/xps/15-9530/nvidia/default.nix @@ -3,6 +3,7 @@ imports = [ ../default.nix ../../../../common/gpu/nvidia/prime.nix + ../../../../common/gpu/nvidia/ada-lovelace ]; hardware.nvidia.prime = { diff --git a/dell/xps/15-9560/default.nix b/dell/xps/15-9560/default.nix index bae517d8..a5ffff66 100644 --- a/dell/xps/15-9560/default.nix +++ b/dell/xps/15-9560/default.nix @@ -12,10 +12,10 @@ hardware.nvidia.modesetting.enable = true; hardware.nvidia.prime = { - # integrated + # integrated intelBusId = "PCI:0:2:0"; - # dedicated + # dedicated nvidiaBusId = "PCI:1:0:0"; }; } diff --git a/dell/xps/15-9560/nvidia/default.nix b/dell/xps/15-9560/nvidia/default.nix index 8026a227..46b122b8 100644 --- a/dell/xps/15-9560/nvidia/default.nix +++ b/dell/xps/15-9560/nvidia/default.nix @@ -9,7 +9,6 @@ ../../../../common/gpu/nvidia/pascal ]; - # This runs only nvidia, great for games or heavy use of render applications ##### disable intel, run nvidia only and as default diff --git a/dell/xps/15-9570/nvidia/default.nix b/dell/xps/15-9570/nvidia/default.nix index 7cbb908a..ce1c8e04 100644 --- a/dell/xps/15-9570/nvidia/default.nix +++ b/dell/xps/15-9570/nvidia/default.nix @@ -6,7 +6,6 @@ ../shared.nix ]; - # This runs only nvidia, great for games or heavy use of render applications ##### disable intel, run nvidia only and as default diff --git a/dell/xps/15-9570/shared.nix b/dell/xps/15-9570/shared.nix index 06701e75..dcf9191b 100644 --- a/dell/xps/15-9570/shared.nix +++ b/dell/xps/15-9570/shared.nix @@ -1,7 +1,7 @@ { lib, ... }: { - imports = [ + imports = [ ../../../common/cpu/intel/coffee-lake ../../../common/pc/laptop ]; diff --git a/dell/xps/17-9700/common.nix b/dell/xps/17-9700/common.nix index 04241061..cb130350 100644 --- a/dell/xps/17-9700/common.nix +++ b/dell/xps/17-9700/common.nix @@ -10,17 +10,17 @@ # This will save you money and possibly your life! services.thermald.enable = lib.mkDefault true; - boot.kernelPatches = [{ - name = "enable-soundwire-drivers"; - patch = null; - extraConfig = '' - SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES y - SND_SOC_INTEL_SOUNDWIRE_SOF_MACH m - SND_SOC_RT1308 m - ''; - }]; + boot.kernelPatches = [ + { + name = "enable-soundwire-drivers"; + patch = null; + extraConfig = '' + SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES y + SND_SOC_INTEL_SOUNDWIRE_SOF_MACH m + SND_SOC_RT1308 m + ''; + } + ]; - boot.kernelPackages = - lib.mkIf (lib.versionOlder pkgs.linux.version "5.11") - pkgs.linuxPackages_latest; + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.11") pkgs.linuxPackages_latest; } diff --git a/dell/xps/17-9710/intel/default.nix b/dell/xps/17-9710/intel/default.nix index b07c6095..3224b51a 100644 --- a/dell/xps/17-9710/intel/default.nix +++ b/dell/xps/17-9710/intel/default.nix @@ -1,4 +1,5 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ imports = [ ../../../../common/cpu/intel ../../../../common/pc/laptop @@ -9,5 +10,7 @@ hardware.enableRedistributableFirmware = true; # Requires at least 5.12 for working sound - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") ( + lib.mkDefault pkgs.linuxPackages_latest + ); } diff --git a/dell/xps/sleep-resume/bluetooth/default.nix b/dell/xps/sleep-resume/bluetooth/default.nix index e23e9c66..31731a1c 100644 --- a/dell/xps/sleep-resume/bluetooth/default.nix +++ b/dell/xps/sleep-resume/bluetooth/default.nix @@ -1,4 +1,9 @@ -{config, lib, pkgs, ...}: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkIf mkOption types; @@ -23,7 +28,8 @@ let }; cfg = config.services.sleep-resume.bluetooth; -in { +in +{ options = { services.sleep-resume.bluetooth = { enable = mkOption { diff --git a/dell/xps/sleep-resume/i2c-designware/default.nix b/dell/xps/sleep-resume/i2c-designware/default.nix index 55be5494..418abfb2 100644 --- a/dell/xps/sleep-resume/i2c-designware/default.nix +++ b/dell/xps/sleep-resume/i2c-designware/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkIf mkOption types; @@ -22,7 +27,8 @@ let }; cfg = config.services.sleep-resume.i2c-designware; -in { +in +{ options = { services.sleep-resume.i2c-designware = { enable = mkOption { @@ -37,6 +43,3 @@ in { powerManagement.resumeCommands = "${reloadDesignware}/bin/reload-i2c-designware.sh"; }; } - - - diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..8f2f2e35 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1751290770, + "narHash": "sha256-u4s8yKAqTzPGY3vTcDyAIet11uXaNCM//93/0O0NlbA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0620a50e9a847851bf802c59a4202552ed79b821", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 17a36e63..a0ac1fb8 100644 --- a/flake.nix +++ b/flake.nix @@ -1,358 +1,396 @@ { description = "nixos-hardware"; - outputs = _: { - nixosModules = - let - deprecated = - issue: name: value: - builtins.trace "warning: ${name} flake output is deprecated and will be removed. See https://github.com/NixOS/nixos-hardware/issues/${issue} for more information" value; - import = path: path; # let the module system know what we are exporting - in - { - acer-aspire-4810t = import ./acer/aspire/4810t; - airis-n990 = import ./airis/n990; - apple-imac-14-2 = import ./apple/imac/14-2; - apple-imac-18-2 = import ./apple/imac/18-2; - apple-macbook-air-3 = import ./apple/macbook-air/3; - apple-macbook-air-4 = import ./apple/macbook-air/4; - apple-macbook-air-6 = import ./apple/macbook-air/6; - apple-macbook-air-7 = import ./apple/macbook-air/7; - apple-macbook-pro = import ./apple/macbook-pro; - apple-macbook-pro-8-1 = import ./apple/macbook-pro/8-1; - apple-macbook-pro-10-1 = import ./apple/macbook-pro/10-1; - apple-macbook-pro-11-1 = import ./apple/macbook-pro/11-1; - apple-macbook-pro-11-5 = import ./apple/macbook-pro/11-5; - apple-macbook-pro-12-1 = import ./apple/macbook-pro/12-1; - apple-macbook-pro-14-1 = import ./apple/macbook-pro/14-1; - apple-macmini-4-1 = import ./apple/macmini/4; - apple-t2 = import ./apple/t2; - asus-battery = import ./asus/battery.nix; - asus-ally-rc71l = import ./asus/ally/rc71l; - asus-fx504gd = import ./asus/fx504gd; - asus-fx506hm = import ./asus/fx506hm; - asus-fa506ic = import ./asus/fa506ic; - asus-fa507nv = import ./asus/fa507nv; - asus-fa507rm = import ./asus/fa507rm; - asus-flow-gv302x-amdgpu = import ./asus/flow/gv302x/amdgpu; - asus-flow-gv302x-nvidia = import ./asus/flow/gv302x/nvidia; - asus-pro-ws-x570-ace = import ./asus/pro-ws-x570-ace; - asus-rog-strix-g513im = import ./asus/rog-strix/g513im; - asus-rog-strix-g713ie = import ./asus/rog-strix/g713ie; - asus-rog-strix-g733qs = import ./asus/rog-strix/g733qs; - asus-rog-strix-x570e = import ./asus/rog-strix/x570e; - asus-zenbook-ux371 = import ./asus/zenbook/ux371; - asus-zenbook-ux535 = import ./asus/zenbook/ux535; - asus-zephyrus-ga401 = import ./asus/zephyrus/ga401; - asus-zephyrus-ga402 = import ./asus/zephyrus/ga402; - asus-zephyrus-ga402x = import ./asus/zephyrus/ga402x; - asus-zephyrus-ga402x-amdgpu = import ./asus/zephyrus/ga402x/amdgpu; - asus-zephyrus-ga402x-nvidia = import ./asus/zephyrus/ga402x/nvidia; - asus-zephyrus-ga502 = import ./asus/zephyrus/ga502; - asus-zephyrus-ga503 = import ./asus/zephyrus/ga503; - asus-zephyrus-gu603h = import ./asus/zephyrus/gu603h; - asus-zephyrus-gu605my = import ./asus/zephyrus/gu605my; - beagleboard-pocketbeagle = import ./beagleboard/pocketbeagle; - chuwi-minibook-x = import ./chuwi/minibook-x; - deciso-dec = import ./deciso/dec; - dell-e7240 = import ./dell/e7240; - dell-g3-3779 = import ./dell/g3/3779; - dell-g3-3579 = import ./dell/g3/3579; - dell-inspiron-14-5420 = import ./dell/inspiron/14-5420; - dell-inspiron-5509 = import ./dell/inspiron/5509; - dell-inspiron-5515 = import ./dell/inspiron/5515; - dell-inspiron-7405 = import ./dell/inspiron/7405; - dell-inspiron-7460 = import ./dell/inspiron/7460; - dell-latitude-3340 = import ./dell/latitude/3340; - dell-latitude-3480 = import ./dell/latitude/3480; - dell-latitude-5490 = import ./dell/latitude/5490; - dell-latitude-5520 = import ./dell/latitude/5520; - dell-latitude-7280 = import ./dell/latitude/7280; - dell-latitude-7390 = import ./dell/latitude/7390; - dell-latitude-7420 = import ./dell/latitude/7420; - dell-latitude-7430 = import ./dell/latitude/7430; - dell-latitude-7490 = import ./dell/latitude/7490; - dell-latitude-9430 = import ./dell/latitude/9430; - dell-optiplex-3050 = import ./dell/optiplex/3050; - dell-poweredge-r7515 = import ./dell/poweredge/r7515; - dell-precision-3541 = import ./dell/precision/3541; - dell-precision-5490 = import ./dell/precision/5490; - dell-precision-5530 = import ./dell/precision/5530; - dell-precision-5560 = import ./dell/precision/5560; - dell-precision-7520 = import ./dell/precision/7520; - dell-xps-13-7390 = import ./dell/xps/13-7390; - dell-xps-13-9300 = import ./dell/xps/13-9300; - dell-xps-13-9310 = import ./dell/xps/13-9310; - dell-xps-13-9315 = import ./dell/xps/13-9315; - dell-xps-13-9333 = import ./dell/xps/13-9333; - dell-xps-13-9343 = import ./dell/xps/13-9343; - dell-xps-13-9350 = import ./dell/xps/13-9350; - dell-xps-13-9360 = import ./dell/xps/13-9360; - dell-xps-13-9370 = import ./dell/xps/13-9370; - dell-xps-13-9380 = import ./dell/xps/13-9380; - dell-xps-15-7590 = import ./dell/xps/15-7590; - dell-xps-15-7590-nvidia = import ./dell/xps/15-7590/nvidia; - dell-xps-15-9500 = import ./dell/xps/15-9500; - dell-xps-15-9500-nvidia = import ./dell/xps/15-9500/nvidia; - dell-xps-15-9510 = import ./dell/xps/15-9510; - dell-xps-15-9510-nvidia = import ./dell/xps/15-9510/nvidia; - dell-xps-15-9520 = import ./dell/xps/15-9520; - dell-xps-15-9520-nvidia = import ./dell/xps/15-9520/nvidia; - dell-xps-15-9530 = import ./dell/xps/15-9530; - dell-xps-15-9530-nvidia = import ./dell/xps/15-9530/nvidia; - dell-xps-15-9550 = import ./dell/xps/15-9550; - dell-xps-15-9550-nvidia = import ./dell/xps/15-9550/nvidia; - dell-xps-15-9560 = import ./dell/xps/15-9560; - dell-xps-15-9560-intel = import ./dell/xps/15-9560/intel; - dell-xps-15-9560-nvidia = import ./dell/xps/15-9560/nvidia; - dell-xps-15-9570 = import ./dell/xps/15-9570; - dell-xps-15-9570-intel = import ./dell/xps/15-9570/intel; - dell-xps-15-9570-nvidia = import ./dell/xps/15-9570/nvidia; - dell-xps-17-9700-intel = import ./dell/xps/17-9700/intel; - dell-xps-17-9700-nvidia = import ./dell/xps/17-9700/nvidia; - dell-xps-17-9710-intel = import ./dell/xps/17-9710/intel; - framework = import ./framework; - framework-11th-gen-intel = import ./framework/13-inch/11th-gen-intel; - framework-12th-gen-intel = import ./framework/13-inch/12th-gen-intel; - framework-13th-gen-intel = import ./framework/13-inch/13th-gen-intel; - framework-intel-core-ultra-series1 = import ./framework/13-inch/intel-core-ultra-series1; - framework-13-7040-amd = import ./framework/13-inch/7040-amd; - framework-16-7040-amd = import ./framework/16-inch/7040-amd; - friendlyarm-nanopc-t4 = import ./friendlyarm/nanopc-t4; - friendlyarm-nanopi-r5s = import ./friendlyarm/nanopi-r5s; - focus-m2-gen1 = import ./focus/m2/gen1; - gigabyte-b550 = import ./gigabyte/b550; - google-pixelbook = import ./google/pixelbook; - gpd-micropc = import ./gpd/micropc; - gpd-p2-max = import ./gpd/p2-max; - gpd-pocket-3 = import ./gpd/pocket-3; - gpd-pocket-4 = import ./gpd/pocket-4; - gpd-win-2 = import ./gpd/win-2; - gpd-win-max-2-2023 = import ./gpd/win-max-2/2023; - gpd-win-mini-2024 = import ./gpd/win-mini/2024; - hp-elitebook-2560p = import ./hp/elitebook/2560p; - hp-elitebook-830g6 = import ./hp/elitebook/830/g6; - hp-elitebook-845g7 = import ./hp/elitebook/845/g7; - hp-elitebook-845g8 = import ./hp/elitebook/845/g8; - hp-elitebook-845g9 = import ./hp/elitebook/845/g9; - hp-probook-440G5 = import ./hp/probook/440G5; - hp-laptop-14s-dq2024nf = import ./hp/laptop/14s-dq2024nf; - huawei-machc-wa = import ./huawei/machc-wa; - hp-notebook-14-df0023 = import ./hp/notebook/14-df0023; - intel-nuc-8i7beh = import ./intel/nuc/8i7beh; - lenovo-ideacentre-k330 = import ./lenovo/ideacentre/k330; - lenovo-ideapad-15alc6 = import ./lenovo/ideapad/15alc6; - lenovo-ideapad-15arh05 = import ./lenovo/ideapad/15arh05; - lenovo-ideapad-15ach6 = import ./lenovo/ideapad/15ach6; - lenovo-ideapad-16ach6 = import ./lenovo/ideapad/16ach6; - lenovo-ideapad-16ahp9 = import ./lenovo/ideapad/16ahp9; - lenovo-ideapad-z510 = import ./lenovo/ideapad/z510; - lenovo-ideapad-slim-5 = import ./lenovo/ideapad/slim-5; - lenovo-ideapad-s145-15api = import ./lenovo/ideapad/s145-15api; - lenovo-legion-15ach6 = import ./lenovo/legion/15ach6; - lenovo-legion-15ach6h = import ./lenovo/legion/15ach6h; - lenovo-legion-15arh05h = import ./lenovo/legion/15arh05h; - lenovo-legion-16ach6h = import ./lenovo/legion/16ach6h; - lenovo-legion-16ach6h-hybrid = import ./lenovo/legion/16ach6h/hybrid; - lenovo-legion-16ach6h-nvidia = import ./lenovo/legion/16ach6h/nvidia; - lenovo-legion-16achg6-hybrid = import ./lenovo/legion/16achg6/hybrid; - lenovo-legion-16achg6-nvidia = import ./lenovo/legion/16achg6/nvidia; - lenovo-legion-16aph8 = import ./lenovo/legion/16aph8; - lenovo-legion-16arha7 = import ./lenovo/legion/16arha7; - lenovo-legion-16ithg6 = import ./lenovo/legion/16ithg6; - lenovo-legion-16irx8h = import ./lenovo/legion/16irx8h; - lenovo-legion-16irx9h = import ./lenovo/legion/16irx9h; - lenovo-legion-t526amr5 = import ./lenovo/legion/t526amr5; - lenovo-legion-y530-15ich = import ./lenovo/legion/15ich; - lenovo-thinkpad = import ./lenovo/thinkpad; - lenovo-thinkpad-a475 = import ./lenovo/thinkpad/a475; - lenovo-thinkpad-e14-amd = import ./lenovo/thinkpad/e14/amd; - lenovo-thinkpad-e14-intel = import ./lenovo/thinkpad/e14/intel; - lenovo-thinkpad-e470 = import ./lenovo/thinkpad/e470; - lenovo-thinkpad-e495 = import ./lenovo/thinkpad/e495; - lenovo-thinkpad-l13 = import ./lenovo/thinkpad/l13; - lenovo-thinkpad-l13-yoga = import ./lenovo/thinkpad/l13/yoga; - lenovo-thinkpad-l14-amd = import ./lenovo/thinkpad/l14/amd; - lenovo-thinkpad-l14-intel = import ./lenovo/thinkpad/l14/intel; - lenovo-thinkpad-l480 = import ./lenovo/thinkpad/l480; - lenovo-thinkpad-p1 = import ./lenovo/thinkpad/p1; - lenovo-thinkpad-p1-gen3 = import ./lenovo/thinkpad/p1/3th-gen; - lenovo-thinkpad-p14s-amd-gen1 = import ./lenovo/thinkpad/p14s/amd/gen1; - lenovo-thinkpad-p14s-amd-gen2 = import ./lenovo/thinkpad/p14s/amd/gen2; - lenovo-thinkpad-p14s-amd-gen3 = import ./lenovo/thinkpad/p14s/amd/gen3; - lenovo-thinkpad-p14s-amd-gen4 = import ./lenovo/thinkpad/p14s/amd/gen4; - lenovo-thinkpad-p14s-intel-gen3 = import ./lenovo/thinkpad/p14s/intel/gen3; - lenovo-thinkpad-p16s-amd-gen1 = import ./lenovo/thinkpad/p16s/amd/gen1; - lenovo-thinkpad-p50 = import ./lenovo/thinkpad/p50; - lenovo-thinkpad-p51 = import ./lenovo/thinkpad/p51; - lenovo-thinkpad-p52 = import ./lenovo/thinkpad/p52; - lenovo-thinkpad-p53 = import ./lenovo/thinkpad/p53; - lenovo-thinkpad-t14 = import ./lenovo/thinkpad/t14; - lenovo-thinkpad-t14-amd-gen1 = import ./lenovo/thinkpad/t14/amd/gen1; - lenovo-thinkpad-t14-amd-gen2 = import ./lenovo/thinkpad/t14/amd/gen2; - lenovo-thinkpad-t14-amd-gen3 = import ./lenovo/thinkpad/t14/amd/gen3; - lenovo-thinkpad-t14-amd-gen4 = import ./lenovo/thinkpad/t14/amd/gen4; - lenovo-thinkpad-t14-amd-gen5 = import ./lenovo/thinkpad/t14/amd/gen5; - lenovo-thinkpad-t14s = import ./lenovo/thinkpad/t14s; - lenovo-thinkpad-t14s-amd-gen1 = import ./lenovo/thinkpad/t14s/amd/gen1; - lenovo-thinkpad-t14s-amd-gen4 = import ./lenovo/thinkpad/t14s/amd/gen4; - lenovo-thinkpad-t410 = import ./lenovo/thinkpad/t410; - lenovo-thinkpad-t420 = import ./lenovo/thinkpad/t420; - lenovo-thinkpad-t430 = import ./lenovo/thinkpad/t430; - lenovo-thinkpad-t440p = import ./lenovo/thinkpad/t440p; - lenovo-thinkpad-t440s = import ./lenovo/thinkpad/t440s; - lenovo-thinkpad-t450s = import ./lenovo/thinkpad/t450s; - lenovo-thinkpad-t460 = import ./lenovo/thinkpad/t460; - lenovo-thinkpad-t460p = import ./lenovo/thinkpad/t460p; - lenovo-thinkpad-t460s = import ./lenovo/thinkpad/t460s; - lenovo-thinkpad-t470s = import ./lenovo/thinkpad/t470s; - lenovo-thinkpad-t480 = import ./lenovo/thinkpad/t480; - lenovo-thinkpad-t480s = import ./lenovo/thinkpad/t480s; - lenovo-thinkpad-t490 = import ./lenovo/thinkpad/t490; - lenovo-thinkpad-t490s = import ./lenovo/thinkpad/t490s; - lenovo-thinkpad-t495 = import ./lenovo/thinkpad/t495; - lenovo-thinkpad-t520 = import ./lenovo/thinkpad/t520; - lenovo-thinkpad-w520 = import ./lenovo/thinkpad/w520; - lenovo-thinkpad-t550 = import ./lenovo/thinkpad/t550; - lenovo-thinkpad-t590 = import ./lenovo/thinkpad/t590; - lenovo-thinkpad-x1 = import ./lenovo/thinkpad/x1; - lenovo-thinkpad-x1-yoga = import ./lenovo/thinkpad/x1/yoga; - lenovo-thinkpad-x1-yoga-7th-gen = import ./lenovo/thinkpad/x1/yoga/7th-gen; - lenovo-thinkpad-x1-6th-gen = import ./lenovo/thinkpad/x1/6th-gen; - lenovo-thinkpad-x1-7th-gen = import ./lenovo/thinkpad/x1/7th-gen; - lenovo-thinkpad-x1-9th-gen = import ./lenovo/thinkpad/x1/9th-gen; - lenovo-thinkpad-x1-10th-gen = import ./lenovo/thinkpad/x1/10th-gen; - lenovo-thinkpad-x1-11th-gen = import ./lenovo/thinkpad/x1/11th-gen; - lenovo-thinkpad-x1-12th-gen = import ./lenovo/thinkpad/x1/12th-gen; - lenovo-thinkpad-x1-extreme = import ./lenovo/thinkpad/x1-extreme; - lenovo-thinkpad-x1-extreme-gen2 = import ./lenovo/thinkpad/x1-extreme/gen2; - lenovo-thinkpad-x1-extreme-gen3 = import ./lenovo/thinkpad/x1-extreme/gen3; - lenovo-thinkpad-x1-extreme-gen4 = import ./lenovo/thinkpad/x1-extreme/gen4; - lenovo-thinkpad-x1-nano = import ./lenovo/thinkpad/x1-nano; - lenovo-thinkpad-x1-nano-gen1 = import ./lenovo/thinkpad/x1-nano/gen1; - lenovo-thinkpad-x13 = import ./lenovo/thinkpad/x13/intel; - lenovo-thinkpad-x13-amd = import ./lenovo/thinkpad/x13/amd; - lenovo-thinkpad-x13-yoga = import ./lenovo/thinkpad/x13/yoga; - lenovo-thinkpad-x13-yoga-3th-gen = import ./lenovo/thinkpad/x13/yoga/3th-gen; - lenovo-thinkpad-x140e = import ./lenovo/thinkpad/x140e; - lenovo-thinkpad-x200s = import ./lenovo/thinkpad/x200s; - lenovo-thinkpad-x220 = import ./lenovo/thinkpad/x220; - lenovo-thinkpad-x230 = import ./lenovo/thinkpad/x230; - lenovo-thinkpad-x250 = import ./lenovo/thinkpad/x250; - lenovo-thinkpad-x260 = import ./lenovo/thinkpad/x260; - lenovo-thinkpad-x270 = import ./lenovo/thinkpad/x270; - lenovo-thinkpad-x280 = import ./lenovo/thinkpad/x280; - lenovo-thinkpad-x390 = import ./lenovo/thinkpad/x390; - lenovo-thinkpad-z = import ./lenovo/thinkpad/z; - lenovo-thinkpad-z13-gen1 = import ./lenovo/thinkpad/z/gen1/z13; - lenovo-thinkpad-z13-gen2 = import ./lenovo/thinkpad/z/gen2/z13; - lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; - lenovo-yoga-7-14ARH7 = import ./lenovo/yoga/7/14ARH7; - lenovo-yoga-7-14ARH7-amdgpu = import ./lenovo/yoga/7/14ARH7/amdgpu; - lenovo-yoga-7-14ARH7-nvidia = import ./lenovo/yoga/7/14ARH7/nvidia; - lenovo-yoga-7-14IAH7-integrated = import ./lenovo/yoga/7/14IAH7/integrated; - lenovo-yoga-7-14IAH7-hybrid = import ./lenovo/yoga/7/14IAH7/hybrid; - lenovo-yoga-7-slim-gen8 = import ./lenovo/yoga/7/slim/gen8; - letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; - malibal-aon-s1-intel = import ./malibal/aon/s1; - microchip-icicle-kit = import ./microchip/icicle-kit; - microsoft-surface-go = import ./microsoft/surface/surface-go; - microsoft-surface-pro-intel = import ./microsoft/surface/surface-pro-intel; - microsoft-surface-laptop-amd = import ./microsoft/surface/surface-laptop-amd; - microsoft-surface-common = import ./microsoft/surface/common; - microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; - microsoft-surface-pro-9 = import ./microsoft/surface-pro/9; - milkv-pioneer = import ./milkv/pioneer; - minisforum-v3 = import ./minisforum/v3; - morefine-m600 = import ./morefine/m600; - msi-b350-tomahawk = import ./msi/b350-tomahawk; - msi-b550-a-pro = import ./msi/b550-a-pro; - msi-gs60 = import ./msi/gs60; - msi-gl62 = import ./msi/gl62; - msi-gl65-10SDR-492 = import ./msi/gl65/10SDR-492; - nxp-imx8mp-evk = import ./nxp/imx8mp-evk; - nxp-imx8mq-evk = import ./nxp/imx8mq-evk; - nxp-imx8qm-mek = import ./nxp/imx8qm-mek; - hardkernel-odroid-hc4 = import ./hardkernel/odroid-hc4; - hardkernel-odroid-h3 = import ./hardkernel/odroid-h3; - hardkernel-odroid-h4 = import ./hardkernel/odroid-h4; - omen-14-fb0798ng = import ./omen/14-fb0798ng; - omen-15-ce002ns = import ./omen/15-ce002ns; - omen-15-en0010ca = import ./omen/15-en0010ca; - omen-16-n0005ne = import ./omen/16-n0005ne; - omen-16-n0280nd = import ./omen/16-n0280nd; - omen-15-en1007sa = import ./omen/15-en1007sa; - omen-15-en0002np = import ./omen/15-en0002np; - onenetbook-4 = import ./onenetbook/4; - olimex-teres_i = import ./olimex/teres_i; - pcengines-apu = import ./pcengines/apu; - pine64-pinebook-pro = import ./pine64/pinebook-pro; - pine64-rockpro64 = import ./pine64/rockpro64; - pine64-star64 = import ./pine64/star64; - protectli-vp4670 = import ./protectli/vp4670; - purism-librem-13v3 = import ./purism/librem/13v3; - purism-librem-15v3 = import ./purism/librem/15v3; - purism-librem-5r4 = import ./purism/librem/5r4; - raspberry-pi-2 = import ./raspberry-pi/2; - raspberry-pi-3 = import ./raspberry-pi/3; - raspberry-pi-4 = import ./raspberry-pi/4; - raspberry-pi-5 = import ./raspberry-pi/5; - rock-4c-plus = import ./radxa/rock-4c-plus; - kobol-helios4 = import ./kobol/helios4; - samsung-np900x3c = import ./samsung/np900x3c; - slimbook-hero-rpl-rtx = import ./slimbook/hero/rpl-rtx; - starfive-visionfive-v1 = import ./starfive/visionfive/v1; - starfive-visionfive-2 = import ./starfive/visionfive/v2; - starlabs-starlite-i5 = import ./starlabs/starlite/i5; - supermicro = import ./supermicro; - supermicro-a1sri-2758f = import ./supermicro/a1sri-2758f; - supermicro-m11sdv-8c-ln4f = import ./supermicro/m11sdv-8c-ln4f; - supermicro-x10sll-f = import ./supermicro/x10sll-f; - supermicro-x12scz-tln4f = import ./supermicro/x12scz-tln4f; - system76 = import ./system76; - system76-gaze18 = import ./system76/gaze18; - system76-galp5-1650 = import ./system76/galp5-1650; - system76-darp6 = import ./system76/darp6; - toshiba-swanky = import ./toshiba/swanky; - tuxedo-aura-15-gen1 = import ./tuxedo/aura/15/gen1; - tuxedo-infinitybook-v4 = import ./tuxedo/infinitybook/v4; - tuxedo-infinitybook-pro14-gen7 = import ./tuxedo/infinitybook/pro14/gen7; - tuxedo-pulse-14-gen3 = import ./tuxedo/pulse/14/gen3; - tuxedo-pulse-15-gen2 = import ./tuxedo/pulse/15/gen2; - xiaomi-redmibook-16-pro-2024 = import ./xiaomi/redmibook/16-pro-2024; + outputs = + { ... }: + { - common-cpu-amd = import ./common/cpu/amd; - common-cpu-amd-pstate = import ./common/cpu/amd/pstate.nix; - common-cpu-amd-zenpower = import ./common/cpu/amd/zenpower.nix; - common-cpu-amd-raphael-igpu = import ./common/cpu/amd/raphael/igpu.nix; - common-cpu-intel = import ./common/cpu/intel; - common-gpu-intel-comet-lake = - deprecated "992" "common-gpu-intel-comet-lake" - (import ./common/gpu/intel/comet-lake); - common-cpu-intel-cpu-only = import ./common/cpu/intel/cpu-only.nix; - common-gpu-intel-kaby-lake = - deprecated "992" "common-gpu-intel-kaby-lake" - (import ./common/gpu/intel/kaby-lake); - common-gpu-intel-sandy-bridge = - deprecated "992" "common-gpu-intel-sandy-bridge" - (import ./common/gpu/intel/sandy-bridge); - common-gpu-amd = import ./common/gpu/amd; - common-gpu-amd-sea-islands = import ./common/gpu/amd/sea-islands; - common-gpu-amd-southern-islands = import ./common/gpu/amd/southern-islands; - common-gpu-intel = import ./common/gpu/intel; - common-gpu-intel-disable = import ./common/gpu/intel/disable.nix; - common-gpu-nvidia = import ./common/gpu/nvidia/prime.nix; - common-gpu-nvidia-sync = import ./common/gpu/nvidia/prime-sync.nix; - common-gpu-nvidia-nonprime = import ./common/gpu/nvidia; - common-gpu-nvidia-disable = import ./common/gpu/nvidia/disable.nix; - common-hidpi = import ./common/hidpi.nix; - common-pc = import ./common/pc; - common-pc-hdd = import ./common/pc/hdd; - common-pc-laptop = import ./common/pc/laptop; - common-pc-laptop-acpi_call = throw "common-pc-laptop-acpi_call has been removed because it is obsolete: https://github.com/NixOS/nixos-hardware/issues/1114"; - common-pc-laptop-hdd = import ./common/pc/laptop/hdd; - common-pc-laptop-ssd = import ./common/pc/ssd; - common-pc-ssd = import ./common/pc/ssd; - }; - }; + nixosModules = + let + deprecated = + issue: name: value: + builtins.trace "warning: ${name} flake output is deprecated and will be removed. See https://github.com/NixOS/nixos-hardware/issues/${issue} for more information" value; + import = path: path; # let the module system know what we are exporting + in + { + acer-aspire-4810t = import ./acer/aspire/4810t; + airis-n990 = import ./airis/n990; + aoostar-r1-n100 = import ./aoostar/r1/n100; + apple-imac-14-2 = import ./apple/imac/14-2; + apple-imac-18-2 = import ./apple/imac/18-2; + apple-macbook-air-3 = import ./apple/macbook-air/3; + apple-macbook-air-4 = import ./apple/macbook-air/4; + apple-macbook-air-6 = import ./apple/macbook-air/6; + apple-macbook-air-7 = import ./apple/macbook-air/7; + apple-macbook-pro = import ./apple/macbook-pro; + apple-macbook-pro-8-1 = import ./apple/macbook-pro/8-1; + apple-macbook-pro-10-1 = import ./apple/macbook-pro/10-1; + apple-macbook-pro-11-1 = import ./apple/macbook-pro/11-1; + apple-macbook-pro-11-5 = import ./apple/macbook-pro/11-5; + apple-macbook-pro-12-1 = import ./apple/macbook-pro/12-1; + apple-macbook-pro-14-1 = import ./apple/macbook-pro/14-1; + apple-macmini-4-1 = import ./apple/macmini/4; + apple-t2 = import ./apple/t2; + asus-battery = import ./asus/battery.nix; + asus-ally-rc71l = import ./asus/ally/rc71l; + asus-fx504gd = import ./asus/fx504gd; + asus-fx506hm = import ./asus/fx506hm; + asus-fa506ic = import ./asus/fa506ic; + asus-fa507nv = import ./asus/fa507nv; + asus-fa507rm = import ./asus/fa507rm; + asus-flow-gv302x-amdgpu = import ./asus/flow/gv302x/amdgpu; + asus-flow-gv302x-nvidia = import ./asus/flow/gv302x/nvidia; + asus-pro-ws-x570-ace = import ./asus/pro-ws-x570-ace; + asus-rog-strix-g513im = import ./asus/rog-strix/g513im; + asus-rog-strix-g533zw = import ./asus/rog-strix/g533zw; + asus-rog-strix-g713ie = import ./asus/rog-strix/g713ie; + asus-rog-strix-g733qs = import ./asus/rog-strix/g733qs; + asus-rog-strix-x570e = import ./asus/rog-strix/x570e; + asus-zenbook-ux371 = import ./asus/zenbook/ux371; + asus-zenbook-ux535 = import ./asus/zenbook/ux535; + asus-zenbook-ux481-intelgpu = import ./asus/zenbook/ux481/intelgpu; + asus-zenbook-ux481-nvidia = import ./asus/zenbook/ux481/nvidia; + asus-zephyrus-ga401 = import ./asus/zephyrus/ga401; + asus-zephyrus-ga402 = import ./asus/zephyrus/ga402; + asus-zephyrus-ga402x = import ./asus/zephyrus/ga402x; + asus-zephyrus-ga402x-amdgpu = import ./asus/zephyrus/ga402x/amdgpu; + asus-zephyrus-ga402x-nvidia = import ./asus/zephyrus/ga402x/nvidia; + asus-zephyrus-ga502 = import ./asus/zephyrus/ga502; + asus-zephyrus-ga503 = import ./asus/zephyrus/ga503; + asus-zephyrus-gu603h = import ./asus/zephyrus/gu603h; + asus-zephyrus-gu605my = import ./asus/zephyrus/gu605my; + beagleboard-pocketbeagle = import ./beagleboard/pocketbeagle; + chuwi-minibook-x = import ./chuwi/minibook-x; + deciso-dec = import ./deciso/dec; + dell-e7240 = deprecated "1326" "dell-e7240" (import ./dell/e7240); + dell-g3-3779 = import ./dell/g3/3779; + dell-g3-3579 = import ./dell/g3/3579; + dell-inspiron-14-5420 = import ./dell/inspiron/14-5420; + dell-inspiron-5509 = import ./dell/inspiron/5509; + dell-inspiron-5515 = import ./dell/inspiron/5515; + dell-inspiron-7405 = import ./dell/inspiron/7405; + dell-inspiron-7460 = import ./dell/inspiron/7460; + dell-inspiron-7559 = import ./dell/inspiron/7559; + dell-latitude-3340 = import ./dell/latitude/3340; + dell-latitude-3480 = import ./dell/latitude/3480; + dell-latitude-5490 = import ./dell/latitude/5490; + dell-latitude-5520 = import ./dell/latitude/5520; + dell-latitude-7280 = import ./dell/latitude/7280; + dell-latitude-7390 = import ./dell/latitude/7390; + dell-latitude-7420 = import ./dell/latitude/7420; + dell-latitude-7430 = import ./dell/latitude/7430; + dell-latitude-7490 = import ./dell/latitude/7490; + dell-latitude-9430 = import ./dell/latitude/9430; + dell-latitude-e7240 = import ./dell/latitude/e7240; + dell-optiplex-3050 = import ./dell/optiplex/3050; + dell-poweredge-r7515 = import ./dell/poweredge/r7515; + dell-precision-3490 = deprecated "1491" "dell-precision-3490" (import ./dell/precision/3490); + dell-precision-3490-nvidia = import ./dell/precision/3490/nvidia; + dell-precision-3490-intel = import ./dell/precision/3490/intel; + dell-precision-3541 = import ./dell/precision/3541; + dell-precision-5490 = import ./dell/precision/5490; + dell-precision-5530 = import ./dell/precision/5530; + dell-precision-5560 = import ./dell/precision/5560; + dell-precision-7520 = import ./dell/precision/7520; + dell-xps-13-7390 = import ./dell/xps/13-7390; + dell-xps-13-9300 = import ./dell/xps/13-9300; + dell-xps-13-9310 = import ./dell/xps/13-9310; + dell-xps-13-9315 = import ./dell/xps/13-9315; + dell-xps-13-9333 = import ./dell/xps/13-9333; + dell-xps-13-9343 = import ./dell/xps/13-9343; + dell-xps-13-9350 = import ./dell/xps/13-9350; + dell-xps-13-9360 = import ./dell/xps/13-9360; + dell-xps-13-9370 = import ./dell/xps/13-9370; + dell-xps-13-9380 = import ./dell/xps/13-9380; + dell-xps-15-7590 = import ./dell/xps/15-7590; + dell-xps-15-7590-nvidia = import ./dell/xps/15-7590/nvidia; + dell-xps-15-9500 = import ./dell/xps/15-9500; + dell-xps-15-9500-nvidia = import ./dell/xps/15-9500/nvidia; + dell-xps-15-9510 = import ./dell/xps/15-9510; + dell-xps-15-9510-nvidia = import ./dell/xps/15-9510/nvidia; + dell-xps-15-9520 = import ./dell/xps/15-9520; + dell-xps-15-9520-nvidia = import ./dell/xps/15-9520/nvidia; + dell-xps-15-9530 = import ./dell/xps/15-9530; + dell-xps-15-9530-nvidia = import ./dell/xps/15-9530/nvidia; + dell-xps-15-9550 = import ./dell/xps/15-9550; + dell-xps-15-9550-nvidia = import ./dell/xps/15-9550/nvidia; + dell-xps-15-9560 = import ./dell/xps/15-9560; + dell-xps-15-9560-intel = import ./dell/xps/15-9560/intel; + dell-xps-15-9560-nvidia = import ./dell/xps/15-9560/nvidia; + dell-xps-15-9570 = import ./dell/xps/15-9570; + dell-xps-15-9570-intel = import ./dell/xps/15-9570/intel; + dell-xps-15-9570-nvidia = import ./dell/xps/15-9570/nvidia; + dell-xps-17-9700-intel = import ./dell/xps/17-9700/intel; + dell-xps-17-9700-nvidia = import ./dell/xps/17-9700/nvidia; + dell-xps-17-9710-intel = import ./dell/xps/17-9710/intel; + framework = import ./framework; + framework-11th-gen-intel = import ./framework/13-inch/11th-gen-intel; + framework-12th-gen-intel = import ./framework/13-inch/12th-gen-intel; + framework-13th-gen-intel = import ./framework/13-inch/13th-gen-intel; + framework-12-13th-gen-intel = import ./framework/12-inch/13th-gen-intel; + framework-intel-core-ultra-series1 = import ./framework/13-inch/intel-core-ultra-series1; + framework-13-7040-amd = import ./framework/13-inch/7040-amd; + framework-amd-ai-300-series = import ./framework/13-inch/amd-ai-300-series; + framework-16-7040-amd = import ./framework/16-inch/7040-amd; + friendlyarm-nanopc-t4 = import ./friendlyarm/nanopc-t4; + friendlyarm-nanopi-r5s = import ./friendlyarm/nanopi-r5s; + focus-m2-gen1 = import ./focus/m2/gen1; + gigabyte-b550 = import ./gigabyte/b550; + gigabyte-b650 = import ./gigabyte/b650; + gmktec-nucbox-g3-plus = import ./gmktec/nucbox/g3-plus; + google-pixelbook = import ./google/pixelbook; + gpd-micropc = import ./gpd/micropc; + gpd-p2-max = import ./gpd/p2-max; + gpd-pocket-3 = import ./gpd/pocket-3; + gpd-pocket-4 = import ./gpd/pocket-4; + gpd-win-2 = import ./gpd/win-2; + gpd-win-max-2-2023 = import ./gpd/win-max-2/2023; + gpd-win-mini-2024 = import ./gpd/win-mini/2024; + hp-elitebook-2560p = import ./hp/elitebook/2560p; + hp-elitebook-830g6 = import ./hp/elitebook/830/g6; + hp-elitebook-845g7 = import ./hp/elitebook/845/g7; + hp-elitebook-845g8 = import ./hp/elitebook/845/g8; + hp-elitebook-845g9 = import ./hp/elitebook/845/g9; + hp-probook-440G5 = import ./hp/probook/440G5; + hp-laptop-14s-dq2024nf = import ./hp/laptop/14s-dq2024nf; + huawei-machc-wa = import ./huawei/machc-wa; + hp-notebook-14-df0023 = import ./hp/notebook/14-df0023; + intel-nuc-8i7beh = import ./intel/nuc/8i7beh; + lenovo-ideacentre-k330 = import ./lenovo/ideacentre/k330; + lenovo-ideapad-14imh9 = import ./lenovo/ideapad/14imh9; + lenovo-ideapad-15alc6 = import ./lenovo/ideapad/15alc6; + lenovo-ideapad-15arh05 = import ./lenovo/ideapad/15arh05; + lenovo-ideapad-15ach6 = import ./lenovo/ideapad/15ach6; + lenovo-ideapad-16ach6 = import ./lenovo/ideapad/16ach6; + lenovo-ideapad-16ahp9 = import ./lenovo/ideapad/16ahp9; + lenovo-ideapad-z510 = import ./lenovo/ideapad/z510; + lenovo-ideapad-slim-5 = import ./lenovo/ideapad/slim-5; + lenovo-ideapad-s145-15api = import ./lenovo/ideapad/s145-15api; + lenovo-legion-15ach6 = import ./lenovo/legion/15ach6; + lenovo-legion-15ach6h = import ./lenovo/legion/15ach6h; + lenovo-legion-15arh05h = import ./lenovo/legion/15arh05h; + lenovo-legion-16ach6h = import ./lenovo/legion/16ach6h; + lenovo-legion-16ach6h-hybrid = import ./lenovo/legion/16ach6h/hybrid; + lenovo-legion-16ach6h-nvidia = import ./lenovo/legion/16ach6h/nvidia; + lenovo-legion-16arh7h-igpu-only = import ./lenovo/legion/16arh7h/igpu-only; + lenovo-legion-16arh7h-hybrid = import ./lenovo/legion/16arh7h/hybrid; + lenovo-legion-16achg6-hybrid = import ./lenovo/legion/16achg6/hybrid; + lenovo-legion-16achg6-nvidia = import ./lenovo/legion/16achg6/nvidia; + lenovo-legion-16aph8 = import ./lenovo/legion/16aph8; + lenovo-legion-16arha7 = import ./lenovo/legion/16arha7; + lenovo-legion-16ithg6 = import ./lenovo/legion/16ithg6; + lenovo-legion-16irx8h = import ./lenovo/legion/16irx8h; + lenovo-legion-16irx9h = import ./lenovo/legion/16irx9h; + lenovo-legion-t526amr5 = import ./lenovo/legion/t526amr5; + lenovo-legion-y530-15ich = import ./lenovo/legion/15ich; + lenovo-thinkpad = import ./lenovo/thinkpad; + lenovo-thinkpad-a475 = import ./lenovo/thinkpad/a475; + lenovo-thinkpad-e14-amd = import ./lenovo/thinkpad/e14/amd; + lenovo-thinkpad-e14-intel = import ./lenovo/thinkpad/e14/intel; + lenovo-thinkpad-e14-intel-gen4 = import ./lenovo/thinkpad/e14/intel/gen4; + lenovo-thinkpad-e14-intel-gen6 = import ./lenovo/thinkpad/e14/intel/gen6; + lenovo-thinkpad-e15-intel = import ./lenovo/thinkpad/e15/intel; + lenovo-thinkpad-e470 = import ./lenovo/thinkpad/e470; + lenovo-thinkpad-e495 = import ./lenovo/thinkpad/e495; + lenovo-thinkpad-l13 = import ./lenovo/thinkpad/l13; + lenovo-thinkpad-l13-yoga = import ./lenovo/thinkpad/l13/yoga; + lenovo-thinkpad-l14-amd = import ./lenovo/thinkpad/l14/amd; + lenovo-thinkpad-l14-intel = import ./lenovo/thinkpad/l14/intel; + lenovo-thinkpad-l480 = import ./lenovo/thinkpad/l480; + lenovo-thinkpad-p1 = import ./lenovo/thinkpad/p1; + lenovo-thinkpad-p1-gen3 = import ./lenovo/thinkpad/p1/3th-gen; + lenovo-thinkpad-p14s-amd-gen1 = import ./lenovo/thinkpad/p14s/amd/gen1; + lenovo-thinkpad-p14s-amd-gen2 = import ./lenovo/thinkpad/p14s/amd/gen2; + lenovo-thinkpad-p14s-amd-gen3 = import ./lenovo/thinkpad/p14s/amd/gen3; + lenovo-thinkpad-p14s-amd-gen4 = import ./lenovo/thinkpad/p14s/amd/gen4; + lenovo-thinkpad-p14s-amd-gen5 = import ./lenovo/thinkpad/p14s/amd/gen5; + lenovo-thinkpad-p14s-intel-gen3 = import ./lenovo/thinkpad/p14s/intel/gen3; + lenovo-thinkpad-p14s-intel-gen5 = import ./lenovo/thinkpad/p14s/intel/gen5; + lenovo-thinkpad-p16s-amd-gen1 = import ./lenovo/thinkpad/p16s/amd/gen1; + lenovo-thinkpad-p16s-amd-gen2 = import ./lenovo/thinkpad/p16s/amd/gen2; + lenovo-thinkpad-p16s-intel-gen2 = import ./lenovo/thinkpad/p16s/intel/gen2; + lenovo-thinkpad-p43s = import ./lenovo/thinkpad/p43s; + lenovo-thinkpad-p50 = import ./lenovo/thinkpad/p50; + lenovo-thinkpad-p51 = import ./lenovo/thinkpad/p51; + lenovo-thinkpad-p52 = import ./lenovo/thinkpad/p52; + lenovo-thinkpad-p53 = import ./lenovo/thinkpad/p53; + lenovo-thinkpad-t14 = import ./lenovo/thinkpad/t14; + lenovo-thinkpad-t14-amd-gen1 = import ./lenovo/thinkpad/t14/amd/gen1; + lenovo-thinkpad-t14-amd-gen2 = import ./lenovo/thinkpad/t14/amd/gen2; + lenovo-thinkpad-t14-amd-gen3 = import ./lenovo/thinkpad/t14/amd/gen3; + lenovo-thinkpad-t14-amd-gen4 = import ./lenovo/thinkpad/t14/amd/gen4; + lenovo-thinkpad-t14-amd-gen5 = import ./lenovo/thinkpad/t14/amd/gen5; + lenovo-thinkpad-t14s = import ./lenovo/thinkpad/t14s; + lenovo-thinkpad-t14s-amd-gen1 = import ./lenovo/thinkpad/t14s/amd/gen1; + lenovo-thinkpad-t14s-amd-gen4 = import ./lenovo/thinkpad/t14s/amd/gen4; + lenovo-thinkpad-t410 = import ./lenovo/thinkpad/t410; + lenovo-thinkpad-t420 = import ./lenovo/thinkpad/t420; + lenovo-thinkpad-t430 = import ./lenovo/thinkpad/t430; + lenovo-thinkpad-t440p = import ./lenovo/thinkpad/t440p; + lenovo-thinkpad-t440s = import ./lenovo/thinkpad/t440s; + lenovo-thinkpad-t450s = import ./lenovo/thinkpad/t450s; + lenovo-thinkpad-t460 = import ./lenovo/thinkpad/t460; + lenovo-thinkpad-t460p = import ./lenovo/thinkpad/t460p; + lenovo-thinkpad-t460s = import ./lenovo/thinkpad/t460s; + lenovo-thinkpad-t470s = import ./lenovo/thinkpad/t470s; + lenovo-thinkpad-t480 = import ./lenovo/thinkpad/t480; + lenovo-thinkpad-t480s = import ./lenovo/thinkpad/t480s; + lenovo-thinkpad-t490 = import ./lenovo/thinkpad/t490; + lenovo-thinkpad-t490s = import ./lenovo/thinkpad/t490s; + lenovo-thinkpad-t495 = import ./lenovo/thinkpad/t495; + lenovo-thinkpad-t520 = import ./lenovo/thinkpad/t520; + lenovo-thinkpad-w520 = import ./lenovo/thinkpad/w520; + lenovo-thinkpad-t550 = import ./lenovo/thinkpad/t550; + lenovo-thinkpad-t590 = import ./lenovo/thinkpad/t590; + lenovo-thinkpad-x1 = import ./lenovo/thinkpad/x1; + lenovo-thinkpad-x1-yoga = import ./lenovo/thinkpad/x1/yoga; + lenovo-thinkpad-x1-yoga-7th-gen = import ./lenovo/thinkpad/x1/yoga/7th-gen; + lenovo-thinkpad-x1-yoga-8th-gen = import ./lenovo/thinkpad/x1/yoga/8th-gen; + lenovo-thinkpad-x1-2nd-gen = import ./lenovo/thinkpad/x1/2nd-gen; + lenovo-thinkpad-x1-6th-gen = import ./lenovo/thinkpad/x1/6th-gen; + lenovo-thinkpad-x1-7th-gen = import ./lenovo/thinkpad/x1/7th-gen; + lenovo-thinkpad-x1-9th-gen = import ./lenovo/thinkpad/x1/9th-gen; + lenovo-thinkpad-x1-10th-gen = import ./lenovo/thinkpad/x1/10th-gen; + lenovo-thinkpad-x1-11th-gen = import ./lenovo/thinkpad/x1/11th-gen; + lenovo-thinkpad-x1-12th-gen = import ./lenovo/thinkpad/x1/12th-gen; + lenovo-thinkpad-x1-13th-gen = import ./lenovo/thinkpad/x1/13th-gen; + lenovo-thinkpad-x1-extreme = import ./lenovo/thinkpad/x1-extreme; + lenovo-thinkpad-x1-extreme-gen2 = import ./lenovo/thinkpad/x1-extreme/gen2; + lenovo-thinkpad-x1-extreme-gen3 = import ./lenovo/thinkpad/x1-extreme/gen3; + lenovo-thinkpad-x1-extreme-gen4 = import ./lenovo/thinkpad/x1-extreme/gen4; + lenovo-thinkpad-x1-nano = import ./lenovo/thinkpad/x1-nano; + lenovo-thinkpad-x1-nano-gen1 = import ./lenovo/thinkpad/x1-nano/gen1; + lenovo-thinkpad-x13 = import ./lenovo/thinkpad/x13/intel; + lenovo-thinkpad-x13-amd = import ./lenovo/thinkpad/x13/amd; + lenovo-thinkpad-x13-yoga = import ./lenovo/thinkpad/x13/yoga; + lenovo-thinkpad-x13-yoga-3th-gen = import ./lenovo/thinkpad/x13/yoga/3th-gen; + lenovo-thinkpad-x13s = import ./lenovo/thinkpad/x13s; + lenovo-thinkpad-x140e = import ./lenovo/thinkpad/x140e; + lenovo-thinkpad-x200s = import ./lenovo/thinkpad/x200s; + lenovo-thinkpad-x220 = import ./lenovo/thinkpad/x220; + lenovo-thinkpad-x230 = import ./lenovo/thinkpad/x230; + lenovo-thinkpad-x250 = import ./lenovo/thinkpad/x250; + lenovo-thinkpad-x260 = import ./lenovo/thinkpad/x260; + lenovo-thinkpad-x270 = import ./lenovo/thinkpad/x270; + lenovo-thinkpad-x280 = import ./lenovo/thinkpad/x280; + lenovo-thinkpad-x390 = import ./lenovo/thinkpad/x390; + lenovo-thinkpad-z = import ./lenovo/thinkpad/z; + lenovo-thinkpad-z13-gen1 = import ./lenovo/thinkpad/z/gen1/z13; + lenovo-thinkpad-z13-gen2 = import ./lenovo/thinkpad/z/gen2/z13; + lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; + lenovo-yoga-7-14ARH7 = import ./lenovo/yoga/7/14ARH7; + lenovo-yoga-7-14ARH7-amdgpu = import ./lenovo/yoga/7/14ARH7/amdgpu; + lenovo-yoga-7-14ARH7-nvidia = import ./lenovo/yoga/7/14ARH7/nvidia; + lenovo-yoga-7-14IAH7-integrated = import ./lenovo/yoga/7/14IAH7/integrated; + lenovo-yoga-7-14IAH7-hybrid = import ./lenovo/yoga/7/14IAH7/hybrid; + lenovo-yoga-7-14ILL10 = import ./lenovo/yoga/7/14ILL10; + lenovo-yoga-7-slim-gen8 = import ./lenovo/yoga/7/slim/gen8; + letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; + malibal-aon-s1-intel = import ./malibal/aon/s1; + microchip-icicle-kit = import ./microchip/icicle-kit; + microsoft-surface-go = import ./microsoft/surface/surface-go; + microsoft-surface-pro-intel = import ./microsoft/surface/surface-pro-intel; + microsoft-surface-laptop-amd = import ./microsoft/surface/surface-laptop-amd; + microsoft-surface-common = import ./microsoft/surface/common; + microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; + microsoft-surface-pro-9 = import ./microsoft/surface-pro/9; + milkv-pioneer = import ./milkv/pioneer; + minisforum-v3 = import ./minisforum/v3; + morefine-m600 = import ./morefine/m600; + msi-b350-tomahawk = import ./msi/b350-tomahawk; + msi-b550-a-pro = import ./msi/b550-a-pro; + msi-gs60 = import ./msi/gs60; + msi-gl62 = import ./msi/gl62; + msi-gl65-10SDR-492 = import ./msi/gl65/10SDR-492; + nxp-imx8mp-evk = import ./nxp/imx8mp-evk; + nxp-imx8mq-evk = import ./nxp/imx8mq-evk; + nxp-imx8qm-mek = import ./nxp/imx8qm-mek; + hardkernel-odroid-hc4 = import ./hardkernel/odroid-hc4; + hardkernel-odroid-h3 = import ./hardkernel/odroid-h3; + hardkernel-odroid-h4 = import ./hardkernel/odroid-h4; + omen-14-fb0798ng = import ./omen/14-fb0798ng; + omen-15-ce002ns = import ./omen/15-ce002ns; + omen-15-en0010ca = import ./omen/15-en0010ca; + omen-16-n0005ne = import ./omen/16-n0005ne; + omen-16-n0280nd = import ./omen/16-n0280nd; + omen-15-en1007sa = import ./omen/15-en1007sa; + omen-15-en0002np = import ./omen/15-en0002np; + onenetbook-4 = import ./onenetbook/4; + olimex-teres_i = import ./olimex/teres_i; + pcengines-apu = import ./pcengines/apu; + pine64-pinebook-pro = import ./pine64/pinebook-pro; + pine64-rockpro64 = import ./pine64/rockpro64; + pine64-star64 = import ./pine64/star64; + protectli-vp4670 = import ./protectli/vp4670; + purism-librem-13v3 = import ./purism/librem/13v3; + purism-librem-15v3 = import ./purism/librem/15v3; + purism-librem-5r4 = import ./purism/librem/5r4; + raspberry-pi-2 = import ./raspberry-pi/2; + raspberry-pi-3 = import ./raspberry-pi/3; + raspberry-pi-4 = import ./raspberry-pi/4; + raspberry-pi-5 = import ./raspberry-pi/5; + rock-4c-plus = import ./radxa/rock-4c-plus; + rock-5b = import ./radxa/rock-5b; + rock-pi-4 = import ./radxa/rock-pi-4; + rock-pi-e = import ./radxa/rock-pi-e; + kobol-helios4 = import ./kobol/helios4; + samsung-np900x3c = import ./samsung/np900x3c; + slimbook-hero-rpl-rtx = import ./slimbook/hero/rpl-rtx; + starfive-visionfive-v1 = import ./starfive/visionfive/v1; + starfive-visionfive-2 = import ./starfive/visionfive/v2; + starlabs-starlite-i5 = import ./starlabs/starlite/i5; + supermicro = import ./supermicro; + supermicro-a1sri-2758f = import ./supermicro/a1sri-2758f; + supermicro-m11sdv-8c-ln4f = import ./supermicro/m11sdv-8c-ln4f; + supermicro-x10sll-f = import ./supermicro/x10sll-f; + supermicro-x12scz-tln4f = import ./supermicro/x12scz-tln4f; + system76 = import ./system76; + system76-gaze18 = import ./system76/gaze18; + system76-galp5-1650 = import ./system76/galp5-1650; + system76-darp6 = import ./system76/darp6; + system76-thelio-mega = import ./system76/thelio-mega; + toshiba-swanky = import ./toshiba/swanky; + tuxedo-aura-15-gen1 = import ./tuxedo/aura/15/gen1; + tuxedo-infinitybook-v4 = import ./tuxedo/infinitybook/v4; + tuxedo-infinitybook-pro14-gen7 = import ./tuxedo/infinitybook/pro14/gen7; + tuxedo-infinitybook-pro14-gen9-intel = import ./tuxedo/infinitybook/pro14/gen9/intel; + tuxedo-pulse-14-gen3 = import ./tuxedo/pulse/14/gen3; + tuxedo-pulse-15-gen2 = import ./tuxedo/pulse/15/gen2; + xiaomi-redmibook-15-pro-2021 = import ./xiaomi/redmibook/15-pro-2021; + xiaomi-redmibook-16-pro-2024 = import ./xiaomi/redmibook/16-pro-2024; + + common-cpu-amd = import ./common/cpu/amd; + common-cpu-amd-pstate = import ./common/cpu/amd/pstate.nix; + common-cpu-amd-zenpower = import ./common/cpu/amd/zenpower.nix; + common-cpu-amd-raphael-igpu = import ./common/cpu/amd/raphael/igpu.nix; + common-cpu-intel = import ./common/cpu/intel; + common-gpu-intel-comet-lake = + deprecated "992" "common-gpu-intel-comet-lake" + (import ./common/gpu/intel/comet-lake); + common-cpu-intel-cpu-only = import ./common/cpu/intel/cpu-only.nix; + common-gpu-intel-kaby-lake = + deprecated "992" "common-gpu-intel-kaby-lake" + (import ./common/gpu/intel/kaby-lake); + common-gpu-intel-sandy-bridge = + deprecated "992" "common-gpu-intel-sandy-bridge" + (import ./common/gpu/intel/sandy-bridge); + common-gpu-amd = import ./common/gpu/amd; + common-gpu-amd-sea-islands = import ./common/gpu/amd/sea-islands; + common-gpu-amd-southern-islands = import ./common/gpu/amd/southern-islands; + common-gpu-intel = import ./common/gpu/intel; + common-gpu-intel-disable = import ./common/gpu/intel/disable.nix; + common-gpu-nvidia = import ./common/gpu/nvidia/prime.nix; + common-gpu-nvidia-sync = import ./common/gpu/nvidia/prime-sync.nix; + common-gpu-nvidia-nonprime = import ./common/gpu/nvidia; + common-gpu-nvidia-disable = import ./common/gpu/nvidia/disable.nix; + common-hidpi = import ./common/hidpi.nix; + common-pc = import ./common/pc; + common-pc-hdd = import ./common/pc/hdd; + common-pc-laptop = import ./common/pc/laptop; + common-pc-laptop-acpi_call = throw "common-pc-laptop-acpi_call has been removed because it is obsolete: https://github.com/NixOS/nixos-hardware/issues/1114"; + common-pc-laptop-hdd = import ./common/pc/laptop/hdd; + common-pc-laptop-ssd = import ./common/pc/ssd; + common-pc-ssd = import ./common/pc/ssd; + }; + }; } diff --git a/focus/m2/gen1/default.nix b/focus/m2/gen1/default.nix index f9242900..34996510 100644 --- a/focus/m2/gen1/default.nix +++ b/focus/m2/gen1/default.nix @@ -6,10 +6,17 @@ ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/turing ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usb_storage" + "sd_mod" + "rtsx_pci_sdmmc" + ]; boot.kernelModules = [ "kvm-intel" ]; boot.kernelParams = [ "tpm_tis.interrupts=0" # Upstream bug: https://bugzilla.kernel.org/show_bug.cgi?id=204121 diff --git a/framework/12-inch/13th-gen-intel/README.md b/framework/12-inch/13th-gen-intel/README.md new file mode 100644 index 00000000..6d35825f --- /dev/null +++ b/framework/12-inch/13th-gen-intel/README.md @@ -0,0 +1,17 @@ +# [Framework Laptop 12](https://frame.work/laptop12) + +## Updating Firmware + +First put enable `fwupd` + +```nix +services.fwupd.enable = true; +``` + +Then run + +```sh + $ fwupdmgr update +``` + +- [Latest Update](https://fwupd.org/lvfs/devices/work.frame.Laptop12.RPL.BIOS.firmware) diff --git a/framework/12-inch/13th-gen-intel/default.nix b/framework/12-inch/13th-gen-intel/default.nix new file mode 100644 index 00000000..6431338a --- /dev/null +++ b/framework/12-inch/13th-gen-intel/default.nix @@ -0,0 +1,7 @@ +{ config, lib, ... }: +{ + imports = [ + ../common + ../../../common/cpu/intel + ]; +} diff --git a/framework/12-inch/common/default.nix b/framework/12-inch/common/default.nix new file mode 100644 index 00000000..88195ea6 --- /dev/null +++ b/framework/12-inch/common/default.nix @@ -0,0 +1,19 @@ +{ lib, config, ... }: +{ + imports = [ + ../../../common/pc/laptop + ../../../common/pc/ssd + ../../bluetooth.nix + ../../kmod.nix + ../../framework-tool.nix + ]; + + # Fix TRRS headphones missing a mic + # https://github.com/torvalds/linux/commit/7b509910b3ad6d7aacead24c8744de10daf8715d + boot.extraModprobeConfig = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.13.0") '' + options snd-hda-intel model=dell-headset-multi + ''; + + # Needed for desktop environments to detect display orientation + hardware.sensor.iio.enable = lib.mkDefault true; +} diff --git a/framework/13-inch/11th-gen-intel/default.nix b/framework/13-inch/11th-gen-intel/default.nix index 2ea33969..4a24c4cb 100644 --- a/framework/13-inch/11th-gen-intel/default.nix +++ b/framework/13-inch/11th-gen-intel/default.nix @@ -1,4 +1,5 @@ -{ lib, pkgs, ...}: { +{ lib, pkgs, ... }: +{ imports = [ ../common ../common/intel.nix @@ -6,7 +7,10 @@ # Requires at least 5.16 for working wi-fi and bluetooth. # https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89 - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") ( + lib.mkDefault pkgs.linuxPackages_latest + ); - hardware.framework.laptop13.audioEnhancement.rawDeviceName = lib.mkDefault "alsa_output.pci-0000_00_1f.3.analog-stereo"; + hardware.framework.laptop13.audioEnhancement.rawDeviceName = + lib.mkDefault "alsa_output.pci-0000_00_1f.3.analog-stereo"; } diff --git a/framework/13-inch/12th-gen-intel/default.nix b/framework/13-inch/12th-gen-intel/default.nix index 4cce4446..f8ff0c01 100644 --- a/framework/13-inch/12th-gen-intel/default.nix +++ b/framework/13-inch/12th-gen-intel/default.nix @@ -9,7 +9,8 @@ { hardware.intelgpu.loadInInitrd = lib.versionOlder config.boot.kernelPackages.kernel.version "6.2"; # same as 13th gen framework 13-inch - hardware.framework.laptop13.audioEnhancement.rawDeviceName = lib.mkDefault "alsa_output.pci-0000_00_1f.3.analog-stereo"; + hardware.framework.laptop13.audioEnhancement.rawDeviceName = + lib.mkDefault "alsa_output.pci-0000_00_1f.3.analog-stereo"; } # https://community.frame.work/t/tracking-hard-freezing-on-fedora-36-with-the-new-12th-gen-system/20675/391 (lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.2") { diff --git a/framework/13-inch/7040-amd/default.nix b/framework/13-inch/7040-amd/default.nix index 9ec5e728..2cd21f60 100644 --- a/framework/13-inch/7040-amd/default.nix +++ b/framework/13-inch/7040-amd/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.hardware.framework.amd-7040; @@ -27,12 +32,15 @@ in config = { # Workaround applied upstream in Linux >=6.7 (on BIOS 03.03) # https://github.com/torvalds/linux/commit/a55bdad5dfd1efd4ed9ffe518897a21ca8e4e193 - services.udev.extraRules = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.7" && cfg.preventWakeOnAC) '' - # Prevent wake when plugging in AC during suspend. Trade-off: keyboard wake disabled. See: - # https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45 - ACTION=="add", SUBSYSTEM=="serio", DRIVERS=="atkbd", ATTR{power/wakeup}="disabled" - ''; + services.udev.extraRules = + lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.7" && cfg.preventWakeOnAC) + '' + # Prevent wake when plugging in AC during suspend. Trade-off: keyboard wake disabled. See: + # https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45 + ACTION=="add", SUBSYSTEM=="serio", DRIVERS=="atkbd", ATTR{power/wakeup}="disabled" + ''; - hardware.framework.laptop13.audioEnhancement.rawDeviceName = lib.mkDefault "alsa_output.pci-0000_c1_00.6.analog-stereo"; + hardware.framework.laptop13.audioEnhancement.rawDeviceName = + lib.mkDefault "alsa_output.pci-0000_c1_00.6.analog-stereo"; }; } diff --git a/framework/13-inch/amd-ai-300-series/README.md b/framework/13-inch/amd-ai-300-series/README.md new file mode 100644 index 00000000..8f3b7a42 --- /dev/null +++ b/framework/13-inch/amd-ai-300-series/README.md @@ -0,0 +1,15 @@ +# [Framework Laptop 13](https://frame.work/) + +## Updating Firmware + +First put enable `fwupd` + +```nix +services.fwupd.enable = true; +``` + +Then run + +```sh + $ fwupdmgr update +``` diff --git a/framework/13-inch/amd-ai-300-series/default.nix b/framework/13-inch/amd-ai-300-series/default.nix new file mode 100644 index 00000000..5eecb38b --- /dev/null +++ b/framework/13-inch/amd-ai-300-series/default.nix @@ -0,0 +1,15 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ + ../common + ../common/amd.nix + ]; + config.hardware.framework.laptop13.audioEnhancement.rawDeviceName = + lib.mkDefault "alsa_output.pci-0000_c1_00.6.analog-stereo"; +} diff --git a/framework/13-inch/common/amd.nix b/framework/13-inch/common/amd.nix index 20d9d235..ae35fffe 100644 --- a/framework/13-inch/common/amd.nix +++ b/framework/13-inch/common/amd.nix @@ -1,4 +1,5 @@ -{ lib, config, ... }: { +{ lib, config, ... }: +{ imports = [ ../../../common/cpu/amd ../../../common/cpu/amd/pstate.nix @@ -15,7 +16,9 @@ "amdgpu.dcdebugmask=0x10" ] # Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/ - ++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") ["rtc_cmos.use_acpi_alarm=1"]; + ++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [ + "rtc_cmos.use_acpi_alarm=1" + ]; # AMD has better battery life with PPD over TLP: # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13 diff --git a/framework/13-inch/common/audio.nix b/framework/13-inch/common/audio.nix index b6aa6d65..7010c35a 100644 --- a/framework/13-inch/common/audio.nix +++ b/framework/13-inch/common/audio.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.hardware.framework.laptop13.audioEnhancement; in @@ -14,7 +19,7 @@ in This option requires PipeWire and WirePlumber. The filter chain includes the following: - - Pyschoacoustic bass enhancement + - Psychoacoustic bass enhancement - Loudness compensation - Equalizer - Slight compression @@ -51,332 +56,335 @@ in }; }; - config = lib.mkIf cfg.enable (let - outputName = cfg.rawDeviceName; - prettyName = "Framework Speakers"; + config = lib.mkIf cfg.enable ( + let + outputName = cfg.rawDeviceName; + prettyName = "Framework Speakers"; - # These are pre-made decibel to linear value conversions, since Nix doesn't have pow(). - # Use the formula `10 ** (db / 20)` to calculate. - db = { - "-18.1" = 0.1244514611771385; - "-5.48" = 0.5321082592667942; - "-4.76" = 0.5780960474057181; - "8.1" = 2.5409727055493048; - "-36" = 1.5848931924611134e-2; - }; - - json = pkgs.formats.json { }; - - # The filter chain, heavily inspired by the asahi-audio project: https://github.com/AsahiLinux/asahi-audio - filter-chain = json.generate "filter-chain.json" { - "node.description" = prettyName; - "media.name" = prettyName; - "filter.graph" = { - nodes = [ - # Psychoacoustic bass extension, - # it creates harmonics of the missing bass to fool our ears into hearing it. - { - type = "lv2"; - plugin = "https://chadmed.au/bankstown"; - name = "bassex"; - control = { - bypass = 0; - amt = 1.2; - sat_second = 1.3; - sat_third = 2.5; - blend = 1.0; - ceil = 200.0; - floor = 20.0; - }; - } - # Loudness compensation, - # it ensures that the sound profile stays consistent across different volumes. - { - type = "lv2"; - plugin = "http://lsp-plug.in/plugins/lv2/loud_comp_stereo"; - name = "el"; - control = { - enabled = 1; - input = 1.0; - fft = 4; - }; - } - # 8-band equalizer, - # it tries to lessen frequencies where the laptop might resonate, - # and tries to make the frequency curve more pleasing; - # this is the "Lappy McTopface" profile (https://github.com/ceiphr/ee-framework-presets) - # further tuned for the Framework Laptop 13 AMD 7040 series - # and might need some tuning on other models. - { - type = "lv2"; - plugin = "http://lsp-plug.in/plugins/lv2/para_equalizer_x8_lr"; - name = "fw13eq"; - control = { - mode = 0; - react = 0.2; - zoom = db."-36"; - - fl_0 = 101.0; - fml_0 = 0; - ftl_0 = 5; - gl_0 = db."-18.1"; - huel_0 = 0.0; - ql_0 = 4.36; - sl_0 = 0; - wl_0 = 4.0; - - fl_1 = 451.0; - fml_1 = 0; - ftl_1 = 1; - gl_1 = db."-5.48"; - huel_1 = 3.125e-2; - ql_1 = 2.46; - sl_1 = 0; - wl_1 = 4.0; - - fl_2 = 918.0; - fml_2 = 0; - ftl_2 = 1; - gl_2 = db."-4.76"; - huel_2 = 6.25e-2; - ql_2 = 2.44; - sl_2 = 0; - wl_2 = 4.0; - - fl_3 = 9700.0; - fml_3 = 0; - ftl_3 = 1; - gl_3 = db."8.1"; - huel_3 = 9.375e-2; - ql_3 = 2.0; - sl_3 = 0; - wl_3 = 4.0; - - fr_0 = 101.0; - fmr_0 = 0; - ftr_0 = 5; - gr_0 = db."-18.1"; - huer_0 = 0.0; - qr_0 = 4.36; - sr_0 = 0; - wr_0 = 4.0; - - fr_1 = 451.0; - fmr_1 = 0; - ftr_1 = 1; - gr_1 = db."-5.48"; - huer_1 = 3.125e-2; - qr_1 = 2.46; - sr_1 = 0; - wr_1 = 4.0; - - fr_2 = 918.0; - fmr_2 = 0; - ftr_2 = 1; - gr_2 = db."-4.76"; - huer_2 = 6.25e-2; - qr_2 = 2.44; - sr_2 = 0; - wr_2 = 4.0; - - fr_3 = 9700.0; - fmr_3 = 0; - ftr_3 = 1; - gr_3 = db."8.1"; - huer_3 = 9.375e-2; - qr_3 = 2.0; - sr_3 = 0; - wr_3 = 4.0; - }; - } - # Compressors. The settings were taken from the asahi-audio project. - { - type = "lv2"; - plugin = "http://lsp-plug.in/plugins/lv2/mb_compressor_stereo"; - name = "woofer_bp"; - control = { - mode = 0; - ce_0 = 1; - sla_0 = 5.0; - cr_0 = 1.75; - al_0 = 0.725; - at_0 = 1.0; - rt_0 = 100; - kn_0 = 0.125; - cbe_1 = 1; - sf_1 = 200.0; - ce_1 = 0; - cbe_2 = 0; - ce_2 = 0; - cbe_3 = 0; - ce_3 = 0; - cbe_4 = 0; - ce_4 = 0; - cbe_5 = 0; - ce_5 = 0; - cbe_6 = 0; - ce_6 = 0; - }; - } - { - type = "lv2"; - plugin = "http://lsp-plug.in/plugins/lv2/compressor_stereo"; - name = "woofer_lim"; - control = { - sla = 5.0; - al = 1.0; - at = 1.0; - rt = 100.0; - cr = 15.0; - kn = 0.5; - }; - } - ]; - - # Now, we're chaining together the modules instantiated above. - links = [ - { - output = "bassex:out_l"; - input = "el:in_l"; - } - { - output = "bassex:out_r"; - input = "el:in_r"; - } - - { - output = "el:out_l"; - input = "fw13eq:in_l"; - } - { - output = "el:out_r"; - input = "fw13eq:in_r"; - } - { - output = "fw13eq:out_l"; - input = "woofer_bp:in_l"; - } - { - output = "fw13eq:out_r"; - input = "woofer_bp:in_r"; - } - { - output = "woofer_bp:out_l"; - input = "woofer_lim:in_l"; - } - { - output = "woofer_bp:out_r"; - input = "woofer_lim:in_r"; - } - ]; - - inputs = [ - "bassex:in_l" - "bassex:in_r" - ]; - outputs = [ - "woofer_lim:out_l" - "woofer_lim:out_r" - ]; - - # This makes pipewire's volume control actually control the loudness comp module - "capture.volumes" = [ - { - control = "el:volume"; - min = -47.5; - max = 0.0; - scale = "cubic"; - } - ]; + # These are pre-made decibel to linear value conversions, since Nix doesn't have pow(). + # Use the formula `10 ** (db / 20)` to calculate. + db = { + "-18.1" = 0.1244514611771385; + "-5.48" = 0.5321082592667942; + "-4.76" = 0.5780960474057181; + "8.1" = 2.5409727055493048; + "-36" = 1.5848931924611134e-2; }; - "capture.props" = { - "node.name" = "audio_effect.laptop-convolver"; - "media.class" = "Audio/Sink"; - "audio.channels" = "2"; - "audio.position" = [ - "FL" - "FR" - ]; - "audio.allowed-rates" = [ - 44100 - 48000 - 88200 - 96000 - 176400 - 192000 - ]; - "device.api" = "dsp"; - "node.virtual" = "false"; - # Lower seems to mean "more preferred", - # bluetooth devices seem to be ~1000, speakers seem to be ~2000 - # since this is between the two, bluetooth devices take over when they connect, - # and hand over to this instead of the speakers when they disconnect. - "priority.session" = 1500; - "priority.driver" = 1500; - "state.default-volume" = 0.343; - "device.icon-name" = "audio-card-analog-pci"; - }; - "playback.props" = { - "node.name" = "audio_effect.laptop-convolver"; - "target.object" = outputName; - "node.passive" = "true"; - "audio.channels" = "2"; - "audio.allowed-rates" = [ - 44100 - 48000 - 88200 - 96000 - 176400 - 192000 - ]; - "audio.position" = [ - "FL" - "FR" - ]; - "device.icon-name" = "audio-card-analog-pci"; - }; - }; + json = pkgs.formats.json { }; - configPackage = - (pkgs.writeTextDir "share/wireplumber/wireplumber.conf.d/99-laptop.conf" '' - monitor.alsa.rules = [ - { - matches = [{ node.name = "${outputName}" }] - actions = { - update-props = { - audio.allowed-rates = [44100, 48000, 88200, 96000, 176400, 192000] + # The filter chain, heavily inspired by the asahi-audio project: https://github.com/AsahiLinux/asahi-audio + filter-chain = json.generate "filter-chain.json" { + "node.description" = prettyName; + "media.name" = prettyName; + "filter.graph" = { + nodes = [ + # Psychoacoustic bass extension, + # it creates harmonics of the missing bass to fool our ears into hearing it. + { + type = "lv2"; + plugin = "https://chadmed.au/bankstown"; + name = "bassex"; + control = { + bypass = 0; + amt = 1.2; + sat_second = 1.3; + sat_third = 2.5; + blend = 1.0; + ceil = 200.0; + floor = 20.0; + }; + } + # Loudness compensation, + # it ensures that the sound profile stays consistent across different volumes. + { + type = "lv2"; + plugin = "http://lsp-plug.in/plugins/lv2/loud_comp_stereo"; + name = "el"; + control = { + enabled = 1; + input = 1.0; + fft = 4; + }; + } + # 8-band equalizer, + # it tries to lessen frequencies where the laptop might resonate, + # and tries to make the frequency curve more pleasing; + # this is the "Lappy McTopface" profile (https://github.com/ceiphr/ee-framework-presets) + # further tuned for the Framework Laptop 13 AMD 7040 series + # and might need some tuning on other models. + { + type = "lv2"; + plugin = "http://lsp-plug.in/plugins/lv2/para_equalizer_x8_lr"; + name = "fw13eq"; + control = { + mode = 0; + react = 0.2; + zoom = db."-36"; + + fl_0 = 101.0; + fml_0 = 0; + ftl_0 = 5; + gl_0 = db."-18.1"; + huel_0 = 0.0; + ql_0 = 4.36; + sl_0 = 0; + wl_0 = 4.0; + + fl_1 = 451.0; + fml_1 = 0; + ftl_1 = 1; + gl_1 = db."-5.48"; + huel_1 = 3.125e-2; + ql_1 = 2.46; + sl_1 = 0; + wl_1 = 4.0; + + fl_2 = 918.0; + fml_2 = 0; + ftl_2 = 1; + gl_2 = db."-4.76"; + huel_2 = 6.25e-2; + ql_2 = 2.44; + sl_2 = 0; + wl_2 = 4.0; + + fl_3 = 9700.0; + fml_3 = 0; + ftl_3 = 1; + gl_3 = db."8.1"; + huel_3 = 9.375e-2; + ql_3 = 2.0; + sl_3 = 0; + wl_3 = 4.0; + + fr_0 = 101.0; + fmr_0 = 0; + ftr_0 = 5; + gr_0 = db."-18.1"; + huer_0 = 0.0; + qr_0 = 4.36; + sr_0 = 0; + wr_0 = 4.0; + + fr_1 = 451.0; + fmr_1 = 0; + ftr_1 = 1; + gr_1 = db."-5.48"; + huer_1 = 3.125e-2; + qr_1 = 2.46; + sr_1 = 0; + wr_1 = 4.0; + + fr_2 = 918.0; + fmr_2 = 0; + ftr_2 = 1; + gr_2 = db."-4.76"; + huer_2 = 6.25e-2; + qr_2 = 2.44; + sr_2 = 0; + wr_2 = 4.0; + + fr_3 = 9700.0; + fmr_3 = 0; + ftr_3 = 1; + gr_3 = db."8.1"; + huer_3 = 9.375e-2; + qr_3 = 2.0; + sr_3 = 0; + wr_3 = 4.0; + }; + } + # Compressors. The settings were taken from the asahi-audio project. + { + type = "lv2"; + plugin = "http://lsp-plug.in/plugins/lv2/mb_compressor_stereo"; + name = "woofer_bp"; + control = { + mode = 0; + ce_0 = 1; + sla_0 = 5.0; + cr_0 = 1.75; + al_0 = 0.725; + at_0 = 1.0; + rt_0 = 100; + kn_0 = 0.125; + cbe_1 = 1; + sf_1 = 200.0; + ce_1 = 0; + cbe_2 = 0; + ce_2 = 0; + cbe_3 = 0; + ce_3 = 0; + cbe_4 = 0; + ce_4 = 0; + cbe_5 = 0; + ce_5 = 0; + cbe_6 = 0; + ce_6 = 0; + }; + } + { + type = "lv2"; + plugin = "http://lsp-plug.in/plugins/lv2/compressor_stereo"; + name = "woofer_lim"; + control = { + sla = 5.0; + al = 1.0; + at = 1.0; + rt = 100.0; + cr = 15.0; + kn = 0.5; + }; + } + ]; + + # Now, we're chaining together the modules instantiated above. + links = [ + { + output = "bassex:out_l"; + input = "el:in_l"; + } + { + output = "bassex:out_r"; + input = "el:in_r"; + } + + { + output = "el:out_l"; + input = "fw13eq:in_l"; + } + { + output = "el:out_r"; + input = "fw13eq:in_r"; + } + { + output = "fw13eq:out_l"; + input = "woofer_bp:in_l"; + } + { + output = "fw13eq:out_r"; + input = "woofer_bp:in_r"; + } + { + output = "woofer_bp:out_l"; + input = "woofer_lim:in_l"; + } + { + output = "woofer_bp:out_r"; + input = "woofer_lim:in_r"; + } + ]; + + inputs = [ + "bassex:in_l" + "bassex:in_r" + ]; + outputs = [ + "woofer_lim:out_l" + "woofer_lim:out_r" + ]; + + # This makes pipewire's volume control actually control the loudness comp module + "capture.volumes" = [ + { + control = "el:volume"; + min = -47.5; + max = 0.0; + scale = "cubic"; + } + ]; + }; + "capture.props" = { + "node.name" = "audio_effect.laptop-convolver"; + "media.class" = "Audio/Sink"; + "audio.channels" = "2"; + "audio.position" = [ + "FL" + "FR" + ]; + "audio.allowed-rates" = [ + 44100 + 48000 + 88200 + 96000 + 176400 + 192000 + ]; + "device.api" = "dsp"; + "node.virtual" = "false"; + + # Lower seems to mean "more preferred", + # bluetooth devices seem to be ~1000, speakers seem to be ~2000 + # since this is between the two, bluetooth devices take over when they connect, + # and hand over to this instead of the speakers when they disconnect. + "priority.session" = 1500; + "priority.driver" = 1500; + "state.default-volume" = 0.343; + "device.icon-name" = "audio-card-analog-pci"; + }; + "playback.props" = { + "node.name" = "audio_effect.laptop-convolver"; + "target.object" = outputName; + "node.passive" = "true"; + "audio.channels" = "2"; + "audio.allowed-rates" = [ + 44100 + 48000 + 88200 + 96000 + 176400 + 192000 + ]; + "audio.position" = [ + "FL" + "FR" + ]; + "device.icon-name" = "audio-card-analog-pci"; + }; + }; + + configPackage = + (pkgs.writeTextDir "share/wireplumber/wireplumber.conf.d/99-laptop.conf" '' + monitor.alsa.rules = [ + { + matches = [{ node.name = "${outputName}" }] + actions = { + update-props = { + audio.allowed-rates = [44100, 48000, 88200, 96000, 176400, 192000] + } } } - } - ] + ] - node.software-dsp.rules = [ - { - matches = [{ node.name = "${outputName}" }] - actions = { - create-filter = { - filter-path = "${filter-chain}" - hide-parent = ${lib.boolToString cfg.hideRawDevice} + node.software-dsp.rules = [ + { + matches = [{ node.name = "${outputName}" }] + actions = { + create-filter = { + filter-path = "${filter-chain}" + hide-parent = ${lib.boolToString cfg.hideRawDevice} + } } } + ] + + wireplumber.profiles = { + main = { node.software-dsp = "required" } } - ] + '') + // { + passthru.requiredLv2Packages = with pkgs; [ + lsp-plugins + bankstown-lv2 + ]; + }; + in + { + services.pipewire.wireplumber.configPackages = [ configPackage ]; - wireplumber.profiles = { - main = { node.software-dsp = "required" } - } - '') - // { - passthru.requiredLv2Packages = with pkgs; [ - lsp-plugins - bankstown-lv2 - ]; - }; - in { - services.pipewire.wireplumber.configPackages = [ configPackage ]; - - # Pipewire is needed for this. - services.pipewire.enable = lib.mkDefault true; - }); + # Pipewire is needed for this. + services.pipewire.enable = lib.mkDefault true; + } + ); } diff --git a/framework/13-inch/common/default.nix b/framework/13-inch/common/default.nix index 5d228d03..d42a9f72 100644 --- a/framework/13-inch/common/default.nix +++ b/framework/13-inch/common/default.nix @@ -1,7 +1,8 @@ -{ lib, pkgs, ... }: { +{ lib, config, ... }: +{ imports = [ ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../bluetooth.nix ../../kmod.nix ../../framework-tool.nix @@ -10,7 +11,7 @@ # Fix TRRS headphones missing a mic # https://community.frame.work/t/headset-microphone-on-linux/12387/3 - boot.extraModprobeConfig = lib.mkIf (lib.versionOlder pkgs.linux.version "6.6.8") '' + boot.extraModprobeConfig = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.6.8") '' options snd-hda-intel model=dell-headset-multi ''; diff --git a/framework/13-inch/common/intel.nix b/framework/13-inch/common/intel.nix index 96bbec97..6248e75f 100644 --- a/framework/13-inch/common/intel.nix +++ b/framework/13-inch/common/intel.nix @@ -1,21 +1,30 @@ -{ config, lib, pkgs, ... }: { +{ + config, + lib, + pkgs, + ... +}: +{ imports = [ ../../../common/cpu/intel ]; - boot.kernelParams = [ - # For Power consumption - # https://community.frame.work/t/linux-battery-life-tuning/6665/156 - "nvme.noacpi=1" - ] - # Fixes a regression in s2idle, making it more power efficient than deep sleep - # Update 04/2024: It appears that s2idle-regression got fixed in newer kernel-versions (SebTM) - # (see: https://github.com/NixOS/nixos-hardware/pull/903#discussion_r1556096657) - ++ lib.lists.optional (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") "acpi_osi=\"!Windows 2020\""; + boot.kernelParams = + [ + # For Power consumption + # https://community.frame.work/t/linux-battery-life-tuning/6665/156 + "nvme.noacpi=1" + ] + # Fixes a regression in s2idle, making it more power efficient than deep sleep + # Update 04/2024: It appears that s2idle-regression got fixed in newer kernel-versions (SebTM) + # (see: https://github.com/NixOS/nixos-hardware/pull/903#discussion_r1556096657) + ++ lib.lists.optional (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") "acpi_osi=\"!Windows 2020\""; # Requires at least 5.16 for working wi-fi and bluetooth. # https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89 - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") ( + lib.mkDefault pkgs.linuxPackages_latest + ); # Module is not used for Framework EC but causes boot time error log. boot.blacklistedKernelModules = [ "cros-usbpd-charger" ]; diff --git a/framework/13-inch/intel-core-ultra-series1/default.nix b/framework/13-inch/intel-core-ultra-series1/default.nix index 2efb3f77..4851d54f 100644 --- a/framework/13-inch/intel-core-ultra-series1/default.nix +++ b/framework/13-inch/intel-core-ultra-series1/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ @@ -8,11 +13,13 @@ # Need at least 6.9 to make suspend properly # Specifically this patch: https://github.com/torvalds/linux/commit/073237281a508ac80ec025872ad7de50cfb5a28a - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.9") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.9") ( + lib.mkDefault pkgs.linuxPackages_latest + ); # Intel NPU Driver # https://discourse.nixos.org/t/new-installation-on-asus-zenbook-ux5406-intel-vpu-firmware-error-2/58732/2 - hardware.firmware = [ + hardware.firmware = lib.optionals (config.hardware.enableRedistributableFirmware) [ ( let model = "37xx"; @@ -29,4 +36,9 @@ '' ) ]; + + warnings = lib.mkIf (!config.hardware.enableRedistributableFirmware) [ + ''For Intel NPU support, set the option: hardware.enableRedistributableFirmware = true;'' + ]; + } diff --git a/framework/16-inch/7040-amd/default.nix b/framework/16-inch/7040-amd/default.nix index 6c02455a..70275e69 100644 --- a/framework/16-inch/7040-amd/default.nix +++ b/framework/16-inch/7040-amd/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ diff --git a/framework/16-inch/common/amd.nix b/framework/16-inch/common/amd.nix index 20d9d235..ae35fffe 100644 --- a/framework/16-inch/common/amd.nix +++ b/framework/16-inch/common/amd.nix @@ -1,4 +1,5 @@ -{ lib, config, ... }: { +{ lib, config, ... }: +{ imports = [ ../../../common/cpu/amd ../../../common/cpu/amd/pstate.nix @@ -15,7 +16,9 @@ "amdgpu.dcdebugmask=0x10" ] # Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/ - ++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") ["rtc_cmos.use_acpi_alarm=1"]; + ++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [ + "rtc_cmos.use_acpi_alarm=1" + ]; # AMD has better battery life with PPD over TLP: # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13 diff --git a/framework/16-inch/common/default.nix b/framework/16-inch/common/default.nix index 5ec8a171..8443e401 100644 --- a/framework/16-inch/common/default.nix +++ b/framework/16-inch/common/default.nix @@ -1,7 +1,8 @@ -{ lib, pkgs, ... }: { +{ lib, config, ... }: +{ imports = [ ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../bluetooth.nix ../../kmod.nix ../../framework-tool.nix @@ -9,7 +10,7 @@ # Fix TRRS headphones missing a mic # https://community.frame.work/t/headset-microphone-on-linux/12387/3 - boot.extraModprobeConfig = lib.mkIf (lib.versionOlder pkgs.linux.version "6.6.8") '' + boot.extraModprobeConfig = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.6.8") '' options snd-hda-intel model=dell-headset-multi ''; diff --git a/framework/bluetooth.nix b/framework/bluetooth.nix index ba76081c..0e08adb7 100644 --- a/framework/bluetooth.nix +++ b/framework/bluetooth.nix @@ -10,29 +10,46 @@ pkgs, ... # TODO: drop this if linux 6.11 goes EOL -}: lib.mkIf ((config.boot.kernelPackages.kernelAtLeast "6.11") && (config.boot.kernelPackages.kernelOlder "6.12")) { - systemd.services = { - bluetooth-rfkill-suspend = { - description = "Soft block Bluetooth on suspend/hibernate"; - before = ["sleep.target"]; - unitConfig.StopWhenUnneeded = true; - serviceConfig = { - Type = "oneshot"; - ExecStart = "${pkgs.util-linux}/bin/rfkill block bluetooth"; - ExecStartPost = "${pkgs.coreutils}/bin/sleep 3"; - RemainAfterExit = true; +}: +lib.mkIf + ( + (config.boot.kernelPackages.kernelAtLeast "6.11") && (config.boot.kernelPackages.kernelOlder "6.12") + ) + { + systemd.services = { + bluetooth-rfkill-suspend = { + description = "Soft block Bluetooth on suspend/hibernate"; + before = [ "sleep.target" ]; + unitConfig.StopWhenUnneeded = true; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.util-linux}/bin/rfkill block bluetooth"; + ExecStartPost = "${pkgs.coreutils}/bin/sleep 3"; + RemainAfterExit = true; + }; + wantedBy = [ + "suspend.target" + "hibernate.target" + "suspend-then-hibernate.target" + ]; }; - wantedBy = ["suspend.target" "hibernate.target" "suspend-then-hibernate.target"]; - }; - bluetooth-rfkill-resume = { - description = "Unblock Bluetooth on resume"; - after = ["suspend.target" "hibernate.target" "suspend-then-hibernate.target"]; - serviceConfig = { - Type = "oneshot"; - ExecStart = "${pkgs.util-linux}/bin/rfkill unblock bluetooth"; + bluetooth-rfkill-resume = { + description = "Unblock Bluetooth on resume"; + after = [ + "suspend.target" + "hibernate.target" + "suspend-then-hibernate.target" + ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.util-linux}/bin/rfkill unblock bluetooth"; + }; + wantedBy = [ + "suspend.target" + "hibernate.target" + "suspend-then-hibernate.target" + ]; }; - wantedBy = ["suspend.target" "hibernate.target" "suspend-then-hibernate.target"]; }; - }; -} + } diff --git a/framework/framework-tool.nix b/framework/framework-tool.nix index 4effcca8..4c70193e 100644 --- a/framework/framework-tool.nix +++ b/framework/framework-tool.nix @@ -1,3 +1,4 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ environment.systemPackages = [ pkgs.framework-tool ]; } diff --git a/framework/kmod.nix b/framework/kmod.nix index 6ed05b9a..7cb53746 100644 --- a/framework/kmod.nix +++ b/framework/kmod.nix @@ -1,17 +1,20 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let kernel_version_compatible = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.10"; -in { - options.hardware.framework.enableKmod = (lib.mkEnableOption - "Enable the community created Framework kernel module that allows interacting with the embedded controller from sysfs." - ) // { - # enable by default on NixOS >= 24.05 and kernel >= 6.10 - default = lib.and - (lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.05") - kernel_version_compatible; - defaultText = "enabled by default on NixOS >= 24.05 and kernel >= 6.10"; - }; - +in +{ + options.hardware.framework.enableKmod = + (lib.mkEnableOption "Enable the community created Framework kernel module that allows interacting with the embedded controller from sysfs.") + // { + # enable by default on NixOS >= 24.05 and kernel >= 6.10 + default = lib.and (lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.05") kernel_version_compatible; + defaultText = "enabled by default on NixOS >= 24.05 and kernel >= 6.10"; + }; config.boot = lib.mkIf config.hardware.framework.enableKmod { extraModulePackages = with config.boot.kernelPackages; [ @@ -19,7 +22,10 @@ in { ]; # https://github.com/DHowett/framework-laptop-kmod?tab=readme-ov-file#usage - kernelModules = [ "cros_ec" "cros_ec_lpcs" ]; + kernelModules = [ + "cros_ec" + "cros_ec_lpcs" + ]; # add required patch if enabled on kernel <6.10 kernelPatches = lib.mkIf (!kernel_version_compatible) [ @@ -28,15 +34,22 @@ in { msgid = "20240403004713.130365-1-dustin@howett.net"; version = "3"; hash = "sha256-aQSyys8CMzlj9EdNhg8vtp76fg1qEwUVeJL0E+8w5HU="; - patch = pkgs.runCommandLocal "patch-${msgid}" { - nativeBuildInputs = with pkgs; [ b4 git cacert ]; - SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; + patch = + pkgs.runCommandLocal "patch-${msgid}" + { + nativeBuildInputs = with pkgs; [ + b4 + git + cacert + ]; + SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; - outputHash = hash; - } '' - export HOME="$TMP" - PYTHONHASHSEED=0 ${pkgs.b4}/bin/b4 -n am -C -T -v ${version} -o- "${msgid}" > "$out" - ''; + outputHash = hash; + } + '' + export HOME="$TMP" + PYTHONHASHSEED=0 ${pkgs.b4}/bin/b4 -n am -C -T -v ${version} -o- "${msgid}" > "$out" + ''; } ]; }; diff --git a/friendlyarm/nanopc-t4/default.nix b/friendlyarm/nanopc-t4/default.nix index 61b86576..55bbf6b4 100644 --- a/friendlyarm/nanopc-t4/default.nix +++ b/friendlyarm/nanopc-t4/default.nix @@ -14,13 +14,17 @@ hardware.enableRedistributableFirmware = lib.mkDefault true; # Fix for not detecting the M.2 NVMe SSD. Will cause recompilation. - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.10") (lib.mkDefault pkgs.linuxPackages_latest); - boot.kernelPatches = lib.mkDefault [{ - name = "pcie-rockchip-config.patch"; - patch = null; - extraConfig = '' - PHY_ROCKCHIP_PCIE y - PCIE_ROCKCHIP_HOST y - ''; - }]; + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.10") ( + lib.mkDefault pkgs.linuxPackages_latest + ); + boot.kernelPatches = lib.mkDefault [ + { + name = "pcie-rockchip-config.patch"; + patch = null; + extraConfig = '' + PHY_ROCKCHIP_PCIE y + PCIE_ROCKCHIP_HOST y + ''; + } + ]; } diff --git a/friendlyarm/nanopi-r5s/default.nix b/friendlyarm/nanopi-r5s/default.nix index b7ecb916..ba018200 100644 --- a/friendlyarm/nanopi-r5s/default.nix +++ b/friendlyarm/nanopi-r5s/default.nix @@ -1,5 +1,6 @@ -{ lib -, ... +{ + lib, + ... }: { diff --git a/gigabyte/b550/README.md b/gigabyte/b550/README.md index e8ccf531..9a900a37 100644 --- a/gigabyte/b550/README.md +++ b/gigabyte/b550/README.md @@ -9,9 +9,10 @@ Symptoms: - It goes into suspend, then seems to boot and hang. Sometimes it suspends successfully, but waking it from suspend puts it in the "zombie" state. - By playing chicken with volatile storage and flicking the power switch on the back of power supply, you can sometimes get it to wake from suspend as the card un-powers before volatile storage does. -Fix: disable GPP0 and GPP8 (And, for some cards, potentially PTXH, I can't test) in /proc/acpi/wakeup - - To do this permanently, a systemd service is provided +This can be fixed by disabling GPP0 and GPP8 (And, for some cards, potentially PTXH, I can't test) in /proc/acpi/wakeup. +But because /proc/acpi/wakeup only supports toggling (not disabling) wakeups, we use a udev rule to disable wakeups for +the same device by PCI device ID instead. ## This affects at least: - Gigabyte b550m-d3sh (my machine) diff --git a/gigabyte/b550/b550-fix-suspend.nix b/gigabyte/b550/b550-fix-suspend.nix index 49868093..abc04a2d 100644 --- a/gigabyte/b550/b550-fix-suspend.nix +++ b/gigabyte/b550/b550-fix-suspend.nix @@ -1,35 +1,13 @@ -{ pkgs, lib, ... } : - { - systemd.services.bugfixSuspend-GPP0 = { - enable = lib.mkDefault true; - description = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)"; - unitConfig = { - Type = "oneshot"; - }; - serviceConfig = { - User = "root"; # root may not be necessary - # check for gppN, disable if enabled - # lifted from https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ksbm0mb/ /u/Demotay - ExecStart = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP0' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP0' > /proc/acpi/wakeup; fi'"; - RemainAfterExit = "yes"; # required to not toggle when `nixos-rebuild switch` is ran - - }; - wantedBy = ["multi-user.target"]; - }; - - systemd.services.bugfixSuspend-GPP8 = { - enable = lib.mkDefault true; - description = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)"; - unitConfig = { - Type = "oneshot"; - }; - serviceConfig = { - User = "root"; - ExecStart = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP8' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP8' > /proc/acpi/wakeup; fi'"; - RemainAfterExit = "yes"; - }; - wantedBy = ["multi-user.target"]; - }; - + # Work around an issue causing the system to unsuspend immediately after suspend + # and/or hang after suspend. + # + # See https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ksbm0mb/ /u/Demotay + # + # Most suggestions elsewhere are to disable GPP0 and/or GPP8 using /proc/acpi/wakeup, but that is + # inconvenient because it toggles. This does essentially the same thing using udev, which can set + # the wakeup attribute to a specific value. + services.udev.extraRules = '' + ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x1022", ATTR{device}=="0x1483", ATTR{power/wakeup}="disabled" + ''; } diff --git a/gigabyte/b650/README.md b/gigabyte/b650/README.md index aeb23cd9..94d20c3c 100644 --- a/gigabyte/b650/README.md +++ b/gigabyte/b650/README.md @@ -6,8 +6,3 @@ bug where the PC will wakeup immediately after going into suspend. ## Affects at least - Gigabyte B650M Aorus Elite AX (Rev. 1.3) (BIOS Version F32b) - - Can not be fixed by modifying enabled entries in /proc/acpi/wakeup. - Computer wakes up even if all enabled entries are disabled. Therefore, no - fix exist currently. - - diff --git a/gigabyte/b650/b650-fix-suspend.nix b/gigabyte/b650/b650-fix-suspend.nix new file mode 100644 index 00000000..b82bd33c --- /dev/null +++ b/gigabyte/b650/b650-fix-suspend.nix @@ -0,0 +1,6 @@ +{ + # see https://bbs.archlinux.org/viewtopic.php?pid=2227023 + boot.kernelParams = [ + "acpi_osi=\"!Windows 2015\"" + ]; +} diff --git a/gigabyte/b650/default.nix b/gigabyte/b650/default.nix new file mode 100644 index 00000000..4b0a77af --- /dev/null +++ b/gigabyte/b650/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./b650-fix-suspend.nix + ]; +} diff --git a/gmktec/nucbox/g3-plus/default.nix b/gmktec/nucbox/g3-plus/default.nix new file mode 100644 index 00000000..1396aa71 --- /dev/null +++ b/gmktec/nucbox/g3-plus/default.nix @@ -0,0 +1,27 @@ +/* + `gmktec-nucbox-g3-plus`: + + Product page: + + + This profile just configures the Intel + Twin Lake N150 CPU and integrated + graphics for this mini-PC. fstrim is also + enabled for the SSD. That's all this seemed + to need to function properly. As is now + expected from Intel NUC systems, it provides + a solid "out-of-the-box" experience. No + special quirks are apparent. + + We import the Alder Lake modules since Twin + Lake is just a refreshed version of the + Alder Lake-N series. Re-using those seems + to be fine for this purpose. +*/ +{ + imports = [ + ../../../common/cpu/intel/alder-lake + ../../../common/gpu/intel/alder-lake + ../../../common/pc/ssd + ]; +} diff --git a/google/pixelbook/default.nix b/google/pixelbook/default.nix index 1ea4c7af..6ad1d2cc 100644 --- a/google/pixelbook/default.nix +++ b/google/pixelbook/default.nix @@ -3,7 +3,7 @@ { imports = [ ../../common/pc/laptop - ../../common/pc/laptop/ssd + ../../common/pc/ssd ../../common/cpu/intel/kaby-lake ]; } diff --git a/gpd/micropc/default.nix b/gpd/micropc/default.nix index d9a699ef..34b35201 100644 --- a/gpd/micropc/default.nix +++ b/gpd/micropc/default.nix @@ -2,7 +2,7 @@ { imports = [ ../../common/pc/laptop - ../../common/pc/laptop/ssd + ../../common/pc/ssd ]; # Needed to have the keyboard working during the initrd sequence diff --git a/gpd/p2-max/default.nix b/gpd/p2-max/default.nix index e8f183e2..206348c4 100644 --- a/gpd/p2-max/default.nix +++ b/gpd/p2-max/default.nix @@ -1,7 +1,7 @@ { imports = [ ../../common/pc/laptop - ../../common/pc/laptop/ssd + ../../common/pc/ssd ../../common/cpu/intel/kaby-lake ../../common/hidpi.nix ]; diff --git a/gpd/pocket-3/default.nix b/gpd/pocket-3/default.nix index 621f4454..730249be 100644 --- a/gpd/pocket-3/default.nix +++ b/gpd/pocket-3/default.nix @@ -1,44 +1,56 @@ { lib, pkgs, ... }: -let inherit (lib) mkDefault mkIf; +let + inherit (lib) mkDefault mkIf; in { - imports = [ - ../../common/pc/laptop - ../../common/pc/laptop/ssd + imports = [ + ../../common/pc/laptop + ../../common/pc/ssd ../../common/hidpi.nix ../../common/gpu/24.05-compat.nix - ]; + ]; # Necessary kernel modules - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "thunderbolt" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "usbhid" + "thunderbolt" + ]; - # GPU is an Intel Iris Xe, on a “TigerLake” mobile CPU - boot.initrd.kernelModules = [ "i915" ]; # Early loading so the passphrase prompt appears on external displays - hardware.graphics.extraPackages = with pkgs; [ - intel-media-driver - (if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then vaapiIntel else intel-vaapi-driver) - ]; + # GPU is an Intel Iris Xe, on a “TigerLake” mobile CPU + boot.initrd.kernelModules = [ "i915" ]; # Early loading so the passphrase prompt appears on external displays + hardware.graphics.extraPackages = with pkgs; [ + intel-media-driver + ( + if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then + vaapiIntel + else + intel-vaapi-driver + ) + ]; - boot.kernelParams = [ - # The GPD Pocket3 uses a tablet OLED display, that is mounted rotated 90° counter-clockwise - "fbcon=rotate:1" "video=DSI-1:panel_orientation=right_side_up" - ]; + boot.kernelParams = [ + # The GPD Pocket3 uses a tablet OLED display, that is mounted rotated 90° counter-clockwise + "fbcon=rotate:1" + "video=DSI-1:panel_orientation=right_side_up" + ]; - fonts.fontconfig = { - subpixel.rgba = "vbgr"; # Pixel order for rotated screen + fonts.fontconfig = { + subpixel.rgba = "vbgr"; # Pixel order for rotated screen - # The OLED display has √(1920² + 1200²) px / 8in ≃ 283 dpi - # Per the documentation, antialiasing, hinting, etc. have no visible effect at such high pixel densities anyhow. - # Set manually, as the hiDPI module had incorrect settings prior to NixOS 22.11; see nixpkgs#194594. - hinting.enable = mkDefault false; - antialias = mkIf (lib.versionOlder (lib.versions.majorMinor lib.version) "22.11") false; - }; + # The OLED display has √(1920² + 1200²) px / 8in ≃ 283 dpi + # Per the documentation, antialiasing, hinting, etc. have no visible effect at such high pixel densities anyhow. + # Set manually, as the hiDPI module had incorrect settings prior to NixOS 22.11; see nixpkgs#194594. + hinting.enable = mkDefault false; + antialias = mkIf (lib.versionOlder (lib.versions.majorMinor lib.version) "22.11") false; + }; - # More HiDPI settings - services.xserver.dpi = 280; + # More HiDPI settings + services.xserver.dpi = 280; - # Necessary for audio support on the 1195G7 model - boot.extraModprobeConfig = '' - options snd-intel-dspcfg dsp_driver=1 - ''; + # Necessary for audio support on the 1195G7 model + boot.extraModprobeConfig = '' + options snd-intel-dspcfg dsp_driver=1 + ''; } diff --git a/gpd/pocket-4/default.nix b/gpd/pocket-4/default.nix index 36a6a0a7..8d08b2e8 100644 --- a/gpd/pocket-4/default.nix +++ b/gpd/pocket-4/default.nix @@ -1,10 +1,11 @@ { lib, pkgs, ... }: -let inherit (lib) mkIf mkDefault; +let + inherit (lib) mkIf mkDefault; in { imports = [ ../../common/pc/laptop - ../../common/pc/laptop/ssd + ../../common/pc/ssd ../../common/cpu/amd ../../common/cpu/amd/pstate.nix ../../common/gpu/amd @@ -17,7 +18,8 @@ in kernelParams = [ # The GPD Pocket 4 uses a tablet LTPS display, that is mounted rotated 90° counter-clockwise - "fbcon=rotate:1" "video=eDP-1:panel_orientation=right_side_up" + "fbcon=rotate:1" + "video=eDP-1:panel_orientation=right_side_up" ]; }; diff --git a/gpd/win-2/default.nix b/gpd/win-2/default.nix index aaaba374..e7247534 100644 --- a/gpd/win-2/default.nix +++ b/gpd/win-2/default.nix @@ -1,17 +1,19 @@ -{ config, lib, ...}: +{ config, lib, ... }: { imports = [ ../../common/cpu/intel ../../common/pc/ssd - ]; + ]; boot.kernelParams = [ "fbcon=rotate:1" "video=eDP-1:panel_orientation=right_side_up" ]; - services.tlp.enable = lib.mkDefault ((lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") - || !config.services.power-profiles-daemon.enable); + services.tlp.enable = lib.mkDefault ( + (lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") + || !config.services.power-profiles-daemon.enable + ); # Required for grub to properly display the boot menu. boot.loader.grub.gfxmodeEfi = lib.mkDefault "720x1280x32"; diff --git a/gpd/win-max-2/2023/bmi260/package.nix b/gpd/win-max-2/2023/bmi260/package.nix index a1e2db4f..78464736 100644 --- a/gpd/win-max-2/2023/bmi260/package.nix +++ b/gpd/win-max-2/2023/bmi260/package.nix @@ -7,13 +7,13 @@ stdenv.mkDerivation (finalAttr: { pname = "bmi260"; - version = "1.0.0"; + version = "1.1.0"; src = fetchFromGitHub { owner = "hhd-dev"; repo = finalAttr.pname; rev = "v${finalAttr.version}"; - hash = "sha256-EFous0pPpCuVoCsFz6/4NryQRSH9Jw9Qng+RY1hiX1c="; + hash = "sha256-So8rWDTXYsMUgLBU9WrJp47txA8dI98tcxXNy92AYgg="; }; hardeningDisable = [ "pic" ]; @@ -38,6 +38,6 @@ stdenv.mkDerivation (finalAttr: { gpl2Only ]; maintainers = with maintainers; [ Cryolitia ]; - platforms = platforms.linux; + platforms = [ "x86_64-linux" ]; }; }) diff --git a/gpd/win-max-2/2023/default.nix b/gpd/win-max-2/2023/default.nix index b20f2ca3..1338c843 100644 --- a/gpd/win-max-2/2023/default.nix +++ b/gpd/win-max-2/2023/default.nix @@ -1,4 +1,4 @@ -{ config, lib, ...}: +{ config, lib, ... }: with lib; { imports = [ @@ -12,6 +12,10 @@ with lib; hardware.sensor.iio.bmi260.enable = lib.mkDefault true; #see README - boot.blacklistedKernelModules = mkIf config.hardware.sensor.iio.bmi260.enable [ "bmi160_spi" "bmi160_i2c" "bmi160_core" ]; + boot.blacklistedKernelModules = mkIf config.hardware.sensor.iio.bmi260.enable [ + "bmi160_spi" + "bmi160_i2c" + "bmi160_core" + ]; hardware.sensor.iio.enable = mkIf config.hardware.sensor.iio.bmi260.enable true; } diff --git a/gpd/win-max-2/default.nix b/gpd/win-max-2/default.nix index d7ff52d6..c9762cd6 100644 --- a/gpd/win-max-2/default.nix +++ b/gpd/win-max-2/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; let cfg = config.hardware.gpd.ppt; diff --git a/gpd/win-mini/default.nix b/gpd/win-mini/default.nix index 6361d576..f0d23926 100644 --- a/gpd/win-mini/default.nix +++ b/gpd/win-mini/default.nix @@ -5,9 +5,6 @@ ... }: with lib; -let - cfg = config.hardware.gpd.ppt; -in { imports = [ ../../common/pc/laptop diff --git a/hardkernel/odroid-hc4/default.nix b/hardkernel/odroid-hc4/default.nix index e591a871..a6442aba 100644 --- a/hardkernel/odroid-hc4/default.nix +++ b/hardkernel/odroid-hc4/default.nix @@ -4,25 +4,31 @@ # Based on the config from https://www.armbian.com/odroid-hc4/ hardware.fancontrol = { enable = lib.mkDefault true; - config = let - # According to https://www.armbian.com/odroid-hc4/ the FCFANS line should be removed on kernel 5.15. - kernelVersion = config.boot.kernelPackages.kernel.version; - needFcFans = lib.versions.majorMinor kernelVersion != "5.15"; - in lib.mkDefault ('' - INTERVAL=10 - DEVPATH=hwmon0=devices/virtual/thermal/thermal_zone0 hwmon2=devices/platform/pwm-fan - DEVNAME=hwmon0=cpu_thermal hwmon2=pwmfan - FCTEMPS=hwmon2/pwm1=hwmon0/temp1_input - '' + lib.optionalString needFcFans '' - FCFANS= hwmon2/pwm1=hwmon2/fan1_input - '' + '' - MINTEMP=hwmon2/pwm1=50 - MAXTEMP=hwmon2/pwm1=60 - MINSTART=hwmon2/pwm1=20 - MINSTOP=hwmon2/pwm1=28 - MINPWM=hwmon2/pwm1=0 - MAXPWM=hwmon2/pwm1=255 - ''); + config = + let + # According to https://www.armbian.com/odroid-hc4/ the FCFANS line should be removed on kernel 5.15. + kernelVersion = config.boot.kernelPackages.kernel.version; + needFcFans = lib.versions.majorMinor kernelVersion != "5.15"; + in + lib.mkDefault ( + '' + INTERVAL=10 + DEVPATH=hwmon0=devices/virtual/thermal/thermal_zone0 hwmon2=devices/platform/pwm-fan + DEVNAME=hwmon0=cpu_thermal hwmon2=pwmfan + FCTEMPS=hwmon2/pwm1=hwmon0/temp1_input + '' + + lib.optionalString needFcFans '' + FCFANS= hwmon2/pwm1=hwmon2/fan1_input + '' + + '' + MINTEMP=hwmon2/pwm1=50 + MAXTEMP=hwmon2/pwm1=60 + MINSTART=hwmon2/pwm1=20 + MINSTOP=hwmon2/pwm1=28 + MINPWM=hwmon2/pwm1=0 + MAXPWM=hwmon2/pwm1=255 + '' + ); }; # Linux 5.15 sometimes crash under heavy network usage diff --git a/hp/elitebook/830/g6/default.nix b/hp/elitebook/830/g6/default.nix index 3b209b46..1790c8a9 100644 --- a/hp/elitebook/830/g6/default.nix +++ b/hp/elitebook/830/g6/default.nix @@ -1,9 +1,9 @@ -{ pkgs, lib, ... }: +{ config, lib, ... }: { imports = [ ../../../../common/cpu/intel ../../../../common/pc/laptop - ../../../../common/pc/laptop/ssd + ../../../../common/pc/ssd ]; # Needed for wifi @@ -16,7 +16,7 @@ services.fwupd.enable = lib.mkDefault true; # Enables ACPI platform profiles - boot = lib.mkIf (lib.versionAtLeast pkgs.linux.version "6.1") { + boot = lib.mkIf (lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.1") { kernelModules = [ "hp-wmi" ]; }; diff --git a/hp/elitebook/845/g7/default.nix b/hp/elitebook/845/g7/default.nix index 823bf40c..542921e0 100644 --- a/hp/elitebook/845/g7/default.nix +++ b/hp/elitebook/845/g7/default.nix @@ -1,18 +1,19 @@ { pkgs, lib, ... }: { - imports = - [ - ../../../../common/cpu/amd - ../../../../common/cpu/amd/pstate.nix - ../../../../common/gpu/amd - ../../../../common/pc/laptop - ../../../../common/pc/laptop/ssd - ]; + imports = [ + ../../../../common/cpu/amd + ../../../../common/cpu/amd/pstate.nix + ../../../../common/gpu/amd + ../../../../common/pc/laptop + ../../../../common/pc/ssd + ]; hardware.enableRedistributableFirmware = lib.mkDefault true; boot.kernelModules = [ "synaptics_usb" ]; - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") ( + lib.mkDefault pkgs.linuxPackages_latest + ); # disable Scatter/Gather APU recently enabled by default, # which results in white screen after display reconfiguration diff --git a/hp/elitebook/845/g8/default.nix b/hp/elitebook/845/g8/default.nix index 823bf40c..542921e0 100644 --- a/hp/elitebook/845/g8/default.nix +++ b/hp/elitebook/845/g8/default.nix @@ -1,18 +1,19 @@ { pkgs, lib, ... }: { - imports = - [ - ../../../../common/cpu/amd - ../../../../common/cpu/amd/pstate.nix - ../../../../common/gpu/amd - ../../../../common/pc/laptop - ../../../../common/pc/laptop/ssd - ]; + imports = [ + ../../../../common/cpu/amd + ../../../../common/cpu/amd/pstate.nix + ../../../../common/gpu/amd + ../../../../common/pc/laptop + ../../../../common/pc/ssd + ]; hardware.enableRedistributableFirmware = lib.mkDefault true; boot.kernelModules = [ "synaptics_usb" ]; - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") ( + lib.mkDefault pkgs.linuxPackages_latest + ); # disable Scatter/Gather APU recently enabled by default, # which results in white screen after display reconfiguration diff --git a/hp/elitebook/845/g9/default.nix b/hp/elitebook/845/g9/default.nix index 823bf40c..542921e0 100644 --- a/hp/elitebook/845/g9/default.nix +++ b/hp/elitebook/845/g9/default.nix @@ -1,18 +1,19 @@ { pkgs, lib, ... }: { - imports = - [ - ../../../../common/cpu/amd - ../../../../common/cpu/amd/pstate.nix - ../../../../common/gpu/amd - ../../../../common/pc/laptop - ../../../../common/pc/laptop/ssd - ]; + imports = [ + ../../../../common/cpu/amd + ../../../../common/cpu/amd/pstate.nix + ../../../../common/gpu/amd + ../../../../common/pc/laptop + ../../../../common/pc/ssd + ]; hardware.enableRedistributableFirmware = lib.mkDefault true; boot.kernelModules = [ "synaptics_usb" ]; - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") ( + lib.mkDefault pkgs.linuxPackages_latest + ); # disable Scatter/Gather APU recently enabled by default, # which results in white screen after display reconfiguration diff --git a/hp/laptop/14s-dq2024nf/default.nix b/hp/laptop/14s-dq2024nf/default.nix index acad2f55..f7a1a654 100644 --- a/hp/laptop/14s-dq2024nf/default.nix +++ b/hp/laptop/14s-dq2024nf/default.nix @@ -5,7 +5,7 @@ ../../../common/cpu/intel/tiger-lake ../../../common/pc ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; config = { diff --git a/hp/probook/440G5/default.nix b/hp/probook/440G5/default.nix index 7cc5a234..9bc0fc82 100644 --- a/hp/probook/440G5/default.nix +++ b/hp/probook/440G5/default.nix @@ -7,7 +7,7 @@ ../../../common/cpu/intel/kaby-lake ../../../common/pc ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; config = { diff --git a/huawei/machc-wa/default.nix b/huawei/machc-wa/default.nix index 9e3259d8..6279843d 100644 --- a/huawei/machc-wa/default.nix +++ b/huawei/machc-wa/default.nix @@ -3,7 +3,8 @@ pkgs, config, ... -}: { +}: +{ imports = [ ../../common/cpu/intel/comet-lake ../../common/gpu/nvidia diff --git a/kobol/helios4/modules/fancontrol.nix b/kobol/helios4/modules/fancontrol.nix index 27722765..3ab73a9d 100644 --- a/kobol/helios4/modules/fancontrol.nix +++ b/kobol/helios4/modules/fancontrol.nix @@ -19,7 +19,11 @@ services.udev.packages = [ # Fan control (pkgs.callPackage ( - { stdenv, lib, coreutils }: + { + stdenv, + lib, + coreutils, + }: stdenv.mkDerivation { name = "helios4-udev-fancontrol"; @@ -39,6 +43,6 @@ platforms = platforms.linux; }; } - ) {}) + ) { }) ]; } diff --git a/kobol/helios4/overlay.nix b/kobol/helios4/overlay.nix index 32262c56..1ffd02ff 100644 --- a/kobol/helios4/overlay.nix +++ b/kobol/helios4/overlay.nix @@ -11,6 +11,6 @@ final: _prev: { rev = "v${version}"; sha256 = "sha256-QxrTPcx0n0NWUJ990EuIWyOBtknW/fHDRcrYP0yQzTo="; }; - patches = []; + patches = [ ]; }; } diff --git a/lenovo/ideacentre/k330/default.nix b/lenovo/ideacentre/k330/default.nix index 381276fc..9639b738 100644 --- a/lenovo/ideacentre/k330/default.nix +++ b/lenovo/ideacentre/k330/default.nix @@ -1,19 +1,20 @@ { config, lib, ... }: { - imports = [ - ../../../common/cpu/intel - ../../../common/gpu/nvidia # Is it possible/advisable to pin this to the 390.xx driver family in case the user wants to use non-free drivers? - ../../../common/gpu/amd # The K330 could be bought with AMD GPUs but I don't have that configuration - ../../../common/pc - ]; + imports = [ + ../../../common/cpu/intel + ../../../common/gpu/nvidia/fermi # Is it possible/advisable to pin this to the 390.xx driver family in case the user wants to use non-free drivers? + ../../../common/gpu/amd # The K330 could be bought with AMD GPUs but I don't have that configuration + ../../../common/pc + ]; - # On my machine Wayland causes the desktop to freeze after a short time of operation - services.displayManager.sddm.wayland.enable = false; + # On my machine Wayland causes the desktop to freeze after a short time of operation + services.displayManager.sddm.wayland.enable = false; - # Should this be a conditional default in case plasma is activated? - # What if somebody installs both plasma AND another DE? - # The goal is to prefer x11 over wayland due to compatibility issues with the old hardware + # Should this be a conditional default in case plasma is activated? + # What if somebody installs both plasma AND another DE? + # The goal is to prefer x11 over wayland due to compatibility issues with the old hardware - - services.displayManager.defaultSession = lib.mkIf config.services.xserver.desktopManager.plasma6.enable (lib.mkDefault "plasmax11"); -} \ No newline at end of file + services.displayManager.defaultSession = lib.mkIf config.services.xserver.desktopManager.plasma6.enable ( + lib.mkDefault "plasmax11" + ); +} diff --git a/lenovo/ideapad/14imh9/README.md b/lenovo/ideapad/14imh9/README.md new file mode 100644 index 00000000..f3950701 --- /dev/null +++ b/lenovo/ideapad/14imh9/README.md @@ -0,0 +1,16 @@ +# Lenovo Ideapad 5 Pro 14IMH9 / XiaoXin Pro 14IMH9 2024 + +These devices support Conservation mode which charges the battery to 79/80%. See [TLP docs](https://linrunner.de/tlp/settings/bc-vendors.html#lenovo-non-thinkpad-series) and [auto-cpu freq](https://github.com/AdnanHodzic/auto-cpufreq?tab=readme-ov-file#battery-charging-thresholds) to enable it. + +`lspci`: +``` +00:02.0 VGA compatible controller: Intel Corporation Meteor Lake-P [Intel Arc Graphics] (rev 08) +``` +There is no dedicated graphics card. See specs [here](https://psref.lenovo.com/syspool/Sys/PDF/IdeaPad/IdeaPad_Pro_5_14IMH9/IdeaPad_Pro_5_14IMH9_Spec.pdf). + +## Extra Configuration +### Bluetooth +To enable bluetooth support, set `hardware.bluetooth.enable = true;`. + +### Sound +This laptop need extra firmware for hi-quality sound. To enable that, set `hardware.firmware = [ pkgs.sof-firmware ];`. \ No newline at end of file diff --git a/lenovo/ideapad/14imh9/default.nix b/lenovo/ideapad/14imh9/default.nix new file mode 100644 index 00000000..f2bb0f52 --- /dev/null +++ b/lenovo/ideapad/14imh9/default.nix @@ -0,0 +1,110 @@ +{ lib, pkgs, ... }: + +{ + imports = [ + ../../../common/cpu/intel/meteor-lake + ../../../common/pc/laptop + ../../../common/pc/ssd + ]; + + boot = { + # Workaround: Out of the box, resuming from hibernation will break sounds. + # See https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/766 + extraModprobeConfig = '' + options snd-hda-intel model=generic + options snd-hda-intel snd-intel-dspcfg.dsp_driver=1 + blacklist snd_soc_skl + ''; + + kernelParams = [ + # Workaround: i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe A + # See https://www.dedoimedo.com/computers/intel-microcode-atomic-update.html + "i915.enable_psr=0" + + # Workaround: Seems like guc on VT-d is faulty and may also cause GUC: TLB invalidation response timed out. + # It will cause random gpu resets under hw video decoding. + # See https://wiki.archlinux.org/title/Dell_XPS_16_(9640)#Random_freezes + "iommu.strict=1" + "iommu.passthrough=1" + ]; + }; + + environment.variables = { + # Workaround: GPU HANG: ecode 12:1:85dffdfb, in CanvasRenderer [4408] + # See https://gitlab.freedesktop.org/mesa/mesa/-/issues/7755 + INTEL_DEBUG = "no32"; + }; + + systemd = { + # Workaround: Sometimes xhci driver will become malfunctional after resuming from hibernate / suspend. + # This will cause (almost) all external devices stop working. + # A simple reset is enough to bring external devices alive :) + # + # Note: to avoid unnecessary resets, we firstly check if integrated camera is presented + # (Should always be there as it was built into machine!). + # If not, just do the reset. + services.workaround-reset-xhci-driver-after-resume-if-needed = { + script = '' + result=$(${pkgs.usbutils}/bin/lsusb | ${pkgs.gnugrep}/bin/grep Chicony) + if [[ -z $result ]]; then + ${pkgs.kmod}/bin/rmmod xhci_pci xhci_hcd + ${pkgs.kmod}/bin/modprobe xhci_pci xhci_hcd + fi + ''; + after = [ + "suspend.target" + "hibernate.target" + "hybrid-sleep.target" + ]; + wantedBy = [ + "suspend.target" + "hibernate.target" + "hybrid-sleep.target" + "multi-user.target" + ]; + }; + + # Workaround: Lenovo seems write bad acpi power management firmware. Without this config, + # suspend (to ram / disk) will simply reboot instead of power off. :( + sleep.extraConfig = '' + HibernateMode=shutdown + ''; + }; + + # TPM2 module + security.tpm2.enable = lib.mkDefault true; + + hardware = { + enableRedistributableFirmware = lib.mkDefault true; # WiFi + + # Workaround: Lenovo wrote bad screen edid firmware that will cause system + # not able to use 120Hz screen fresh rate. + # Manually patch it with correct value fixes this problem. + # + # TODO: This laptop actually support VRR (Variable refresh rate). + # But I do not have any interests in supporting this. + # PR is welecomed :) + display = { + edid.packages = [ + (pkgs.runCommand "edid-14imh9" { } '' + mkdir -p "$out/lib/firmware/edid" + base64 -d > "$out/lib/firmware/edid/14imh9.bin" <<'EOF' + AP///////wAObxYUAAAAAAAgAQS1HhN4AyEVqFNJnCUPUFQAAAABAQEBAQEBAQEBAQEBAQEBzodAoLAIanAwIDYALbwQAAAYAAAA/QAoeOXlRgEKICAgICAgAAAA/gBDU09UIFQzCiAgICAgAAAA/gBNTkUwMDdaQTEtNQogAa9wE3kAAAMBFJoPAQU/C58ALwAfAAcHaQACAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4kA== + EOF + '') + ]; + + outputs = { + "eDP-1".edid = "14imh9.bin"; + }; + }; + + i2c.enable = lib.mkDefault true; # Touchpad + }; + + services = { + fwupd.enable = lib.mkDefault true; # Firmware Upgrades. Partially supported. + hardware.bolt.enable = lib.mkDefault true; # Thunderbolt + thermald.enable = lib.mkDefault true; # This will save you money and possibly your life! + }; +} diff --git a/lenovo/ideapad/15ach6/default.nix b/lenovo/ideapad/15ach6/default.nix index e86fee90..35527a01 100644 --- a/lenovo/ideapad/15ach6/default.nix +++ b/lenovo/ideapad/15ach6/default.nix @@ -8,7 +8,7 @@ ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/turing ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; hardware.nvidia = { diff --git a/lenovo/ideapad/15alc6/default.nix b/lenovo/ideapad/15alc6/default.nix index 386f2720..31a8b390 100644 --- a/lenovo/ideapad/15alc6/default.nix +++ b/lenovo/ideapad/15alc6/default.nix @@ -5,6 +5,6 @@ ../../../common/cpu/amd ../../../common/gpu/amd ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; } diff --git a/lenovo/ideapad/15arh05/default.nix b/lenovo/ideapad/15arh05/default.nix index f021a2d6..a4ff8df1 100644 --- a/lenovo/ideapad/15arh05/default.nix +++ b/lenovo/ideapad/15arh05/default.nix @@ -6,7 +6,7 @@ ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/turing ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Specify bus id of Nvidia and Intel graphics. diff --git a/lenovo/ideapad/16ach6/default.nix b/lenovo/ideapad/16ach6/default.nix index aeec3298..246b35ea 100644 --- a/lenovo/ideapad/16ach6/default.nix +++ b/lenovo/ideapad/16ach6/default.nix @@ -8,7 +8,7 @@ ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/turing ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; hardware.nvidia = { diff --git a/lenovo/ideapad/16ahp9/default.nix b/lenovo/ideapad/16ahp9/default.nix index f83290e2..5a6acd06 100644 --- a/lenovo/ideapad/16ahp9/default.nix +++ b/lenovo/ideapad/16ahp9/default.nix @@ -6,6 +6,6 @@ ../../../common/cpu/amd/pstate.nix ../../../common/gpu/amd ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; } diff --git a/lenovo/ideapad/16iah8/default.nix b/lenovo/ideapad/16iah8/default.nix index 1f71aed2..ee899fc5 100644 --- a/lenovo/ideapad/16iah8/default.nix +++ b/lenovo/ideapad/16iah8/default.nix @@ -4,6 +4,6 @@ imports = [ ../../../common/cpu/intel/alder-lake ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; } diff --git a/lenovo/ideapad/slim-5/default.nix b/lenovo/ideapad/slim-5/default.nix index 02173bd4..202d2c85 100644 --- a/lenovo/ideapad/slim-5/default.nix +++ b/lenovo/ideapad/slim-5/default.nix @@ -3,6 +3,6 @@ ../../../common/cpu/amd ../../../common/gpu/amd ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; } diff --git a/lenovo/legion/15ach6/default.nix b/lenovo/legion/15ach6/default.nix index 0166a5fe..6c890105 100644 --- a/lenovo/legion/15ach6/default.nix +++ b/lenovo/legion/15ach6/default.nix @@ -7,7 +7,7 @@ ../../../common/gpu/nvidia/ampere ../../../common/hidpi.nix ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; hardware.nvidia.prime = { diff --git a/lenovo/legion/15ach6h/README.md b/lenovo/legion/15ach6h/README.md index 19f6c247..63f4e97f 100644 --- a/lenovo/legion/15ach6h/README.md +++ b/lenovo/legion/15ach6h/README.md @@ -1,7 +1,7 @@ ## Introduction -Due to the introduction of DDG feature, you may toggle DDG frequently, so for the default settings of this laptop, we use "specialization" feature of Nix so that you can easily select the required graphics card driver in the startup menu. +Due to the introduction of Dual-Direct-GFX-Mode feature, you may toggle Dual-Direct-GFX-Mode frequently, so for the default settings of this laptop, we use "specialization" feature of Nix so that you can easily select the required graphics card driver in the startup menu. **But It will slow down NixOS evaluation by factor 2 and increase memory usage.** -So if you don't need specialization feature, you can just use hybrid only configuration or nvidia only (DDG only) configuration +So if you don't need specialization feature, you can just use hybrid only configuration or nvidia only (Dual-Direct-GFX-Mode only) configuration ## Using multiple drives with this configuration @@ -27,4 +27,4 @@ $ nix-info -m ... 06:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne (rev c5) ... -``` \ No newline at end of file +``` diff --git a/lenovo/legion/15ach6h/hybrid/default.nix b/lenovo/legion/15ach6h/hybrid/default.nix index 044d088b..7fa179ce 100644 --- a/lenovo/legion/15ach6h/hybrid/default.nix +++ b/lenovo/legion/15ach6h/hybrid/default.nix @@ -8,7 +8,7 @@ ../../../../common/gpu/nvidia/prime.nix ../../../../common/gpu/nvidia/ampere ../../../../common/pc/laptop - ../../../../common/pc/laptop/ssd + ../../../../common/pc/ssd ]; # Still needs to load at some point if we want X11 to work diff --git a/lenovo/legion/15ach6h/nvidia/default.nix b/lenovo/legion/15ach6h/nvidia/default.nix index 33f32652..37dd1148 100644 --- a/lenovo/legion/15ach6h/nvidia/default.nix +++ b/lenovo/legion/15ach6h/nvidia/default.nix @@ -10,10 +10,12 @@ # remove all packages for amd igpu. I only removed amdgpu from # services.xserver.videoDrivers by overriding. This is because the specialization # of nix cannot implement such an operation as canceling an import. - hardware = { - nvidia.prime.offload.enable = false; - } // lib.optionalAttrs (options ? amdgpu.opencl.enable) { - # introduced in https://github.com/NixOS/nixpkgs/pull/319865 - amdgpu.opencl.enable = lib.mkDefault false; - }; + hardware = + { + nvidia.prime.offload.enable = false; + } + // lib.optionalAttrs (options ? amdgpu.opencl.enable) { + # introduced in https://github.com/NixOS/nixpkgs/pull/319865 + amdgpu.opencl.enable = lib.mkDefault false; + }; } diff --git a/lenovo/legion/15arh05h/default.nix b/lenovo/legion/15arh05h/default.nix index bfff924a..554ad8ff 100644 --- a/lenovo/legion/15arh05h/default.nix +++ b/lenovo/legion/15arh05h/default.nix @@ -6,7 +6,7 @@ ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/turing ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Specify bus id of Nvidia and Intel graphics. diff --git a/lenovo/legion/15ich/default.nix b/lenovo/legion/15ich/default.nix index 8aaffff8..881e7bce 100644 --- a/lenovo/legion/15ich/default.nix +++ b/lenovo/legion/15ich/default.nix @@ -2,11 +2,11 @@ { imports = [ - ../../../common/cpu/intel + ../../../common/cpu/intel/coffee-lake ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/pascal ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../../common/pc/laptop/hdd ]; diff --git a/lenovo/legion/16ach6h/hybrid/default.nix b/lenovo/legion/16ach6h/hybrid/default.nix index 28a68ba1..e987ecd5 100644 --- a/lenovo/legion/16ach6h/hybrid/default.nix +++ b/lenovo/legion/16ach6h/hybrid/default.nix @@ -9,7 +9,7 @@ ../../../../common/gpu/nvidia/prime.nix ../../../../common/gpu/nvidia/ampere ../../../../common/pc/laptop - ../../../../common/pc/laptop/ssd + ../../../../common/pc/ssd ../edid ]; diff --git a/lenovo/legion/16ach6h/nvidia/default.nix b/lenovo/legion/16ach6h/nvidia/default.nix index 33f32652..37dd1148 100644 --- a/lenovo/legion/16ach6h/nvidia/default.nix +++ b/lenovo/legion/16ach6h/nvidia/default.nix @@ -10,10 +10,12 @@ # remove all packages for amd igpu. I only removed amdgpu from # services.xserver.videoDrivers by overriding. This is because the specialization # of nix cannot implement such an operation as canceling an import. - hardware = { - nvidia.prime.offload.enable = false; - } // lib.optionalAttrs (options ? amdgpu.opencl.enable) { - # introduced in https://github.com/NixOS/nixpkgs/pull/319865 - amdgpu.opencl.enable = lib.mkDefault false; - }; + hardware = + { + nvidia.prime.offload.enable = false; + } + // lib.optionalAttrs (options ? amdgpu.opencl.enable) { + # introduced in https://github.com/NixOS/nixpkgs/pull/319865 + amdgpu.opencl.enable = lib.mkDefault false; + }; } diff --git a/lenovo/legion/16achg6/hybrid/default.nix b/lenovo/legion/16achg6/hybrid/default.nix index fa69491b..f61c4307 100644 --- a/lenovo/legion/16achg6/hybrid/default.nix +++ b/lenovo/legion/16achg6/hybrid/default.nix @@ -7,7 +7,7 @@ ../../../../common/gpu/amd ../../../../common/gpu/nvidia/prime.nix ../../../../common/pc/laptop - ../../../../common/pc/laptop/ssd + ../../../../common/pc/ssd ]; services.xserver.videoDrivers = [ "nvidia" ]; @@ -25,4 +25,4 @@ }; }; }; -} \ No newline at end of file +} diff --git a/lenovo/legion/16achg6/nvidia/default.nix b/lenovo/legion/16achg6/nvidia/default.nix index 5c933fad..d279b6a2 100644 --- a/lenovo/legion/16achg6/nvidia/default.nix +++ b/lenovo/legion/16achg6/nvidia/default.nix @@ -3,10 +3,12 @@ { imports = [ ../hybrid ]; services.xserver.videoDrivers = [ "nvidia" ]; - hardware = { - nvidia.prime.offload.enable = false; - } // lib.optionalAttrs (options ? amdgpu.opencl.enable) { - # introduced in https://github.com/NixOS/nixpkgs/pull/319865 - amdgpu.opencl.enable = lib.mkDefault false; - }; + hardware = + { + nvidia.prime.offload.enable = false; + } + // lib.optionalAttrs (options ? amdgpu.opencl.enable) { + # introduced in https://github.com/NixOS/nixpkgs/pull/319865 + amdgpu.opencl.enable = lib.mkDefault false; + }; } diff --git a/lenovo/legion/16aph8/default.nix b/lenovo/legion/16aph8/default.nix index 4718cd3d..5771d65b 100644 --- a/lenovo/legion/16aph8/default.nix +++ b/lenovo/legion/16aph8/default.nix @@ -7,27 +7,27 @@ ../../../common/gpu/amd ../../../common/gpu/nvidia ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Use latest LTS kernel for more Raphael fixes boot = lib.mkMerge [ (lib.mkIf (lib.versionOlder pkgs.linux.version "6.6") { kernelPackages = pkgs.linuxPackages_latest; - kernelParams = ["amdgpu.sg_display=0"]; + kernelParams = [ "amdgpu.sg_display=0" ]; }) ]; hardware.nvidia = { - modesetting.enable = lib.mkDefault true; - powerManagement.enable = lib.mkDefault false; - powerManagement.finegrained = lib.mkDefault false; - open = lib.mkDefault false; - prime = { - sync.enable = lib.mkDefault true; - amdgpuBusId = "PCI:5:0:0"; - nvidiaBusId = "PCI:1:0:0"; - }; + modesetting.enable = lib.mkDefault true; + powerManagement.enable = lib.mkDefault false; + powerManagement.finegrained = lib.mkDefault false; + open = lib.mkDefault false; + prime = { + sync.enable = lib.mkDefault true; + amdgpuBusId = "PCI:5:0:0"; + nvidiaBusId = "PCI:1:0:0"; + }; }; # Avoid issues with modesetting causing blank screen diff --git a/lenovo/legion/16arh7h/README.md b/lenovo/legion/16arh7h/README.md new file mode 100644 index 00000000..0258d495 --- /dev/null +++ b/lenovo/legion/16arh7h/README.md @@ -0,0 +1,4 @@ +# Useful Links + +[NixOS Wiki - Nvidia](https://wiki.nixos.org/wiki/NVIDIA) + diff --git a/lenovo/legion/16arh7h/hybrid/default.nix b/lenovo/legion/16arh7h/hybrid/default.nix new file mode 100644 index 00000000..336cd4bd --- /dev/null +++ b/lenovo/legion/16arh7h/hybrid/default.nix @@ -0,0 +1,36 @@ +{ + config, + lib, + ... +}: +{ + imports = [ + ../../../../common/cpu/amd + ../../../../common/cpu/amd/pstate.nix + ../../../../common/gpu/nvidia/prime.nix # prime offload + ../../../../common/gpu/nvidia/ampere # use open drivers + ../../../../common/pc/laptop + ../../../../common/pc/ssd + ]; + + boot.kernelModules = [ "amdgpu" ]; + services.xserver.videoDrivers = [ + "amdgpu" + "nvidia" + ]; + + hardware = { + amdgpu.initrd.enable = false; + + nvidia = { + package = config.boot.kernelPackages.nvidiaPackages.latest; + modesetting.enable = lib.mkDefault true; + powerManagement.enable = lib.mkDefault true; + powerManagement.finegrained = lib.mkDefault true; + prime = { + amdgpuBusId = lib.mkDefault "PCI:52:0:0"; # Hexadecimal 34:00.0 + nvidiaBusId = lib.mkDefault "PCI:1:0:0"; # Hexadecimal 01:00.0 + }; + }; + }; +} diff --git a/lenovo/legion/16arh7h/igpu-only/default.nix b/lenovo/legion/16arh7h/igpu-only/default.nix new file mode 100644 index 00000000..24de7ddf --- /dev/null +++ b/lenovo/legion/16arh7h/igpu-only/default.nix @@ -0,0 +1,12 @@ +# This will enable only the integrated AMD GPU, while disabling the dedicated Nvidia GPU +{ ... }: +{ + imports = [ + ../../../../common/cpu/amd + ../../../../common/cpu/amd/pstate.nix + ../../../../common/gpu/amd + ../../../../common/gpu/nvidia/disable.nix + ../../../../common/pc/laptop + ../../../../common/pc/ssd + ]; +} diff --git a/lenovo/legion/16arha7/audio/lenovo-16ARHA7_speaker-fix.nix b/lenovo/legion/16arha7/audio/lenovo-16ARHA7_speaker-fix.nix index 3e163b6b..40843b0d 100644 --- a/lenovo/legion/16arha7/audio/lenovo-16ARHA7_speaker-fix.nix +++ b/lenovo/legion/16arha7/audio/lenovo-16ARHA7_speaker-fix.nix @@ -1,9 +1,18 @@ # Patch sourced from https://github.com/christian-bendiksen/kernel-6.8.0-63.16ARHA7.fc40 -{ pkgs, lib, kernel ? pkgs.linuxPackages_latest.kernel }: +{ + pkgs, + lib, + kernel ? pkgs.linuxPackages_latest.kernel, +}: pkgs.stdenv.mkDerivation { pname = "lenovo-16ARHA7-speaker-fix-module"; - inherit (kernel) src version postPatch nativeBuildInputs; + inherit (kernel) + src + version + postPatch + nativeBuildInputs + ; kernel_dev = kernel.dev; kernelVersion = kernel.modDirVersion; @@ -29,10 +38,10 @@ pkgs.stdenv.mkDerivation { modules_install ''; - patches = [ ./lenovo_16ARHA7_sound_fix.patch ]; + patches = [ ./lenovo_16ARHA7_sound_fix.patch ]; meta = { description = "Patch to get the speakers working for Lenovo Legion Slim 7 Gen 7 AMD (16ARHA7)"; license = lib.licenses.gpl3; }; -} \ No newline at end of file +} diff --git a/lenovo/legion/16arha7/default.nix b/lenovo/legion/16arha7/default.nix index 8c258d58..39fcc6be 100644 --- a/lenovo/legion/16arha7/default.nix +++ b/lenovo/legion/16arha7/default.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let lenovo-speaker-fix = pkgs.callPackage ./audio/lenovo-16ARHA7_speaker-fix.nix { @@ -11,12 +16,14 @@ in ../../../common/cpu/amd/pstate.nix ../../../common/gpu/amd ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Kernel 6.10 includes the speaker fix, so only install this on systems with older kernels. - boot.extraModulePackages = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.10") [ lenovo-speaker-fix ]; - + boot.extraModulePackages = + lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.10") + [ lenovo-speaker-fix ]; + # √(2560² + 1600²) px / 16 in ≃ 189 dpi services.xserver.dpi = 189; diff --git a/lenovo/legion/16iah7h/default.nix b/lenovo/legion/16iah7h/default.nix new file mode 100644 index 00000000..93df9d23 --- /dev/null +++ b/lenovo/legion/16iah7h/default.nix @@ -0,0 +1,32 @@ +{ + lib, + config, + ... +}: +{ + imports = [ + ../../../common/cpu/intel + ../../../common/gpu/nvidia/prime.nix + ../../../common/gpu/nvidia/ampere + ../../../common/pc/laptop + ../../../common/pc/ssd + ../../../common/hidpi.nix + ]; + + boot.extraModulePackages = [ config.boot.kernelPackages.lenovo-legion-module ]; + + hardware = { + nvidia = { + powerManagement.enable = lib.mkDefault true; + + prime = { + intelBusId = "PCI:00:02:0"; + nvidiaBusId = "PCI:01:00:0"; + }; + }; + }; + + services.thermald.enable = lib.mkDefault true; + + services.xserver.dpi = 189; +} diff --git a/lenovo/legion/16irx8h/default.nix b/lenovo/legion/16irx8h/default.nix index 6d9c772c..c39d8d46 100644 --- a/lenovo/legion/16irx8h/default.nix +++ b/lenovo/legion/16irx8h/default.nix @@ -2,18 +2,22 @@ lib, config, ... -}: { +}: +{ imports = [ ../../../common/cpu/intel ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/ada-lovelace ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../../common/hidpi.nix ]; - boot.initrd.kernelModules = ["nvidia"]; - boot.extraModulePackages = [config.boot.kernelPackages.lenovo-legion-module config.boot.kernelPackages.nvidia_x11]; + boot.initrd.kernelModules = [ "nvidia" ]; + boot.extraModulePackages = [ + config.boot.kernelPackages.lenovo-legion-module + config.boot.kernelPackages.nvidia_x11 + ]; hardware = { nvidia = { diff --git a/lenovo/legion/16irx9h/default.nix b/lenovo/legion/16irx9h/default.nix index f96bc51b..877d31f7 100644 --- a/lenovo/legion/16irx9h/default.nix +++ b/lenovo/legion/16irx9h/default.nix @@ -2,17 +2,18 @@ lib, config, ... -}: { +}: +{ imports = [ ../../../common/cpu/intel ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/ada-lovelace ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../../common/hidpi.nix ]; - boot.extraModulePackages = [config.boot.kernelPackages.lenovo-legion-module]; + boot.extraModulePackages = [ config.boot.kernelPackages.lenovo-legion-module ]; hardware = { nvidia = { diff --git a/lenovo/legion/16ithg6/default.nix b/lenovo/legion/16ithg6/default.nix index 9d6c292f..a0ee3a76 100644 --- a/lenovo/legion/16ithg6/default.nix +++ b/lenovo/legion/16ithg6/default.nix @@ -6,7 +6,7 @@ ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/ampere ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../../common/hidpi.nix ]; diff --git a/lenovo/thinkpad/a475/default.nix b/lenovo/thinkpad/a475/default.nix index dc89dc12..7a4f68cc 100644 --- a/lenovo/thinkpad/a475/default.nix +++ b/lenovo/thinkpad/a475/default.nix @@ -10,6 +10,8 @@ ../. ]; - boot.kernelParams = [ "i8042.nomux=1" "i8042.reset" ]; # Fix trackpoint and touchpad working only after reboot + boot.kernelParams = [ + "i8042.nomux=1" + "i8042.reset" + ]; # Fix trackpoint and touchpad working only after reboot } - diff --git a/lenovo/thinkpad/e14/default.nix b/lenovo/thinkpad/e14/default.nix index c6948b35..85c83e17 100644 --- a/lenovo/thinkpad/e14/default.nix +++ b/lenovo/thinkpad/e14/default.nix @@ -3,7 +3,7 @@ { imports = [ ../. - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; boot.kernelParams = [ diff --git a/lenovo/thinkpad/e14/intel/default.nix b/lenovo/thinkpad/e14/intel/default.nix index 64d2f177..57252205 100644 --- a/lenovo/thinkpad/e14/intel/default.nix +++ b/lenovo/thinkpad/e14/intel/default.nix @@ -3,7 +3,7 @@ { imports = [ ../. - ../../../../common/cpu/intel + ../../../../common/cpu/intel/comet-lake ]; services.throttled.enable = lib.mkDefault true; diff --git a/lenovo/thinkpad/e14/intel/gen4/default.nix b/lenovo/thinkpad/e14/intel/gen4/default.nix new file mode 100644 index 00000000..c79cf8bb --- /dev/null +++ b/lenovo/thinkpad/e14/intel/gen4/default.nix @@ -0,0 +1,11 @@ +{ lib, ... }: + +{ + imports = [ + ../../. + ../../../../../common/cpu/intel/alder-lake + ]; + + services.throttled.enable = lib.mkDefault false; + hardware.intelgpu.driver = "xe"; +} diff --git a/lenovo/thinkpad/e14/intel/gen6/default.nix b/lenovo/thinkpad/e14/intel/gen6/default.nix new file mode 100644 index 00000000..2e4505dd --- /dev/null +++ b/lenovo/thinkpad/e14/intel/gen6/default.nix @@ -0,0 +1,10 @@ +{ lib, ... }: + +{ + imports = [ + ../../. + ../../../../../common/cpu/intel/meteor-lake + ]; + + services.throttled.enable = lib.mkDefault false; +} diff --git a/lenovo/thinkpad/e15/README.md b/lenovo/thinkpad/e15/README.md new file mode 100644 index 00000000..879bfa9f --- /dev/null +++ b/lenovo/thinkpad/e15/README.md @@ -0,0 +1,45 @@ +# Lenovo Thinkpad E15 + +This is tested on an [E15 Gen4](https://psref.lenovo.com/WDProduct/ThinkPad/ThinkPad_E15_Gen_4_Intel). + +## Tested Hardware + +```bash +lspci -nn +00:00.0 Host bridge [0600]: Intel Corporation Alder Lake-U15 Host and DRAM Controller [8086:4601] (rev 04) +00:02.0 VGA compatible controller [0300]: Intel Corporation Alder Lake-UP3 GT2 [Iris Xe Graphics] [8086:46a8] (rev 0c) +00:04.0 Signal processing controller [1180]: Intel Corporation Alder Lake Innovation Platform Framework Processor Participant [8086:461d] (rev 04) +00:06.0 PCI bridge [0604]: Intel Corporation 12th Gen Core Processor PCI Express x4 Controller #0 [8086:464d] (rev 04) +00:07.0 PCI bridge [0604]: Intel Corporation Alder Lake-P Thunderbolt 4 PCI Express Root Port #0 [8086:466e] (rev 04) +00:08.0 System peripheral [0880]: Intel Corporation 12th Gen Core Processor Gaussian & Neural Accelerator [8086:464f] (rev 04) +00:0a.0 Signal processing controller [1180]: Intel Corporation Platform Monitoring Technology [8086:467d] (rev 01) +00:0d.0 USB controller [0c03]: Intel Corporation Alder Lake-P Thunderbolt 4 USB Controller [8086:461e] (rev 04) +00:0d.2 USB controller [0c03]: Intel Corporation Alder Lake-P Thunderbolt 4 NHI #0 [8086:463e] (rev 04) +00:0d.3 USB controller [0c03]: Intel Corporation Alder Lake-P Thunderbolt 4 NHI #1 [8086:466d] (rev 04) +00:14.0 USB controller [0c03]: Intel Corporation Alder Lake PCH USB 3.2 xHCI Host Controller [8086:51ed] (rev 01) +00:14.2 RAM memory [0500]: Intel Corporation Alder Lake PCH Shared SRAM [8086:51ef] (rev 01) +00:14.3 Network controller [0280]: Intel Corporation Alder Lake-P PCH CNVi WiFi [8086:51f0] (rev 01) +00:15.0 Serial bus controller [0c80]: Intel Corporation Alder Lake PCH Serial IO I2C Controller #0 [8086:51e8] (rev 01) +00:15.2 Serial bus controller [0c80]: Intel Corporation Alder Lake PCH Serial IO I2C Controller #2 [8086:51ea] (rev 01) +00:16.0 Communication controller [0780]: Intel Corporation Alder Lake PCH HECI Controller [8086:51e0] (rev 01) +00:1f.0 ISA bridge [0601]: Intel Corporation Alder Lake PCH eSPI Controller [8086:5182] (rev 01) +00:1f.3 Multimedia audio controller [0401]: Intel Corporation Alder Lake PCH-P High Definition Audio Controller [8086:51c8] (rev 01) +00:1f.4 SMBus [0c05]: Intel Corporation Alder Lake PCH-P SMBus Host Controller [8086:51a3] (rev 01) +00:1f.5 Serial bus controller [0c80]: Intel Corporation Alder Lake-P PCH SPI Controller [8086:51a4] (rev 01) +00:1f.6 Ethernet controller [0200]: Intel Corporation Ethernet Connection (16) I219-V [8086:1a1f] (rev 01) +01:00.0 Non-Volatile memory controller [0108]: Sandisk Corp WD PC SN740 NVMe SSD 512GB (DRAM-less) [15b7:5016] (rev 01) +``` + +## Updating Firmware + +First enable `fwupd` in your config + +```nix +services.fwupd.enable = true; +``` + +Then run + +```bash + $ fwupdmgr update +``` diff --git a/lenovo/thinkpad/e15/default.nix b/lenovo/thinkpad/e15/default.nix new file mode 100644 index 00000000..a54db80e --- /dev/null +++ b/lenovo/thinkpad/e15/default.nix @@ -0,0 +1,15 @@ +{ ... }: + +{ + imports = [ + ../. + ../../../common/pc/laptop + ../../../common/pc/ssd + ]; + + boot.kernelParams = [ + # Force use of the thinkpad_acpi driver for backlight control. + # This allows the backlight save/load systemd service to work. + "acpi_backlight=native" + ]; +} diff --git a/lenovo/thinkpad/e15/intel/default.nix b/lenovo/thinkpad/e15/intel/default.nix new file mode 100644 index 00000000..3aeee392 --- /dev/null +++ b/lenovo/thinkpad/e15/intel/default.nix @@ -0,0 +1,10 @@ +{ lib, ... }: + +{ + imports = [ + ../. + ../../../../common/cpu/intel/alder-lake + ]; + + services.throttled.enable = lib.mkDefault true; +} diff --git a/lenovo/thinkpad/l13/default.nix b/lenovo/thinkpad/l13/default.nix index dcf9a572..2ee6567a 100644 --- a/lenovo/thinkpad/l13/default.nix +++ b/lenovo/thinkpad/l13/default.nix @@ -2,7 +2,7 @@ { imports = [ ../../../common/cpu/intel - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../. ]; diff --git a/lenovo/thinkpad/l14/default.nix b/lenovo/thinkpad/l14/default.nix index a59ec14c..d33b4bfa 100644 --- a/lenovo/thinkpad/l14/default.nix +++ b/lenovo/thinkpad/l14/default.nix @@ -1,7 +1,7 @@ { imports = [ ../. - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; boot.kernelParams = [ diff --git a/lenovo/thinkpad/l480/default.nix b/lenovo/thinkpad/l480/default.nix index d000320d..2568433c 100644 --- a/lenovo/thinkpad/l480/default.nix +++ b/lenovo/thinkpad/l480/default.nix @@ -3,7 +3,7 @@ imports = [ ../. ../../../common/cpu/intel/kaby-lake - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # available cpufreq governors: performance powersave diff --git a/lenovo/thinkpad/p1/3th-gen/audio.nix b/lenovo/thinkpad/p1/3th-gen/audio.nix index 8b6c854f..25baf545 100644 --- a/lenovo/thinkpad/p1/3th-gen/audio.nix +++ b/lenovo/thinkpad/p1/3th-gen/audio.nix @@ -1,7 +1,7 @@ { lib, pkgs, ... }: { # This can be removed when the default kernel is at least version 5.11 due to sof module - boot.kernelPackages = lib.mkIf - (lib.versionOlder pkgs.linux.version "5.11") - (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.11") ( + lib.mkDefault pkgs.linuxPackages_latest + ); } diff --git a/lenovo/thinkpad/p1/default.nix b/lenovo/thinkpad/p1/default.nix index f26e01b5..197bfab2 100644 --- a/lenovo/thinkpad/p1/default.nix +++ b/lenovo/thinkpad/p1/default.nix @@ -4,7 +4,7 @@ # might need nvidia module but we don't know the PCI ids: # https://github.com/NixOS/nixos-hardware/pull/274#discussion_r650483740 #../../../common/gpu/nvidia/prime.nix - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Need to set Thunderbolt to "BIOS Assist Mode" diff --git a/lenovo/thinkpad/p14s/amd/gen2/default.nix b/lenovo/thinkpad/p14s/amd/gen2/default.nix index 7c496f6e..b79e1cf3 100644 --- a/lenovo/thinkpad/p14s/amd/gen2/default.nix +++ b/lenovo/thinkpad/p14s/amd/gen2/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: { imports = [ ../. @@ -9,7 +14,9 @@ # amdgpu.backlight=0 makes the backlight work # acpi_backlight=none allows the backlight save/load systemd service to work on older kernel versions - boot.kernelParams = [ "amdgpu.backlight=0" ] ++ lib.optional (lib.versionOlder config.boot.kernelPackages.kernel.version "6.1.6") "acpi_backlight=none"; + boot.kernelParams = + [ "amdgpu.backlight=0" ] + ++ lib.optional (lib.versionOlder config.boot.kernelPackages.kernel.version "6.1.6") "acpi_backlight=none"; # For mainline support of rtw89 wireless networking boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") pkgs.linuxPackages_latest; diff --git a/lenovo/thinkpad/p14s/amd/gen4/default.nix b/lenovo/thinkpad/p14s/amd/gen4/default.nix index cc6244e7..1e9182b7 100644 --- a/lenovo/thinkpad/p14s/amd/gen4/default.nix +++ b/lenovo/thinkpad/p14s/amd/gen4/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: { imports = [ ../. diff --git a/lenovo/thinkpad/p14s/amd/gen5/default.nix b/lenovo/thinkpad/p14s/amd/gen5/default.nix new file mode 100644 index 00000000..f70dde41 --- /dev/null +++ b/lenovo/thinkpad/p14s/amd/gen5/default.nix @@ -0,0 +1,12 @@ +{ lib, pkgs, ... }: + +{ + imports = [ + ../. + ../../../../../common/cpu/amd/pstate.nix + ]; + + # For the Qualcomm NFA-725A (Device 1103) wireless network controller + # See https://bugzilla.redhat.com/show_bug.cgi?id=2047878 + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") pkgs.linuxPackages_latest; +} diff --git a/lenovo/thinkpad/p14s/default.nix b/lenovo/thinkpad/p14s/default.nix index edaeda86..78396d32 100644 --- a/lenovo/thinkpad/p14s/default.nix +++ b/lenovo/thinkpad/p14s/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { # P14s is a rebadged T14 with slight internal differences. @@ -6,7 +11,7 @@ imports = [ ../. - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Force use of the amdgpu driver for backlight control on kernel versions where the @@ -14,7 +19,9 @@ # "vendor" setting, in this case the thinkpad_acpi driver. # See https://hansdegoede.livejournal.com/27130.html # See https://lore.kernel.org/linux-acpi/20221105145258.12700-1-hdegoede@redhat.com/ - boot.kernelParams = lib.mkIf (lib.versionOlder pkgs.linux.version "6.2") [ "acpi_backlight=native" ]; + boot.kernelParams = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.2") [ + "acpi_backlight=native" + ]; # see https://github.com/NixOS/nixpkgs/issues/69289 boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.2") pkgs.linuxPackages_latest; diff --git a/lenovo/thinkpad/p14s/intel/gen5/default.nix b/lenovo/thinkpad/p14s/intel/gen5/default.nix new file mode 100644 index 00000000..49c3fc7c --- /dev/null +++ b/lenovo/thinkpad/p14s/intel/gen5/default.nix @@ -0,0 +1,19 @@ +{ lib, pkgs, ... }: + +{ + imports = [ + ../. + ../../../../../common/gpu/nvidia/prime.nix + ../../../../../common/gpu/nvidia/turing + ]; + + hardware = { + intelgpu.driver = "i915"; # xe driver may be used on newer kernels + nvidia = { + prime = { + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + }; + }; +} diff --git a/lenovo/thinkpad/p16s/amd/default.nix b/lenovo/thinkpad/p16s/amd/default.nix new file mode 100644 index 00000000..4dd23b34 --- /dev/null +++ b/lenovo/thinkpad/p16s/amd/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ../. + ../../../../common/cpu/amd + ../../../../common/gpu/amd + ]; +} diff --git a/lenovo/thinkpad/p16s/amd/gen2/default.nix b/lenovo/thinkpad/p16s/amd/gen2/default.nix new file mode 100644 index 00000000..665d3d41 --- /dev/null +++ b/lenovo/thinkpad/p16s/amd/gen2/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../. + ]; +} diff --git a/lenovo/thinkpad/p16s/default.nix b/lenovo/thinkpad/p16s/default.nix new file mode 100644 index 00000000..83a4942f --- /dev/null +++ b/lenovo/thinkpad/p16s/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ../. + ../../../common/pc/ssd + ]; +} diff --git a/lenovo/thinkpad/p16s/intel/default.nix b/lenovo/thinkpad/p16s/intel/default.nix new file mode 100644 index 00000000..665d3d41 --- /dev/null +++ b/lenovo/thinkpad/p16s/intel/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../. + ]; +} diff --git a/lenovo/thinkpad/p16s/intel/gen2/README.md b/lenovo/thinkpad/p16s/intel/gen2/README.md new file mode 100644 index 00000000..43ab342d --- /dev/null +++ b/lenovo/thinkpad/p16s/intel/gen2/README.md @@ -0,0 +1,40 @@ +# Lenovo Thinkpad P16s Gen 2 + +https://www.lenovo.com/us/en/p/laptops/thinkpad/thinkpadp/thinkpad-p16s-gen-2-16-inch-intel/len101t0065 + + +## Tested Hardware + +```shell +lspci -nn +00:00.0 Host bridge [0600]: Intel Corporation Raptor Lake-P/U 4p+8e cores Host Bridge/DRAM Controller [8086:a707] +00:02.0 VGA compatible controller [0300]: Intel Corporation Raptor Lake-P [Iris Xe Graphics] [8086:a7a0] (rev 04) +00:04.0 Signal processing controller [1180]: Intel Corporation Raptor Lake Dynamic Platform and Thermal Framework Processor Participant [8086:a71d] +00:06.0 PCI bridge [0604]: Intel Corporation Raptor Lake PCIe 4.0 Graphics Port [8086:a74d] +00:06.2 PCI bridge [0604]: Intel Corporation Device [8086:a73d] +00:07.0 PCI bridge [0604]: Intel Corporation Raptor Lake-P Thunderbolt 4 PCI Express Root Port #0 [8086:a76e] +00:07.2 PCI bridge [0604]: Intel Corporation Raptor Lake-P Thunderbolt 4 PCI Express Root Port #2 [8086:a72f] +00:0d.0 USB controller [0c03]: Intel Corporation Raptor Lake-P Thunderbolt 4 USB Controller [8086:a71e] +00:0d.2 USB controller [0c03]: Intel Corporation Raptor Lake-P Thunderbolt 4 NHI #0 [8086:a73e] +00:0d.3 USB controller [0c03]: Intel Corporation Raptor Lake-P Thunderbolt 4 NHI #1 [8086:a76d] +00:14.0 USB controller [0c03]: Intel Corporation Alder Lake PCH USB 3.2 xHCI Host Controller [8086:51ed] (rev 01) +00:14.2 RAM memory [0500]: Intel Corporation Alder Lake PCH Shared SRAM [8086:51ef] (rev 01) +00:14.3 Network controller [0280]: Intel Corporation Raptor Lake PCH CNVi WiFi [8086:51f1] (rev 01) +00:15.0 Serial bus controller [0c80]: Intel Corporation Alder Lake PCH Serial IO I2C Controller #0 [8086:51e8] (rev 01) +00:16.0 Communication controller [0780]: Intel Corporation Alder Lake PCH HECI Controller [8086:51e0] (rev 01) +00:1f.0 ISA bridge [0601]: Intel Corporation Raptor Lake LPC/eSPI Controller [8086:519d] (rev 01) +00:1f.3 Audio device [0403]: Intel Corporation Raptor Lake-P/U/H cAVS [8086:51ca] (rev 01) +00:1f.4 SMBus [0c05]: Intel Corporation Alder Lake PCH-P SMBus Host Controller [8086:51a3] (rev 01) +00:1f.5 Serial bus controller [0c80]: Intel Corporation Alder Lake-P PCH SPI Controller [8086:51a4] (rev 01) +00:1f.6 Ethernet controller [0200]: Intel Corporation Ethernet Connection (23) I219-V [8086:0dc6] (rev 01) +02:00.0 Non-Volatile memory controller [0108]: SK hynix Platinum P41/PC801 NVMe Solid State Drive [1c5c:1959] +03:00.0 3D controller [0302]: NVIDIA Corporation GA107GLM [RTX A500 Laptop GPU] [10de:25bb] (rev a1) + +nix-info -m + - system: `"x86_64-linux"` + - host os: `Linux 6.12.10-zen1, NixOS, 24.11 (Vicuna), 24.11.20250304.6af28b8` + - multi-user?: `yes` + - sandbox: `yes` + - version: `nix-env (Nix) 2.24.12` + - nixpkgs: `/nix/store/cdjqlnn7kx4hfmxkry9yjfdvqp2pradh-source` +``` diff --git a/lenovo/thinkpad/p16s/intel/gen2/default.nix b/lenovo/thinkpad/p16s/intel/gen2/default.nix new file mode 100644 index 00000000..299f07a3 --- /dev/null +++ b/lenovo/thinkpad/p16s/intel/gen2/default.nix @@ -0,0 +1,19 @@ +{ lib, ... }: +{ + imports = [ + ../. + ../../../../../common/cpu/intel/raptor-lake + ../../../../../common/gpu/intel/raptor-lake + ../../../../../common/gpu/nvidia/ampere + ../../../../../common/gpu/nvidia/prime.nix + ]; + + # DOCS https://wiki.nixos.org/wiki/NVIDIA#Offload_mode + hardware.nvidia.prime = { + intelBusId = lib.mkDefault "PCI:0:2:0"; + nvidiaBusId = lib.mkDefault "PCI:3:0:0"; + }; + + # HACK https://github.com/NVIDIA/open-gpu-kernel-modules/issues/472 + hardware.nvidia.open = lib.mkOverride 993 false; +} diff --git a/lenovo/thinkpad/p43s/README.md b/lenovo/thinkpad/p43s/README.md new file mode 100644 index 00000000..49c31923 --- /dev/null +++ b/lenovo/thinkpad/p43s/README.md @@ -0,0 +1,45 @@ +# Lenovo Thinkpad P43s + +[Product page](https://www.lenovo.com/us/en/p/laptops/thinkpad/thinkpadp/p43s/22ws2wpp43s) + +## Tested Hardware +```console +foo@bar:~$ lspci -nn +00:00.0 Host bridge [0600]: Intel Corporation Coffee Lake HOST and DRAM Controller [8086:3e34] (rev 0c) +00:02.0 VGA compatible controller [0300]: Intel Corporation WhiskeyLake-U GT2 [UHD Graphics 620] [8086:3ea0] (rev 02) +00:04.0 Signal processing controller [1180]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem [8086:1903] (rev 0c) +00:08.0 System peripheral [0880]: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model [8086:1911] +00:12.0 Signal processing controller [1180]: Intel Corporation Cannon Point-LP Thermal Controller [8086:9df9] (rev 30) +00:14.0 USB controller [0c03]: Intel Corporation Cannon Point-LP USB 3.1 xHCI Controller [8086:9ded] (rev 30) +00:14.2 RAM memory [0500]: Intel Corporation Cannon Point-LP Shared SRAM [8086:9def] (rev 30) +00:14.3 Network controller [0280]: Intel Corporation Cannon Point-LP CNVi [Wireless-AC] [8086:9df0] (rev 30) +00:15.0 Serial bus controller [0c80]: Intel Corporation Cannon Point-LP Serial IO I2C Controller #0 [8086:9de8] (rev 30) +00:16.0 Communication controller [0780]: Intel Corporation Cannon Point-LP MEI Controller #1 [8086:9de0] (rev 30) +00:16.3 Serial controller [0700]: Intel Corporation Cannon Point-LP Keyboard and Text (KT) Redirection [8086:9de3] (rev 30) +00:1c.0 PCI bridge [0604]: Intel Corporation Cannon Point-LP PCI Express Root Port #1 [8086:9db8] (rev f0) +00:1c.4 PCI bridge [0604]: Intel Corporation Cannon Point-LP PCI Express Root Port #5 [8086:9dbc] (rev f0) +00:1d.0 PCI bridge [0604]: Intel Corporation Cannon Point-LP PCI Express Root Port #9 [8086:9db0] (rev f0) +00:1d.4 PCI bridge [0604]: Intel Corporation Cannon Point-LP PCI Express Root Port #13 [8086:9db4] (rev f0) +00:1f.0 ISA bridge [0601]: Intel Corporation Cannon Point-LP LPC Controller [8086:9d84] (rev 30) +00:1f.3 Audio device [0403]: Intel Corporation Cannon Point-LP High Definition Audio Controller [8086:9dc8] (rev 30) +00:1f.4 SMBus [0c05]: Intel Corporation Cannon Point-LP SMBus Controller [8086:9da3] (rev 30) +00:1f.5 Serial bus controller [0c80]: Intel Corporation Cannon Point-LP SPI Controller [8086:9da4] (rev 30) +00:1f.6 Ethernet controller [0200]: Intel Corporation Ethernet Connection (6) I219-LM [8086:15bd] (rev 30) +01:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader [10ec:522a] (rev 01) +02:00.0 PCI bridge [0604]: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] [8086:15c0] (rev 01) +03:00.0 PCI bridge [0604]: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] [8086:15c0] (rev 01) +03:01.0 PCI bridge [0604]: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] [8086:15c0] (rev 01) +03:02.0 PCI bridge [0604]: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] [8086:15c0] (rev 01) +04:00.0 System peripheral [0880]: Intel Corporation JHL6240 Thunderbolt 3 NHI (Low Power) [Alpine Ridge LP 2016] [8086:15bf] (rev 01) +3a:00.0 USB controller [0c03]: Intel Corporation JHL6240 Thunderbolt 3 USB 3.1 Controller (Low Power) [Alpine Ridge LP 2016] [8086:15c1] (rev 01) +3c:00.0 3D controller [0302]: NVIDIA Corporation GP108GLM [Quadro P520] [10de:1d34] (rev a1) +3d:00.0 Non-Volatile memory controller [0108]: SK hynix PC601 NVMe Solid State Drive [1c5c:1627] +``` + +## Tested Nix Configuration + - system: `"x86_64-linux"` + - host os: `Linux 6.12.18, NixOS, 25.05 (Warbler), 25.05.20250309.e3e32b6` + - multi-user?: `yes` + - sandbox: `yes` + - version: `nix-env (Nix) 2.24.12` + - nixpkgs: `/nix/store/g4ppspdl4fy7hnp4jgjl4ll03v7i08w3-source` diff --git a/lenovo/thinkpad/p43s/default.nix b/lenovo/thinkpad/p43s/default.nix new file mode 100644 index 00000000..9a05aeeb --- /dev/null +++ b/lenovo/thinkpad/p43s/default.nix @@ -0,0 +1,23 @@ +{ lib, config, ... }: +{ + imports = [ + ../. + ../../../common/cpu/intel/whiskey-lake + ../../../common/pc/ssd + ../../../common/gpu/nvidia/pascal + ../../../common/gpu/nvidia/prime-sync.nix + ]; + + hardware = { + graphics.enable = lib.mkDefault true; + + nvidia = { + prime = { + intelBusId = lib.mkDefault "PCI:0:2:0"; + nvidiaBusId = lib.mkDefault "PCI:60:0:0"; + }; + + powerManagement.enable = lib.mkDefault config.hardware.nvidia.prime.sync.enable; + }; + }; +} diff --git a/lenovo/thinkpad/p50/default.nix b/lenovo/thinkpad/p50/default.nix index 62edb254..1deaddd1 100644 --- a/lenovo/thinkpad/p50/default.nix +++ b/lenovo/thinkpad/p50/default.nix @@ -1,4 +1,5 @@ -{ lib, config, ... }: { +{ lib, config, ... }: +{ imports = [ ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/maxwell @@ -19,16 +20,14 @@ hardware.enableAllFirmware = lib.mkDefault true; # fix suspend/resume screen corruption in sync mode - hardware.nvidia.powerManagement = - lib.mkIf config.hardware.nvidia.prime.sync.enable { - enable = lib.mkDefault true; - }; + hardware.nvidia.powerManagement = lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; # fix screen tearing in sync mode - hardware.nvidia.modesetting = - lib.mkIf config.hardware.nvidia.prime.sync.enable { - enable = lib.mkDefault true; - }; + hardware.nvidia.modesetting = lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; # Make the DPI the same in sync mode as in offload mode (disabled because # these thinkpads come with many kinds of screens, but this is valid for the diff --git a/lenovo/thinkpad/p51/default.nix b/lenovo/thinkpad/p51/default.nix index 38f5614d..da133e49 100644 --- a/lenovo/thinkpad/p51/default.nix +++ b/lenovo/thinkpad/p51/default.nix @@ -1,4 +1,5 @@ -{ config, lib, ... }: { +{ config, lib, ... }: +{ imports = [ ../../../common/gpu/24.05-compat.nix ../../../common/gpu/nvidia/prime.nix @@ -25,16 +26,14 @@ hardware.enableAllFirmware = lib.mkDefault true; # fix suspend/resume screen corruption in sync mode - hardware.nvidia.powerManagement = - lib.mkIf config.hardware.nvidia.prime.sync.enable { - enable = lib.mkDefault true; - }; + hardware.nvidia.powerManagement = lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; # fix screen tearing in sync mode - hardware.nvidia.modesetting = - lib.mkIf config.hardware.nvidia.prime.sync.enable { - enable = lib.mkDefault true; - }; + hardware.nvidia.modesetting = lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; # Make the DPI the same in sync mode as in offload mode (disabled because # these thinkpads come with many kinds of screens, but this is valid for the diff --git a/lenovo/thinkpad/p52/default.nix b/lenovo/thinkpad/p52/default.nix index 6c9ea67b..fc8811f6 100644 --- a/lenovo/thinkpad/p52/default.nix +++ b/lenovo/thinkpad/p52/default.nix @@ -1,4 +1,5 @@ -{ lib, config, ... }: { +{ lib, config, ... }: +{ imports = [ ../../../common/gpu/24.05-compat.nix ../../../common/gpu/nvidia/prime.nix @@ -26,16 +27,14 @@ hardware.enableAllFirmware = lib.mkDefault true; # fix suspend/resume screen corruption in sync mode - hardware.nvidia.powerManagement = - lib.mkIf config.hardware.nvidia.prime.sync.enable { - enable = lib.mkDefault true; - }; + hardware.nvidia.powerManagement = lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; # fix screen tearing in sync mode - hardware.nvidia.modesetting = - lib.mkIf config.hardware.nvidia.prime.sync.enable { - enable = lib.mkDefault true; - }; + hardware.nvidia.modesetting = lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; # Make the DPI the same in sync mode as in offload mode (disabled because # these thinkpads come with many kinds of screens, but this is valid for the diff --git a/lenovo/thinkpad/t14/amd/gen4/default.nix b/lenovo/thinkpad/t14/amd/gen4/default.nix index e61a3a0d..6ca06529 100644 --- a/lenovo/thinkpad/t14/amd/gen4/default.nix +++ b/lenovo/thinkpad/t14/amd/gen4/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: { imports = [ diff --git a/lenovo/thinkpad/t14/amd/gen5/default.nix b/lenovo/thinkpad/t14/amd/gen5/default.nix index 917da63f..a092523c 100644 --- a/lenovo/thinkpad/t14/amd/gen5/default.nix +++ b/lenovo/thinkpad/t14/amd/gen5/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: { imports = [ diff --git a/lenovo/thinkpad/t14/default.nix b/lenovo/thinkpad/t14/default.nix index fb42f2b9..2a725bb5 100644 --- a/lenovo/thinkpad/t14/default.nix +++ b/lenovo/thinkpad/t14/default.nix @@ -3,7 +3,7 @@ { imports = [ ../. - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # For suspending to RAM to work, set Config -> Power -> Sleep State to "Linux" in EFI. diff --git a/lenovo/thinkpad/t410/default.nix b/lenovo/thinkpad/t410/default.nix index 9cb15b3d..cd77abaf 100644 --- a/lenovo/thinkpad/t410/default.nix +++ b/lenovo/thinkpad/t410/default.nix @@ -28,7 +28,10 @@ "i915.i915_enable_rc6=1" ]; blacklistedKernelModules = [ - "sierra_net" "cdc_mbim" "cdc_ncm" "btusb" + "sierra_net" + "cdc_mbim" + "cdc_ncm" + "btusb" ]; }; } diff --git a/lenovo/thinkpad/t490/default.nix b/lenovo/thinkpad/t490/default.nix index f524223d..cc6bfc55 100644 --- a/lenovo/thinkpad/t490/default.nix +++ b/lenovo/thinkpad/t490/default.nix @@ -12,18 +12,20 @@ # This configures a profile set for pulseaudio which offers multiple sinks corresponding to the # speaker + 4 HDMI ports. This allows the user to play audio streams on the speaker and any of the 4 HDMI/USB-C # ports at the same time. - udev.extraRules = let - t490ProfileSet = ./t490-profile-set.conf; - in '' - SUBSYSTEM!="sound", GOTO="pulseaudio_end" - ACTION!="change", GOTO="pulseaudio_end" - KERNEL!="card*", GOTO="pulseaudio_end" + udev.extraRules = + let + t490ProfileSet = ./t490-profile-set.conf; + in + '' + SUBSYSTEM!="sound", GOTO="pulseaudio_end" + ACTION!="change", GOTO="pulseaudio_end" + KERNEL!="card*", GOTO="pulseaudio_end" - # Lenovo T490 - ATTRS{vendor}=="0x8086" ATTRS{device}=="0x9dc8" ATTRS{subsystem_vendor}=="0x17aa", ATTRS{subsystem_device}=="0x2279", ENV{PULSE_PROFILE_SET}="${t490ProfileSet}" + # Lenovo T490 + ATTRS{vendor}=="0x8086" ATTRS{device}=="0x9dc8" ATTRS{subsystem_vendor}=="0x17aa", ATTRS{subsystem_device}=="0x2279", ENV{PULSE_PROFILE_SET}="${t490ProfileSet}" - LABEL="pulseaudio_end" - ''; + LABEL="pulseaudio_end" + ''; throttled.enable = lib.mkDefault true; }; diff --git a/lenovo/thinkpad/t490s/default.nix b/lenovo/thinkpad/t490s/default.nix index 35a0055b..2ee6567a 100644 --- a/lenovo/thinkpad/t490s/default.nix +++ b/lenovo/thinkpad/t490s/default.nix @@ -1,4 +1,5 @@ -{lib, ...}: { +{ lib, ... }: +{ imports = [ ../../../common/cpu/intel ../../../common/pc/ssd diff --git a/lenovo/thinkpad/x1-extreme/default.nix b/lenovo/thinkpad/x1-extreme/default.nix index 2e4c10e0..b816d538 100644 --- a/lenovo/thinkpad/x1-extreme/default.nix +++ b/lenovo/thinkpad/x1-extreme/default.nix @@ -2,6 +2,6 @@ imports = [ ../. ../../../common/cpu/intel - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; } diff --git a/lenovo/thinkpad/x1-nano/default.nix b/lenovo/thinkpad/x1-nano/default.nix index a842d437..fdbf9f32 100644 --- a/lenovo/thinkpad/x1-nano/default.nix +++ b/lenovo/thinkpad/x1-nano/default.nix @@ -1,8 +1,9 @@ -{ ... }: { +{ ... }: +{ # Reference to hardware: https://ubuntu.com/certified/202012-28574 imports = [ ../. ../../../common/cpu/intel - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; } diff --git a/lenovo/thinkpad/x1-nano/gen1/default.nix b/lenovo/thinkpad/x1-nano/gen1/default.nix index 22c4019f..5ce106c1 100644 --- a/lenovo/thinkpad/x1-nano/gen1/default.nix +++ b/lenovo/thinkpad/x1-nano/gen1/default.nix @@ -1,19 +1,19 @@ -{ pkgs, ... }: +{ pkgs, ... }: { imports = [ ../. ]; - environment.systemPackages = with pkgs; [ - alsa-utils - ]; + environment.systemPackages = with pkgs; [ + alsa-utils + ]; - systemd.services.x1-fix = { - description = "Use alsa-utils to fix sound interference on Thinkpad x1 Nano"; - serviceConfig = { - Type = "simple"; - ExecStart = "${pkgs.alsa-tools}/bin/hda-verb /dev/snd/hwC0D0 0x1d SET_PIN_WIDGET_CONTROL 0x0"; - Restart = "on-failure"; - }; - wantedBy = [ "default.target" ]; - }; + systemd.services.x1-fix = { + description = "Use alsa-utils to fix sound interference on Thinkpad x1 Nano"; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.alsa-tools}/bin/hda-verb /dev/snd/hwC0D0 0x1d SET_PIN_WIDGET_CONTROL 0x0"; + Restart = "on-failure"; + }; + wantedBy = [ "default.target" ]; + }; } diff --git a/lenovo/thinkpad/x1/10th-gen/default.nix b/lenovo/thinkpad/x1/10th-gen/default.nix index 75a23d85..8f814835 100644 --- a/lenovo/thinkpad/x1/10th-gen/default.nix +++ b/lenovo/thinkpad/x1/10th-gen/default.nix @@ -1,7 +1,7 @@ { imports = [ ../. - ../../../../common/pc/laptop/ssd + ../../../../common/pc/ssd ]; # Use the right Intel graphics driver diff --git a/lenovo/thinkpad/x1/11th-gen/default.nix b/lenovo/thinkpad/x1/11th-gen/default.nix index 86c2992b..07b32232 100644 --- a/lenovo/thinkpad/x1/11th-gen/default.nix +++ b/lenovo/thinkpad/x1/11th-gen/default.nix @@ -1,7 +1,7 @@ { imports = [ ../. - ../../../../common/pc/laptop/ssd + ../../../../common/pc/ssd ]; # Use the right Intel graphics driver diff --git a/lenovo/thinkpad/x1/12th-gen/default.nix b/lenovo/thinkpad/x1/12th-gen/default.nix index 7d17c714..b13ea279 100644 --- a/lenovo/thinkpad/x1/12th-gen/default.nix +++ b/lenovo/thinkpad/x1/12th-gen/default.nix @@ -1,7 +1,7 @@ { imports = [ ../. - ../../../../common/pc/laptop/ssd + ../../../../common/pc/ssd ]; hardware.trackpoint.device = "TPPS/2 Synaptics TrackPoint"; diff --git a/lenovo/thinkpad/x1/13th-gen/default.nix b/lenovo/thinkpad/x1/13th-gen/default.nix new file mode 100644 index 00000000..a2caba51 --- /dev/null +++ b/lenovo/thinkpad/x1/13th-gen/default.nix @@ -0,0 +1,12 @@ +{ lib, ... }: + +{ + imports = [ + ../../../../common/pc/ssd + ../../../../common/cpu/intel/lunar-lake + ]; + + hardware.trackpoint.device = "TPPS/2 Synaptics TrackPoint"; + + services.thermald.enable = lib.mkDefault true; +} diff --git a/lenovo/thinkpad/x1/2nd-gen/default.nix b/lenovo/thinkpad/x1/2nd-gen/default.nix new file mode 100644 index 00000000..8d381f23 --- /dev/null +++ b/lenovo/thinkpad/x1/2nd-gen/default.nix @@ -0,0 +1,10 @@ +{ lib, ... }: +{ + imports = [ + ../. + ../../../../common/cpu/intel/haswell + ../../../../common/pc/ssd + ]; + + services.throttled.enable = lib.mkDefault true; +} diff --git a/lenovo/thinkpad/x1/6th-gen/default.nix b/lenovo/thinkpad/x1/6th-gen/default.nix index 264faa6c..92cefaf7 100644 --- a/lenovo/thinkpad/x1/6th-gen/default.nix +++ b/lenovo/thinkpad/x1/6th-gen/default.nix @@ -10,7 +10,7 @@ imports = [ ../. ../../../../common/cpu/intel/kaby-lake - ../../../../common/pc/laptop/ssd + ../../../../common/pc/ssd ]; # New ThinkPads have a different TrackPoint manufacturer/name. diff --git a/lenovo/thinkpad/x1/7th-gen/default.nix b/lenovo/thinkpad/x1/7th-gen/default.nix index 6dd02b8e..38c66fd0 100644 --- a/lenovo/thinkpad/x1/7th-gen/default.nix +++ b/lenovo/thinkpad/x1/7th-gen/default.nix @@ -2,7 +2,7 @@ { imports = [ ../. - ../../../../common/pc/laptop/ssd + ../../../../common/pc/ssd ]; services.throttled.enable = lib.mkDefault true; diff --git a/lenovo/thinkpad/x1/9th-gen/default.nix b/lenovo/thinkpad/x1/9th-gen/default.nix index a52f02b7..cb2f5b80 100644 --- a/lenovo/thinkpad/x1/9th-gen/default.nix +++ b/lenovo/thinkpad/x1/9th-gen/default.nix @@ -2,11 +2,11 @@ { imports = [ ../. - ../../../../common/pc/laptop/ssd + ../../../../common/pc/ssd ]; # This solves lagging noticeable on high-resolution screens. - boot.kernelPackages = lib.mkIf - (lib.versionOlder pkgs.linux.version "5.15") - (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.15") ( + lib.mkDefault pkgs.linuxPackages_latest + ); } diff --git a/lenovo/thinkpad/x1/yoga/7th-gen/default.nix b/lenovo/thinkpad/x1/yoga/7th-gen/default.nix index d95ad1ec..8f5365a7 100644 --- a/lenovo/thinkpad/x1/yoga/7th-gen/default.nix +++ b/lenovo/thinkpad/x1/yoga/7th-gen/default.nix @@ -1,14 +1,12 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ imports = [ ../. - ../../../../../common/pc/laptop/ssd + ../../../../../common/pc/ssd ]; - # This laptop is too new for the kernel currently in nixos-unstable. - # On Kernel 5.15.x, dmesg shows the `hardware is newer than drivers` message. - # When starting the system with 5.15.x, only a tty is being displayed. - # After our tests, at least version 5.19 is required for the system to work properly. - boot.kernelPackages = lib.mkIf - (lib.versionOlder pkgs.linux.version "5.19") - (lib.mkDefault pkgs.linuxPackages_latest); + # At least kernel 5.19 is required for the system to work properly. + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.19") ( + lib.mkDefault pkgs.linuxPackages_latest + ); } diff --git a/lenovo/thinkpad/x1/yoga/8th-gen/default.nix b/lenovo/thinkpad/x1/yoga/8th-gen/default.nix new file mode 100644 index 00000000..d89bbd49 --- /dev/null +++ b/lenovo/thinkpad/x1/yoga/8th-gen/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ../. + ../../../../../common/pc/ssd + ]; +} diff --git a/lenovo/thinkpad/x1/yoga/default.nix b/lenovo/thinkpad/x1/yoga/default.nix index dfabfd41..25b85378 100644 --- a/lenovo/thinkpad/x1/yoga/default.nix +++ b/lenovo/thinkpad/x1/yoga/default.nix @@ -1,8 +1,13 @@ -{ config, lib, ... }: { +{ config, lib, ... }: +{ imports = [ ../. ../../yoga.nix ]; - services.xserver.wacom.enable = lib.mkDefault config.services.xserver.enable; + services = { + fprintd.enable = lib.mkDefault true; + fwupd.enable = lib.mkDefault true; + xserver.wacom.enable = lib.mkDefault config.services.xserver.enable; + }; } diff --git a/lenovo/thinkpad/x13/amd/default.nix b/lenovo/thinkpad/x13/amd/default.nix index 61ca7b75..4543132d 100644 --- a/lenovo/thinkpad/x13/amd/default.nix +++ b/lenovo/thinkpad/x13/amd/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ imports = [ ../common.nix ../../../../common/cpu/amd diff --git a/lenovo/thinkpad/x13/common.nix b/lenovo/thinkpad/x13/common.nix index c45a7a67..1b9a75cf 100644 --- a/lenovo/thinkpad/x13/common.nix +++ b/lenovo/thinkpad/x13/common.nix @@ -1,7 +1,8 @@ -{ ... }: { +{ ... }: +{ imports = [ ../. - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Somehow psmouse does not load automatically on boot for me diff --git a/lenovo/thinkpad/x13/intel/default.nix b/lenovo/thinkpad/x13/intel/default.nix index ed4771fd..71d0324a 100644 --- a/lenovo/thinkpad/x13/intel/default.nix +++ b/lenovo/thinkpad/x13/intel/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ # Reference to hardware: https://certification.ubuntu.com/hardware/202004-27844 imports = [ ../common.nix diff --git a/lenovo/thinkpad/x13/yoga/3th-gen/default.nix b/lenovo/thinkpad/x13/yoga/3th-gen/default.nix index 1b02f61f..971b925f 100644 --- a/lenovo/thinkpad/x13/yoga/3th-gen/default.nix +++ b/lenovo/thinkpad/x13/yoga/3th-gen/default.nix @@ -1,4 +1,5 @@ -{ lib, ... }: { +{ lib, ... }: +{ imports = [ ../. ]; diff --git a/lenovo/thinkpad/x13/yoga/default.nix b/lenovo/thinkpad/x13/yoga/default.nix index 5a454d6f..7719520a 100644 --- a/lenovo/thinkpad/x13/yoga/default.nix +++ b/lenovo/thinkpad/x13/yoga/default.nix @@ -1,8 +1,11 @@ -{ config, lib, ... }: { +{ config, lib, ... }: +{ imports = [ ../intel ../../yoga.nix ]; services.xserver.wacom.enable = lib.mkDefault config.services.xserver.enable; + + services.hardware.bolt.enable = lib.mkDefault true; } diff --git a/lenovo/thinkpad/x13s/README.md b/lenovo/thinkpad/x13s/README.md new file mode 100644 index 00000000..f4608185 --- /dev/null +++ b/lenovo/thinkpad/x13s/README.md @@ -0,0 +1,10 @@ +# Lenovo X13s + +[Debian](https://wiki.debian.org/InstallingDebianOn/Thinkpad/X13s) +[PostmarketOS](https://wiki.postmarketos.org/wiki/Lenovo_ThinkPad_X13s_(lenovo-21bx)) + +## Camera +The MIPI camera does work, however, it's not accelerated by the ISP and therefore image processing is done on CPU. + +## Wifi and Bluetooth MAC addresses +Currently they need to be set manually diff --git a/lenovo/thinkpad/x13s/default.nix b/lenovo/thinkpad/x13s/default.nix new file mode 100644 index 00000000..59cf01b4 --- /dev/null +++ b/lenovo/thinkpad/x13s/default.nix @@ -0,0 +1,108 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + inherit (config.boot.kernelPackages) kernel; + + dtbName = "sc8280xp-lenovo-thinkpad-x13s.dtb"; + dtb = "${kernel}/dtbs/qcom/${dtbName}"; + # Version the dtb based on the kernel + dtbEfiPath = "dtbs/x13s-${kernel.version}.dtb"; + cfg = { + wifiMac = "e4:65:38:52:22:a9"; + bluetoothMac = "E4:25:18:22:44:AA"; + }; + inherit (lib) mkDefault; +in +{ + imports = [ + ../. + ../../../common/pc/laptop + ]; + + boot = { + loader.systemd-boot.extraFiles = { + "${dtbEfiPath}" = dtb; + }; + + kernelParams = mkDefault [ + # needed to boot + "dtb=${dtbEfiPath}" + + # jhovold recommended + "clk_ignore_unused" + "pd_ignore_unused" + "arm64.nopauth" + ]; + + kernelModules = mkDefault [ + "nvme" + "phy-qcom-qmp-pcie" + "pcie-qcom" + + "i2c-core" + "i2c-hid" + "i2c-hid-of" + "i2c-qcom-geni" + + "leds_qcom_lpg" + "pwm_bl" + "qrtr" + "pmic_glink_altmode" + "gpio_sbu_mux" + "phy-qcom-qmp-combo" + "gpucc_sc8280xp" + "dispcc_sc8280xp" + "phy_qcom_edp" + "panel-edp" + "msm" + ]; + }; + + hardware.enableRedistributableFirmware = mkDefault true; + + systemd.services.bluetooth-x13s-mac = lib.mkIf (cfg.bluetoothMac != null) { + wantedBy = [ "multi-user.target" ]; + before = [ "bluetooth.service" ]; + requiredBy = [ "bluetooth.service" ]; + + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStart = "${pkgs.util-linux}/bin/script -q -c '${pkgs.bluez}/bin/btmgmt --index 0 public-addr ${cfg.bluetoothMac}'"; + }; + }; + + # https://github.com/jhovold/linux/wiki/X13s#modem + networking.networkmanager.fccUnlockScripts = [ + + { + id = "105b:e0c3"; + path = "${pkgs.modemmanager}/share/ModemManager/fcc-unlock.available.d/105b"; + } + ]; + + # https://github.com/jhovold/linux/wiki/X13s#camera + services.udev.extraRules = lib.strings.concatLines ( + [ + '' + ACTION=="add", SUBSYSTEM=="dma_heap", KERNEL=="linux,cma", GROUP="video", MODE="0660" + ACTION=="add", SUBSYSTEM=="dma_heap", KERNEL=="system", GROUP="video", MODE="0660" + '' + ] + ++ ( + if cfg.wifiMac != null then + [ + '' + ACTION=="add", SUBSYSTEM=="net", KERNELS=="0006:01:00.0", RUN+="${pkgs.iproute2}/bin/ip link set dev $name address ${cfg.wifiMac}" + '' + ] + else + [ ] + ) + ); +} diff --git a/lenovo/thinkpad/x270/default.nix b/lenovo/thinkpad/x270/default.nix index 8e09d2a1..636ef145 100644 --- a/lenovo/thinkpad/x270/default.nix +++ b/lenovo/thinkpad/x270/default.nix @@ -2,7 +2,7 @@ imports = [ ../. ../../../common/cpu/intel - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; boot.kernelParams = [ diff --git a/lenovo/thinkpad/x280/default.nix b/lenovo/thinkpad/x280/default.nix index 5b6121a0..7a3b5508 100644 --- a/lenovo/thinkpad/x280/default.nix +++ b/lenovo/thinkpad/x280/default.nix @@ -4,7 +4,7 @@ imports = [ ../. ../../../common/cpu/intel - ../../../common/pc/laptop/ssd/default.nix + ../../../common/pc/ssd/default.nix ]; services.throttled.enable = lib.mkDefault true; diff --git a/lenovo/thinkpad/x390/default.nix b/lenovo/thinkpad/x390/default.nix index d06a4aea..7a3b5508 100644 --- a/lenovo/thinkpad/x390/default.nix +++ b/lenovo/thinkpad/x390/default.nix @@ -4,9 +4,8 @@ imports = [ ../. ../../../common/cpu/intel - ../../../common/pc/laptop/ssd/default.nix + ../../../common/pc/ssd/default.nix ]; services.throttled.enable = lib.mkDefault true; } - diff --git a/lenovo/thinkpad/z/default.nix b/lenovo/thinkpad/z/default.nix index 5d8ba8ac..d3af3e5f 100644 --- a/lenovo/thinkpad/z/default.nix +++ b/lenovo/thinkpad/z/default.nix @@ -1,11 +1,12 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ imports = [ ../../../lenovo/thinkpad ../../../common/cpu/amd ../../../common/cpu/amd/pstate.nix ../../../common/gpu/amd ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; hardware.enableRedistributableFirmware = lib.mkDefault true; @@ -15,5 +16,7 @@ # kernel versions below 6.0 don’t contain ACPI suspend2idle drivers for the Z-series’ AMD hardware # my Z13 froze after waking up from suspend/ hibernate - services.logind.lidSwitch = lib.mkIf (lib.versionOlder pkgs.linux.version "6.00") (lib.mkDefault "lock"); + services.logind.lidSwitch = lib.mkIf (lib.versionOlder pkgs.linux.version "6.00") ( + lib.mkDefault "lock" + ); } diff --git a/lenovo/thinkpad/z/gen1/default.nix b/lenovo/thinkpad/z/gen1/default.nix index b51da6e8..22d49544 100644 --- a/lenovo/thinkpad/z/gen1/default.nix +++ b/lenovo/thinkpad/z/gen1/default.nix @@ -1,8 +1,11 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ imports = [ ../../../../lenovo/thinkpad/z ]; # Kernel 5.18 is required for the Ryzen 6000 series - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.18") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.18") ( + lib.mkDefault pkgs.linuxPackages_latest + ); } diff --git a/lenovo/thinkpad/z/gen2/default.nix b/lenovo/thinkpad/z/gen2/default.nix index cb7e05c2..a91581d8 100644 --- a/lenovo/thinkpad/z/gen2/default.nix +++ b/lenovo/thinkpad/z/gen2/default.nix @@ -6,7 +6,9 @@ ]; # Kernel 6.4 is required for the Ryzen 7040 series - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.4") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.4") ( + lib.mkDefault pkgs.linuxPackages_latest + ); systemd.services = { # Modified from Arch Wiki diff --git a/lenovo/yoga/7/14ARH7/nvidia/default.nix b/lenovo/yoga/7/14ARH7/nvidia/default.nix index cf7aedc9..71b7e00b 100644 --- a/lenovo/yoga/7/14ARH7/nvidia/default.nix +++ b/lenovo/yoga/7/14ARH7/nvidia/default.nix @@ -5,7 +5,8 @@ let inherit (lib) mkDefault; -in { +in +{ imports = [ ../shared.nix ## "prime.nix" loads this, aleady: diff --git a/lenovo/yoga/7/14IAH7/hybrid/default.nix b/lenovo/yoga/7/14IAH7/hybrid/default.nix index d202352c..0a46b053 100644 --- a/lenovo/yoga/7/14IAH7/hybrid/default.nix +++ b/lenovo/yoga/7/14IAH7/hybrid/default.nix @@ -1,23 +1,23 @@ /* - * `lenovo-yoga-7-14IAH7-hybrid`: - * - * This is a hybrid profile that enables the NVIDIA - * driver and PRIME offload mode for making use of both - * integrated and dedicated graphics. Use this profile if - * you want to use the NVIDIA GeForce RTX 3050 Mobile. - * Read about PRIME offload mode here: - * - * - * The `lenovo-yoga-7-14IAH7-integrated` profile only - * has the integrated Intel GPU enabled. The dedicated - * NVIDIA GPU is disabled entirely. Use that profile - * instead if you want to only use integrated graphics. - * - * `nouveau` wasn't added to any profiles since it - * is known to cause freezes for this device. - * `nouveau` is blacklisted by default when enabling this: - * - */ + `lenovo-yoga-7-14IAH7-hybrid`: + + This is a hybrid profile that enables the NVIDIA + driver and PRIME offload mode for making use of both + integrated and dedicated graphics. Use this profile if + you want to use the NVIDIA GeForce RTX 3050 Mobile. + Read about PRIME offload mode here: + + + The `lenovo-yoga-7-14IAH7-integrated` profile only + has the integrated Intel GPU enabled. The dedicated + NVIDIA GPU is disabled entirely. Use that profile + instead if you want to only use integrated graphics. + + `nouveau` wasn't added to any profiles since it + is known to cause freezes for this device. + `nouveau` is blacklisted by default when enabling this: + +*/ { lib, ... }: { imports = [ diff --git a/lenovo/yoga/7/14IAH7/integrated/default.nix b/lenovo/yoga/7/14IAH7/integrated/default.nix index 6ba257b0..3a3ce89a 100644 --- a/lenovo/yoga/7/14IAH7/integrated/default.nix +++ b/lenovo/yoga/7/14IAH7/integrated/default.nix @@ -1,25 +1,25 @@ /* - * `lenovo-yoga-7-14IAH7-integrated`: - * - * This profile only has the integrated Intel GPU - * enabled. The dedicated NVIDIA GPU is disabled - * entirely. Use this profile if you want to only - * use the integrated GPU. - * - * It is recommended to use this profile to disable - * dedicated graphics, rather than doing it through - * the BIOS, since that method causes issues with - * the integrated graphics drivers. Doing it - * through blacklisting achieves the same result - * with no side-effects. - * - * The `lenovo-yoga-7-14IAH7-hybrid` hybrid profile - * enables the NVIDIA driver and PRIME offload mode - * for making use of both GPUs. Use that profile - * instead if you want to use the NVIDIA GPU. - * Read about PRIME offload mode here: - * - */ + `lenovo-yoga-7-14IAH7-integrated`: + + This profile only has the integrated Intel GPU + enabled. The dedicated NVIDIA GPU is disabled + entirely. Use this profile if you want to only + use the integrated GPU. + + It is recommended to use this profile to disable + dedicated graphics, rather than doing it through + the BIOS, since that method causes issues with + the integrated graphics drivers. Doing it + through blacklisting achieves the same result + with no side-effects. + + The `lenovo-yoga-7-14IAH7-hybrid` hybrid profile + enables the NVIDIA driver and PRIME offload mode + for making use of both GPUs. Use that profile + instead if you want to use the NVIDIA GPU. + Read about PRIME offload mode here: + +*/ { imports = [ ../shared.nix diff --git a/lenovo/yoga/7/14IAH7/shared.nix b/lenovo/yoga/7/14IAH7/shared.nix index 91220cd7..22f868e0 100644 --- a/lenovo/yoga/7/14IAH7/shared.nix +++ b/lenovo/yoga/7/14IAH7/shared.nix @@ -1,8 +1,8 @@ /* - * Here are configurations for the - * Intel Core i7-12700H CPU, along - * with a few others. - */ + Here are configurations for the + Intel Core i7-12700H CPU, along + with a few others. +*/ { imports = [ ../../../../common/cpu/intel/alder-lake diff --git a/lenovo/yoga/7/14ILL10/README.md b/lenovo/yoga/7/14ILL10/README.md new file mode 100644 index 00000000..602dc465 --- /dev/null +++ b/lenovo/yoga/7/14ILL10/README.md @@ -0,0 +1,3 @@ +# Lenovo Slim 7 14ILL10 + +This module imports configuration for the Lunar Lake processors as well as ensuring that the Linux kernel is up to date enough for most features to be available. This does not make the device's built-in speakers or audio jack function. diff --git a/lenovo/yoga/7/14ILL10/default.nix b/lenovo/yoga/7/14ILL10/default.nix new file mode 100644 index 00000000..9c9ca25e --- /dev/null +++ b/lenovo/yoga/7/14ILL10/default.nix @@ -0,0 +1,13 @@ +{ lib, pkgs, ... }: +{ + imports = [ + ../../../../common/cpu/intel/lunar-lake + ../../../../common/pc/laptop + ../../../../common/pc/ssd + ]; + + # touchpad, wifi, and bluetooth do not work before 6.12 + config.boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.12") ( + lib.mkDefault pkgs.linuxPackages_latest + ); +} diff --git a/lenovo/yoga/7/slim/gen8/default.nix b/lenovo/yoga/7/slim/gen8/default.nix index 5f87802d..7e3099c4 100644 --- a/lenovo/yoga/7/slim/gen8/default.nix +++ b/lenovo/yoga/7/slim/gen8/default.nix @@ -1,20 +1,25 @@ -{ pkgs, lib, ... }: { +{ pkgs, lib, ... }: +{ boot.initrd.kernelModules = [ "amdgpu" ]; boot.kernelModules = [ "kvm-amd" ]; - # https://gitlab.freedesktop.org/drm/amd/-/issues/2812#note_2190544 - boot.kernelParams = ["mem_sleep_default=deep" "rtc_cmos.use_acpi_alarm=1"]; + # https://gitlab.freedesktop.org/drm/amd/-/issues/2812#note_2190544 + boot.kernelParams = [ + "mem_sleep_default=deep" + "rtc_cmos.use_acpi_alarm=1" + ]; # suspend needs kernel 6.7 or later - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.7") pkgs.linuxPackages_latest; + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.7") pkgs.linuxPackages_latest; - # https://gitlab.freedesktop.org/drm/amd/-/issues/2812#note_2190544 + # https://gitlab.freedesktop.org/drm/amd/-/issues/2812#note_2190544 hardware.enableRedistributableFirmware = true; hardware.cpu.amd.updateMicrocode = true; - boot.initrd.prepend = lib.mkOrder 0 [ "${pkgs.fetchurl { - url = "https://gitlab.freedesktop.org/drm/amd/uploads/9fe228c7aa403b78c61fb1e29b3b35e3/slim7-ssdt"; - sha256 = "sha256-Ef4QTxdjt33OJEPLAPEChvvSIXx3Wd/10RGvLfG5JUs="; - name = "slim7-ssdt"; - }}" ]; + boot.initrd.prepend = lib.mkOrder 0 [ + "${pkgs.fetchurl { + url = "https://gitlab.freedesktop.org/drm/amd/uploads/9fe228c7aa403b78c61fb1e29b3b35e3/slim7-ssdt"; + sha256 = "sha256-Ef4QTxdjt33OJEPLAPEChvvSIXx3Wd/10RGvLfG5JUs="; + name = "slim7-ssdt"; + }}" + ]; } - diff --git a/malibal/aon/s1/default.nix b/malibal/aon/s1/default.nix index 86995beb..c682a447 100644 --- a/malibal/aon/s1/default.nix +++ b/malibal/aon/s1/default.nix @@ -3,7 +3,7 @@ { imports = [ ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../../common/cpu/intel diff --git a/microchip/common/bsp/hss-payload-generator.nix b/microchip/common/bsp/hss-payload-generator.nix index 4044d51f..74bbe07b 100644 --- a/microchip/common/bsp/hss-payload-generator.nix +++ b/microchip/common/bsp/hss-payload-generator.nix @@ -1,4 +1,4 @@ -{ pkgs, ...}: +{ pkgs, ... }: with pkgs; stdenv.mkDerivation rec { pname = "hss"; diff --git a/microchip/common/bsp/linux-icicle-kit.nix b/microchip/common/bsp/linux-icicle-kit.nix index 6ac1eb14..13d4f34f 100644 --- a/microchip/common/bsp/linux-icicle-kit.nix +++ b/microchip/common/bsp/linux-icicle-kit.nix @@ -1,65 +1,77 @@ -{ lib, buildLinux, fetchFromGitHub -, kernelPatches ? [] -, structuredExtraConfig ? {} -, extraMeta ? {} -, argsOverride ? {} -, ... } @ args: +{ + lib, + buildLinux, + fetchFromGitHub, + kernelPatches ? [ ], + structuredExtraConfig ? { }, + extraMeta ? { }, + argsOverride ? { }, + ... +}@args: let version = "6.1.43-linux4microchip+fpga-2023.09"; -in buildLinux (args // { - inherit version kernelPatches extraMeta; +in +buildLinux ( + args + // { + inherit version kernelPatches extraMeta; - # modDirVersion needs to be x.y.z, will automatically add .0 if needed - modDirVersion = version; + # modDirVersion needs to be x.y.z, will automatically add .0 if needed + modDirVersion = version; - defconfig = "mpfs_defconfig"; + defconfig = "mpfs_defconfig"; - autoModules = false; + autoModules = false; - structuredExtraConfig = with lib.kernel; { - OF_OVERLAY = yes; - OF_CONFIGFS = yes; - MFD_SENSEHAT_CORE = module; - INPUT_JOYDEV = module; - INPUT_JOYSTICK = yes; - JOYSTICK_SENSEHAT = module; - AUXDISPLAY = yes; - SENSEHAT_DISPLAY = module; - HTS221 = module; - IIO_ST_PRESS = module; - IIO_ST_LSM6DSX = module; - IIO_ST_MAGN_3AXIS = module; - POLARFIRE_SOC_DMA_NONCOHERENT = yes; - MTD_SPI_NOR_USE_4K_SECTORS = no; - MTD_UBI = yes; - MTD_CMDLINE_PARTS = yes; - UBIFS_FS = yes; - USB_UAS = module; - EFI_STUB = yes; - EFI = yes; - USBIP_CORE = module; - USBIP_VHCI_HCD = module; - USBIP_HOST = module; - USBIP_VUDC = module; - CRYPTO_TLS = module; - MD = yes; - BLK_DEV_MD = module; - MD_LINEAR = module; - MD_RAID0 = module; - MD_RAID1 = module; - MD_RAID10 = module; - MD_RAID456 = module; + structuredExtraConfig = + with lib.kernel; + { + OF_OVERLAY = yes; + OF_CONFIGFS = yes; + MFD_SENSEHAT_CORE = module; + INPUT_JOYDEV = module; + INPUT_JOYSTICK = yes; + JOYSTICK_SENSEHAT = module; + AUXDISPLAY = yes; + SENSEHAT_DISPLAY = module; + HTS221 = module; + IIO_ST_PRESS = module; + IIO_ST_LSM6DSX = module; + IIO_ST_MAGN_3AXIS = module; + POLARFIRE_SOC_DMA_NONCOHERENT = yes; + MTD_SPI_NOR_USE_4K_SECTORS = no; + MTD_UBI = yes; + MTD_CMDLINE_PARTS = yes; + UBIFS_FS = yes; + USB_UAS = module; + EFI_STUB = yes; + EFI = yes; + USBIP_CORE = module; + USBIP_VHCI_HCD = module; + USBIP_HOST = module; + USBIP_VUDC = module; + CRYPTO_TLS = module; + MD = yes; + BLK_DEV_MD = module; + MD_LINEAR = module; + MD_RAID0 = module; + MD_RAID1 = module; + MD_RAID10 = module; + MD_RAID456 = module; - # This device doesn't have any kind of display output at all - FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER = lib.mkForce no; - FB_EFI = lib.mkForce no; - } // structuredExtraConfig; + # This device doesn't have any kind of display output at all + FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER = lib.mkForce no; + FB_EFI = lib.mkForce no; + } + // structuredExtraConfig; - src = fetchFromGitHub { - owner = "linux4microchip"; - repo = "linux"; - rev = "25e35c7c54ad853d03c14a02b189b408cb5b5eb3"; - sha256 = "sha256-wj7lz247MkhxmhSHUcNeWmcZK+DL+5PAnLwTmALD97M="; - }; -} // argsOverride) + src = fetchFromGitHub { + owner = "linux4microchip"; + repo = "linux"; + rev = "25e35c7c54ad853d03c14a02b189b408cb5b5eb3"; + sha256 = "sha256-wj7lz247MkhxmhSHUcNeWmcZK+DL+5PAnLwTmALD97M="; + }; + } + // argsOverride +) diff --git a/microchip/common/bsp/uboot.nix b/microchip/common/bsp/uboot.nix index 2db04d56..22be6d0b 100644 --- a/microchip/common/bsp/uboot.nix +++ b/microchip/common/bsp/uboot.nix @@ -1,9 +1,12 @@ { - pkgs, targetBoard, ... + pkgs, + targetBoard, + ... }: -with pkgs; let - payload-generator = pkgs.callPackage ./hss-payload-generator.nix {}; +with pkgs; +let + payload-generator = pkgs.callPackage ./hss-payload-generator.nix { }; payload_config = ./uboot.yaml; in buildUBoot rec { @@ -19,7 +22,7 @@ buildUBoot rec { }; extraMakeFlags = [ - "OPENSBI=${opensbi}/share/opensbi/lp64/generic/firmware/fw_dynamic.bin" + "OPENSBI=${opensbi}/share/opensbi/lp64/generic/firmware/fw_dynamic.bin" ]; patches = [ @@ -27,9 +30,9 @@ buildUBoot rec { ]; defconfig = "${targetBoard}_defconfig"; enableParallelBuilding = true; - extraMeta.platforms = ["riscv64-linux"]; + extraMeta.platforms = [ "riscv64-linux" ]; postBuild = '' - ${payload-generator}/hss-payload-generator -c ${payload_config} payload.bin - ''; + ${payload-generator}/hss-payload-generator -c ${payload_config} payload.bin + ''; filesToInstall = [ "payload.bin" ]; } diff --git a/microchip/common/modules.nix b/microchip/common/modules.nix index c6a75198..34874aac 100644 --- a/microchip/common/modules.nix +++ b/microchip/common/modules.nix @@ -1,8 +1,16 @@ -{ pkgs, lib, config, ... }: { +{ + pkgs, + lib, + config, + ... +}: +{ boot = { - kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./bsp/linux-icicle-kit.nix { - inherit (config.boot) kernelPatches; - }); + kernelPackages = pkgs.linuxPackagesFor ( + pkgs.callPackage ./bsp/linux-icicle-kit.nix { + inherit (config.boot) kernelPatches; + } + ); initrd.includeDefaultModules = lib.mkDefault false; }; } diff --git a/microchip/icicle-kit/overlay.nix b/microchip/icicle-kit/overlay.nix index f145dcf6..86b60d93 100644 --- a/microchip/icicle-kit/overlay.nix +++ b/microchip/icicle-kit/overlay.nix @@ -1,3 +1,6 @@ final: _prev: { - uboot-icicle-kit = final.callPackage ./../common/bsp/uboot.nix { pkgs = final; targetBoard = "microchip_mpfs_icicle";}; + uboot-icicle-kit = final.callPackage ./../common/bsp/uboot.nix { + pkgs = final; + targetBoard = "microchip_mpfs_icicle"; + }; } diff --git a/microsoft/surface-pro/9/default.nix b/microsoft/surface-pro/9/default.nix index 60b82ad3..b8334cac 100644 --- a/microsoft/surface-pro/9/default.nix +++ b/microsoft/surface-pro/9/default.nix @@ -2,4 +2,4 @@ imports = [ ../../surface/surface-pro-intel ]; boot.kernelParams = [ "i915.enable_psr=0" ]; # Disable Intel Panel Self Refresh -} \ No newline at end of file +} diff --git a/microsoft/surface/README.md b/microsoft/surface/README.md index a461f318..7fc5675c 100644 --- a/microsoft/surface/README.md +++ b/microsoft/surface/README.md @@ -1,8 +1,3 @@ -# NOTE: Structure changes from 2023-01-10 - -Please read the [Deprecated Behaviour README](./OLD-BEHAVIOUR-DEPRECATION.md) to understand how some structural changes to -the code might affect you! - # Derivations for Microsoft Surface notebooks These derivatives use the patches from the [linux-surface repo](https://github.com/linux-surface/linux-surface/tree/master/patches). @@ -32,13 +27,24 @@ Not all hardware is fully supported, but the [linux-surface feature matrix](https://github.com/linux-surface/linux-surface/wiki/Supported-Devices-and-Features#feature-matrix) provides details on which devices are supported on which types of machine. -The kernel-specific derivations are under the [`common/kernel/`](./common/kernel/) sub-directory. -In order to simplify maintenance of the Nix code, only the most-recent kernel patch-set is expected -to be maintained in this repo. +The kernel-specific derivations are under the [`common/kernel/`](./common/kernel/) sub-directory. This directory defines patch sets for each supported kernel release (see Kernel versions below for more information). _*NOTE:*_ Some built-in Kernel config items need to be set, that aren't set by default: - https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing +#### Kernel versions + +There are multiple versions of the Surface kernel available: + +- `longterm`, which tracks the latest long term support (LTS) release. +- `stable`, which tracks the most recent stable release. + +This repo uses `longterm` by default, but you can switch it to `stable` by adding this to your configuration file: + +```nix +hardware.microsoft-surface.kernelVersion = "stable"; +``` + ### Support Tools ### IPTS @@ -120,3 +126,7 @@ References: - https://github.com/thebitstick/surfacego-wifi - https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/ath10k - https://wireless.wiki.kernel.org/en/users/drivers/ath10k/firmware + +## Structural changes from earlier versions (2023-01-10 and earlier) + +If you're upgrading from an older version of nixos-hardware, please read the [Deprecated Behaviour README](./OLD-BEHAVIOUR-DEPRECATION.md) to understand how some structural changes to the code might affect you! diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index d49f4e31..a4defb61 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -1,22 +1,122 @@ -{ lib, ... }: +{ + config, + lib, + pkgs, + ... +}: let - inherit (lib) mkDefault; + inherit (lib) + mkDefault + mkOption + types + versions + ; -in { - imports = [ - ./kernel - ]; + # Set the version and hash for the kernel sources + srcVersion = + with config.hardware.microsoft-surface; + if kernelVersion == "longterm" then + "6.12.19" + else if kernelVersion == "stable" then + "6.15.3" + else + abort "Invalid kernel version: ${kernelVersion}"; - microsoft-surface.kernelVersion = mkDefault "6.12"; + srcHash = + with config.hardware.microsoft-surface; + if kernelVersion == "longterm" then + "sha256-1zvwV77ARDSxadG2FkGTb30Ml865I6KB8y413U3MZTE=" + else if kernelVersion == "stable" then + "sha256-ErUMiZJUONnNc4WgyvycQz5lYqxd8AohiJ/On1SNZbA=" + else + abort "Invalid kernel version: ${kernelVersion}"; - # Seems to be required to properly enable S0ix "Modern Standby": - boot.kernelParams = mkDefault [ "mem_sleep_default=deep" ]; + # Set the version and hash for the linux-surface releases + pkgVersion = + with config.hardware.microsoft-surface; + if kernelVersion == "longterm" then + "6.12.7" + else if kernelVersion == "stable" then + "6.15.3" + else + abort "Invalid kernel version: ${kernelVersion}"; - # NOTE: Check the README before enabling TLP: - services.tlp.enable = mkDefault false; + pkgHash = + with config.hardware.microsoft-surface; + if kernelVersion == "longterm" then + "sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY=" + else if kernelVersion == "stable" then + "sha256-ozvYrZDiVtMkdCcVnNEdlF2Kdw4jivW0aMJrDynN3Hk=" + else + abort "Invalid kernel version: ${kernelVersion}"; - # i.e. needed for wifi firmware, see https://github.com/NixOS/nixos-hardware/issues/364 - hardware.enableRedistributableFirmware = mkDefault true; - hardware.sensor.iio.enable = mkDefault true; + # Fetch the linux-surface package + repos = + pkgs.callPackage + ( + { + fetchFromGitHub, + rev, + hash, + }: + { + linux-surface = fetchFromGitHub { + owner = "linux-surface"; + repo = "linux-surface"; + rev = rev; + hash = hash; + }; + } + ) + { + hash = pkgHash; + rev = "arch-${pkgVersion}-1"; + }; + + # Fetch and build the kernel package + inherit (pkgs.callPackage ./kernel/linux-package.nix { inherit repos; }) + linuxPackage + surfacePatches + ; + kernelPatches = surfacePatches { + version = pkgVersion; + patchFn = ./kernel/${versions.majorMinor pkgVersion}/patches.nix; + patchSrc = (repos.linux-surface + "/patches/${versions.majorMinor pkgVersion}"); + }; + kernelPackages = linuxPackage { + inherit kernelPatches; + version = srcVersion; + sha256 = srcHash; + ignoreConfigErrors = true; + }; + +in +{ + options.hardware.microsoft-surface.kernelVersion = mkOption { + description = "Kernel Version to use (patched for MS Surface)"; + type = types.enum [ + "longterm" + "stable" + ]; + default = "longterm"; + }; + + config = { + boot = { + inherit kernelPackages; + + # Seems to be required to properly enable S0ix "Modern Standby": + kernelParams = mkDefault [ "mem_sleep_default=deep" ]; + }; + + # NOTE: Check the README before enabling TLP: + services.tlp.enable = mkDefault false; + + # Needed for wifi firmware, see https://github.com/NixOS/nixos-hardware/issues/364 + hardware = { + enableRedistributableFirmware = mkDefault true; + sensor.iio.enable = mkDefault true; + }; + }; } diff --git a/microsoft/surface/common/kernel/6.12/patches.nix b/microsoft/surface/common/kernel/6.12/patches.nix new file mode 100644 index 00000000..d5cc8ccc --- /dev/null +++ b/microsoft/surface/common/kernel/6.12/patches.nix @@ -0,0 +1,154 @@ +{ + lib, + kernel ? lib.kernel, + patchSrc, + version, +}: + +[ + { + name = "microsoft-surface-patches-linux-${version}"; + patch = null; + extraStructuredConfig = with kernel; { + STAGING_MEDIA = yes; + + ## + ## Surface Aggregator Module + ## + CONFIG_SURFACE_AGGREGATOR = module; + # CONFIG_SURFACE_AGGREGATOR_ERROR_INJECTION is not set + CONFIG_SURFACE_AGGREGATOR_BUS = yes; + CONFIG_SURFACE_AGGREGATOR_CDEV = module; + CONFIG_SURFACE_AGGREGATOR_HUB = module; + CONFIG_SURFACE_AGGREGATOR_REGISTRY = module; + CONFIG_SURFACE_AGGREGATOR_TABLET_SWITCH = module; + + CONFIG_SURFACE_ACPI_NOTIFY = module; + CONFIG_SURFACE_DTX = module; + CONFIG_SURFACE_PLATFORM_PROFILE = module; + + CONFIG_SURFACE_HID = module; + CONFIG_SURFACE_KBD = module; + + CONFIG_BATTERY_SURFACE = module; + CONFIG_CHARGER_SURFACE = module; + + CONFIG_SENSORS_SURFACE_TEMP = module; + CONFIG_SENSORS_SURFACE_FAN = module; + + ## + ## Surface Hotplug + ## + CONFIG_SURFACE_HOTPLUG = module; + + ## + ## IPTS and ITHC touchscreen + ## + ## This only enables the user interface for IPTS/ITHC data. + ## For the touchscreen to work, you need to install iptsd. + ## + CONFIG_HID_IPTS = module; + CONFIG_HID_ITHC = module; + + ## + ## Cameras: IPU3 + ## + CONFIG_VIDEO_DW9719 = module; + CONFIG_VIDEO_IPU3_IMGU = module; + CONFIG_VIDEO_IPU3_CIO2 = module; + CONFIG_IPU_BRIDGE = module; + CONFIG_INTEL_SKL_INT3472 = module; + CONFIG_REGULATOR_TPS68470 = module; + CONFIG_COMMON_CLK_TPS68470 = module; + CONFIG_LEDS_TPS68470 = module; + + ## + ## Cameras: Sensor drivers + ## + CONFIG_VIDEO_OV5693 = module; + CONFIG_VIDEO_OV7251 = module; + CONFIG_VIDEO_OV8865 = module; + + ## + ## Surface 3: atomisp causes problems (see issue #1095). Disable it for now. + ## + # CONFIG_INTEL_ATOMISP is not set + + ## + ## ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 + ## + CONFIG_APDS9960 = module; + + ## + ## Build-in UFS support (required for some Surface Go devices) + ## + CONFIG_SCSI_UFSHCD = module; + CONFIG_SCSI_UFSHCD_PCI = module; + + ## + ## Other Drivers + ## + CONFIG_INPUT_SOC_BUTTON_ARRAY = module; + CONFIG_SURFACE_3_POWER_OPREGION = module; + CONFIG_SURFACE_PRO3_BUTTON = module; + CONFIG_SURFACE_GPE = module; + CONFIG_SURFACE_BOOK1_DGPU_SWITCH = module; + }; + } + { + name = "ms-surface/0001-secureboot"; + patch = patchSrc + "/0001-secureboot.patch"; + } + { + name = "ms-surface/0002-surface3-oemb"; + patch = patchSrc + "/0002-surface3-oemb.patch"; + } + { + name = "ms-surface/0003-mwifiex"; + patch = patchSrc + "/0003-mwifiex.patch"; + } + { + name = "ms-surface/0004-ath10k"; + patch = patchSrc + "/0004-ath10k.patch"; + } + { + name = "ms-surface/0005-ipts"; + patch = patchSrc + "/0005-ipts.patch"; + } + { + name = "ms-surface/0006-ithc"; + patch = patchSrc + "/0006-ithc.patch"; + } + { + name = "ms-surface/0007-surface-sam-over-hid"; + patch = patchSrc + "/0007-surface-sam-over-hid.patch"; + } + { + name = "ms-surface/0008-surface-button"; + patch = patchSrc + "/0008-surface-button.patch"; + } + { + name = "ms-surface/0009-surface-typecover"; + patch = patchSrc + "/0009-surface-typecover.patch"; + } + { + name = "ms-surface/0010-surface-shutdown"; + patch = patchSrc + "/0010-surface-shutdown.patch"; + } + { + name = "ms-surface/0011-surface-gpe"; + patch = patchSrc + "/0011-surface-gpe.patch"; + } + { + name = "ms-surface/0012-cameras"; + patch = patchSrc + "/0012-cameras.patch"; + } + { + name = "ms-surface/0013-amd-gpio"; + patch = patchSrc + "/0013-amd-gpio.patch"; + } + { + name = "ms-surface/0014-rtc"; + patch = patchSrc + "/0014-rtc.patch"; + } +] diff --git a/microsoft/surface/common/kernel/6.15/patches.nix b/microsoft/surface/common/kernel/6.15/patches.nix new file mode 100644 index 00000000..6f685ee4 --- /dev/null +++ b/microsoft/surface/common/kernel/6.15/patches.nix @@ -0,0 +1,159 @@ +{ + lib, + kernel ? lib.kernel, + patchSrc, + version, +}: + +[ + { + name = "microsoft-surface-patches-linux-${version}"; + patch = null; + extraStructuredConfig = with kernel; { + STAGING_MEDIA = yes; + ## + ## Surface Aggregator Module + ## + CONFIG_SURFACE_AGGREGATOR = module; + # CONFIG_SURFACE_AGGREGATOR_ERROR_INJECTION is not set + CONFIG_SURFACE_AGGREGATOR_BUS = yes; + CONFIG_SURFACE_AGGREGATOR_CDEV = module; + CONFIG_SURFACE_AGGREGATOR_HUB = module; + CONFIG_SURFACE_AGGREGATOR_REGISTRY = module; + CONFIG_SURFACE_AGGREGATOR_TABLET_SWITCH = module; + + CONFIG_SURFACE_ACPI_NOTIFY = module; + CONFIG_SURFACE_DTX = module; + CONFIG_SURFACE_PLATFORM_PROFILE = module; + + CONFIG_SURFACE_HID = module; + CONFIG_SURFACE_KBD = module; + + CONFIG_BATTERY_SURFACE = module; + CONFIG_CHARGER_SURFACE = module; + + CONFIG_SENSORS_SURFACE_TEMP = module; + CONFIG_SENSORS_SURFACE_FAN = module; + + CONFIG_RTC_DRV_SURFACE = module; + + ## + ## Surface Hotplug + ## + CONFIG_SURFACE_HOTPLUG = module; + + ## + ## IPTS and ITHC touchscreen + ## + ## This only enables the user interface for IPTS/ITHC data. + ## For the touchscreen to work, you need to install iptsd. + ## + CONFIG_HID_IPTS = module; + CONFIG_HID_ITHC = module; + + ## + ## Cameras: IPU3 + ## + CONFIG_VIDEO_DW9719 = module; + CONFIG_VIDEO_IPU3_IMGU = module; + CONFIG_VIDEO_IPU3_CIO2 = module; + CONFIG_IPU_BRIDGE = module; + CONFIG_INTEL_SKL_INT3472 = module; + CONFIG_REGULATOR_TPS68470 = module; + CONFIG_COMMON_CLK_TPS68470 = module; + CONFIG_LEDS_TPS68470 = module; + + ## + ## Cameras: Sensor drivers + ## + CONFIG_VIDEO_OV5693 = module; + CONFIG_VIDEO_OV7251 = module; + CONFIG_VIDEO_OV8865 = module; + + ## + ## Surface 3: atomisp causes problems (see issue #1095). Disable it for now. + ## + # CONFIG_INTEL_ATOMISP is not set + + ## + ## ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 + ## + CONFIG_APDS9960 = module; + + ## + ## Build-in UFS support (required for some Surface Go devices) + ## + CONFIG_SCSI_UFSHCD = module; + CONFIG_SCSI_UFSHCD_PCI = module; + + ## + ## Other Drivers + ## + CONFIG_INPUT_SOC_BUTTON_ARRAY = module; + CONFIG_SURFACE_3_POWER_OPREGION = module; + CONFIG_SURFACE_PRO3_BUTTON = module; + CONFIG_SURFACE_GPE = module; + CONFIG_SURFACE_BOOK1_DGPU_SWITCH = module; + }; + } + { + name = "ms-surface/0001-secureboot"; + patch = patchSrc + "/0001-secureboot.patch"; + } + { + name = "ms-surface/0002-surface3"; + patch = patchSrc + "/0002-surface3.patch"; + } + { + name = "ms-surface/0003-mwifiex"; + patch = patchSrc + "/0003-mwifiex.patch"; + } + { + name = "ms-surface/0004-ath10k"; + patch = patchSrc + "/0004-ath10k.patch"; + } + { + name = "ms-surface/0005-ipts"; + patch = patchSrc + "/0005-ipts.patch"; + } + { + name = "ms-surface/0006-ithc"; + patch = patchSrc + "/0006-ithc.patch"; + } + { + name = "ms-surface/0007-surface-sam"; + patch = patchSrc + "/0007-surface-sam.patch"; + } + { + name = "ms-surface/0008-surface-sam-over-hid"; + patch = patchSrc + "/0008-surface-sam-over-hid.patch"; + } + { + name = "ms-surface/0009-surface-button"; + patch = patchSrc + "/0009-surface-button.patch"; + } + { + name = "ms-surface/0010-surface-typecover"; + patch = patchSrc + "/0010-surface-typecover.patch"; + } + { + name = "ms-surface/0011-surface-shutdown"; + patch = patchSrc + "/0011-surface-shutdown.patch"; + } + { + name = "ms-surface/0012-surface-gpe"; + patch = patchSrc + "/0012-surface-gpe.patch"; + } + { + name = "ms-surface/0013-cameras"; + patch = patchSrc + "/0013-cameras.patch"; + } + { + name = "ms-surface/0014-amd-gpio"; + patch = patchSrc + "/0014-amd-gpio.patch"; + } + { + name = "ms-surface/0015-rtc"; + patch = patchSrc + "/0015-rtc.patch"; + } +] diff --git a/microsoft/surface/common/kernel/default.nix b/microsoft/surface/common/kernel/default.nix deleted file mode 100644 index 490ecd0d..00000000 --- a/microsoft/surface/common/kernel/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ lib, ... }: - -let - inherit (lib) mkOption types; - -in { - imports = [ - ./linux-surface - ]; - - options.microsoft-surface.kernelVersion = mkOption { - description = "Kernel Version to use (patched for MS Surface)"; - type = types.enum [ ]; - }; -} diff --git a/microsoft/surface/common/kernel/linux-package.nix b/microsoft/surface/common/kernel/linux-package.nix index b179fcb7..a66aabc4 100644 --- a/microsoft/surface/common/kernel/linux-package.nix +++ b/microsoft/surface/common/kernel/linux-package.nix @@ -1,55 +1,84 @@ -{ pkgs, +{ + pkgs, lib, fetchurl, buildLinux, linuxPackagesFor, + repos, }: let inherit (builtins) elem; inherit (lib) recurseIntoAttrs types versions; - repos = pkgs.callPackage ../repos.nix {}; - linuxPackage = - { url ? "mirror://kernel/linux/kernel/v${versions.major version}.x/linux-${version}.tar.xz", + { + url ? "mirror://kernel/linux/kernel/v${versions.major version}.x/linux-${version}.tar.xz", sha256 ? null, src ? (fetchurl { inherit url sha256; }), version, modDirVersion ? (versions.pad 3 version), - kernelPatches ? [], + kernelPatches ? [ ], ... - } @ args: let + }@args: + let inherit (builtins) removeAttrs; - args' = { - inherit src version modDirVersion kernelPatches; - } // removeAttrs args [ "url" "sha256" ]; + args' = + { + inherit + src + version + modDirVersion + kernelPatches + ; + } + // removeAttrs args [ + "url" + "sha256" + ]; linuxPackage = buildLinux args'; linuxPackages' = recurseIntoAttrs (linuxPackagesFor linuxPackage); - in linuxPackages'; + in + linuxPackages'; surfacePatches = - { patchSrc ? (repos.linux-surface + "/patches/${versions.majorMinor version}"), + { + patchSrc, version, patchFn, - }: pkgs.callPackage patchFn { + }: + pkgs.callPackage patchFn { inherit (lib) kernel; inherit version patchSrc; }; - versionsOf = version: + versionsOf = + version: # Provides a list of versions that can be used as an enum option for this full version: - [ version (versions.majorMinor version) ]; + [ + version + (versions.majorMinor version) + ]; - versionsOfEnum = version: + versionsOfEnum = + version: # Provide an enum option for versions of this kernel: types.enum (versionsOf version); - isVersionOf = kernelVersion: version: + isVersionOf = + kernelVersion: version: # Test if the provided version is considered one of the list of versions from above: elem kernelVersion (versionsOf version); -in { - inherit linuxPackage repos surfacePatches versionsOf isVersionOf versionsOfEnum; +in +{ + inherit + linuxPackage + repos + surfacePatches + versionsOf + isVersionOf + versionsOfEnum + ; } diff --git a/microsoft/surface/common/kernel/linux-surface/default.nix b/microsoft/surface/common/kernel/linux-surface/default.nix deleted file mode 100644 index 17260c9d..00000000 --- a/microsoft/surface/common/kernel/linux-surface/default.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ config, lib, pkgs, ... }: - -let - inherit (lib) mkIf mkOption; - - inherit (pkgs.callPackage ../linux-package.nix { }) linuxPackage surfacePatches isVersionOf versionsOfEnum; - - cfg = config.microsoft-surface; - - version = "6.12.14"; - kernelPatches = surfacePatches { - inherit version; - patchFn = ./patches.nix; - }; - kernelPackages = linuxPackage { - inherit version kernelPatches; - sha256 = "sha256-lCP0v7TYdUF+OcsLAXtUmf6kfaVhGfDNKKIBc12JjxQ="; - ignoreConfigErrors=true; - }; - -in { - options.microsoft-surface.kernelVersion = mkOption { - type = versionsOfEnum version; - }; - - config = mkIf (isVersionOf cfg.kernelVersion version) { - boot = { - inherit kernelPackages; - }; - }; -} diff --git a/microsoft/surface/common/kernel/linux-surface/patches.nix b/microsoft/surface/common/kernel/linux-surface/patches.nix deleted file mode 100644 index 93e3c2ef..00000000 --- a/microsoft/surface/common/kernel/linux-surface/patches.nix +++ /dev/null @@ -1,153 +0,0 @@ -{ lib, - kernel ? lib.kernel, - patchSrc, - version, -}: - -[ - { - name = "microsoft-surface-patches-linux-${version}"; - patch = null; - extraStructuredConfig = with kernel; { - STAGING_MEDIA = yes; - -## -## Surface Aggregator Module -## -CONFIG_SURFACE_AGGREGATOR= module; -# CONFIG_SURFACE_AGGREGATOR_ERROR_INJECTION is not set -CONFIG_SURFACE_AGGREGATOR_BUS= yes; -CONFIG_SURFACE_AGGREGATOR_CDEV= module; -CONFIG_SURFACE_AGGREGATOR_HUB= module; -CONFIG_SURFACE_AGGREGATOR_REGISTRY= module; -CONFIG_SURFACE_AGGREGATOR_TABLET_SWITCH= module; - -CONFIG_SURFACE_ACPI_NOTIFY= module; -CONFIG_SURFACE_DTX= module; -CONFIG_SURFACE_PLATFORM_PROFILE= module; - -CONFIG_SURFACE_HID= module; -CONFIG_SURFACE_KBD= module; - -CONFIG_BATTERY_SURFACE= module; -CONFIG_CHARGER_SURFACE= module; - -CONFIG_SENSORS_SURFACE_TEMP= module; -CONFIG_SENSORS_SURFACE_FAN= module; - -## -## Surface Hotplug -## -CONFIG_SURFACE_HOTPLUG= module; - -## -## IPTS and ITHC touchscreen -## -## This only enables the user interface for IPTS/ITHC data. -## For the touchscreen to work, you need to install iptsd. -## -CONFIG_HID_IPTS= module; -CONFIG_HID_ITHC= module; - -## -## Cameras: IPU3 -## -CONFIG_VIDEO_DW9719= module; -CONFIG_VIDEO_IPU3_IMGU= module; -CONFIG_VIDEO_IPU3_CIO2= module; -CONFIG_IPU_BRIDGE= module; -CONFIG_INTEL_SKL_INT3472= module; -CONFIG_REGULATOR_TPS68470= module; -CONFIG_COMMON_CLK_TPS68470= module; -CONFIG_LEDS_TPS68470= module; - -## -## Cameras: Sensor drivers -## -CONFIG_VIDEO_OV5693= module; -CONFIG_VIDEO_OV7251= module; -CONFIG_VIDEO_OV8865= module; - -## -## Surface 3: atomisp causes problems (see issue #1095). Disable it for now. -## -# CONFIG_INTEL_ATOMISP is not set - -## -## ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 -## -CONFIG_APDS9960= module; - -## -## Build-in UFS support (required for some Surface Go devices) -## -CONFIG_SCSI_UFSHCD= module; -CONFIG_SCSI_UFSHCD_PCI= module; - -## -## Other Drivers -## -CONFIG_INPUT_SOC_BUTTON_ARRAY= module; -CONFIG_SURFACE_3_POWER_OPREGION= module; -CONFIG_SURFACE_PRO3_BUTTON= module; -CONFIG_SURFACE_GPE= module; -CONFIG_SURFACE_BOOK1_DGPU_SWITCH= module; - }; - } - { - name = "ms-surface/0001-secureboot"; - patch = patchSrc + "/0001-secureboot.patch"; - } - { - name = "ms-surface/0002-surface3-oemb"; - patch = patchSrc + "/0002-surface3-oemb.patch"; - } - { - name = "ms-surface/0003-mwifiex"; - patch = patchSrc + "/0003-mwifiex.patch"; - } - { - name = "ms-surface/0004-ath10k"; - patch = patchSrc + "/0004-ath10k.patch"; - } - { - name = "ms-surface/0005-ipts"; - patch = patchSrc + "/0005-ipts.patch"; - } - { - name = "ms-surface/0006-ithc"; - patch = patchSrc + "/0006-ithc.patch"; - } - { - name = "ms-surface/0007-surface-sam-over-hid"; - patch = patchSrc + "/0007-surface-sam-over-hid.patch"; - } - { - name = "ms-surface/0008-surface-button"; - patch = patchSrc + "/0008-surface-button.patch"; - } - { - name = "ms-surface/0009-surface-typecover"; - patch = patchSrc + "/0009-surface-typecover.patch"; - } - { - name = "ms-surface/0010-surface-shutdown"; - patch = patchSrc + "/0010-surface-shutdown.patch"; - } - { - name = "ms-surface/0011-surface-gpe"; - patch = patchSrc + "/0011-surface-gpe.patch"; - } - { - name = "ms-surface/0012-cameras"; - patch = patchSrc + "/0012-cameras.patch"; - } - { - name = "ms-surface/0013-amd-gpio"; - patch = patchSrc + "/0013-amd-gpio.patch"; - } - { - name = "ms-surface/0014-rtc"; - patch = patchSrc + "/0014-rtc.patch"; - } -] diff --git a/microsoft/surface/common/repos.nix b/microsoft/surface/common/repos.nix deleted file mode 100644 index a6bb7368..00000000 --- a/microsoft/surface/common/repos.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ fetchFromGitHub }: - -{ - linux-surface = fetchFromGitHub { - owner = "linux-surface"; - repo = "linux-surface"; - rev = "arch-6.12.7-1"; - hash = "sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY="; - }; - - # This is the owner and repo for the pre-patched kernel from the "linux-surface" project: - linux-surface-kernel = { rev, sha256 }: - fetchFromGitHub { - owner = "linux-surface"; - repo = "kernel"; - inherit rev sha256; - }; - - surface-go-ath10k-firmware_backup = fetchFromGitHub { - owner = "mexisme"; - repo = "linux-surface_ath10k-firmware"; - rev = "74e5409e699383d6ca2bc4da4a8433d16f3850b1"; - sha256 = "169vgvxpgad9anmchs22fj5qm6ahzjfdnwhd8pc280q705vx6pjk"; - }; -} diff --git a/microsoft/surface/surface-go/default.nix b/microsoft/surface/surface-go/default.nix index a86f741d..a5d717b1 100644 --- a/microsoft/surface/surface-go/default.nix +++ b/microsoft/surface/surface-go/default.nix @@ -6,7 +6,8 @@ let inherit (lib) mkDefault; -in { +in +{ imports = [ ../common ./firmware/ath10k diff --git a/microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix b/microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix index 6cc55fa2..e5cf182d 100644 --- a/microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix +++ b/microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix @@ -1,14 +1,31 @@ -{ stdenv, lib, pkgs, firmwareLinuxNonfree, ... }: +{ + stdenv, + lib, + pkgs, + firmwareLinuxNonfree, + ... +}: let - repos = pkgs.callPackage ../../../common/repos.nix {}; + repos = pkgs.callPackage { + surface-go-ath10k-firmware_backup = lib.fetchFromGitHub { + owner = "mexisme"; + repo = "linux-surface_ath10k-firmware"; + rev = "74e5409e699383d6ca2bc4da4a8433d16f3850b1"; + sha256 = "169vgvxpgad9anmchs22fj5qm6ahzjfdnwhd8pc280q705vx6pjk"; + }; + } { }; killernetworking_firmware = repos.surface-go-ath10k-firmware_backup + "/K1535_Debian"; -in stdenv.mkDerivation { +in +stdenv.mkDerivation { pname = "microsoft-surface-go-firmware-linux-nonfree"; inherit (firmwareLinuxNonfree) version; src = firmwareLinuxNonfree; - phases = [ "unpackPhase" "installPhase" ]; + phases = [ + "unpackPhase" + "installPhase" + ]; installPhase = '' # Install the Surface Go Wifi firmware: diff --git a/microsoft/surface/surface-go/firmware/ath10k/default.nix b/microsoft/surface/surface-go/firmware/ath10k/default.nix index a7ad6a9a..efed6de8 100644 --- a/microsoft/surface/surface-go/firmware/ath10k/default.nix +++ b/microsoft/surface/surface-go/firmware/ath10k/default.nix @@ -1,11 +1,17 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkDefault mkEnableOption mkIf; cfg = config.hardware.microsoft-surface.firmware.surface-go-ath10k; -in { +in +{ options = { hardware.microsoft-surface.firmware.surface-go-ath10k = { replace = mkEnableOption ''Use the "board.bin" firmware for ath10k-based WiFi on Surface Go.''; @@ -13,18 +19,21 @@ in { }; config = mkIf cfg.replace { - warnings = [''A working version of the ath10k QCA6174 firmware has been added to the kernel.org linux-firmware - repo, making this fix obsolete. - See: - - https://github.com/linux-surface/linux-surface/issues/542#issuecomment-976995453 - - https://github.com/linux-surface/linux-surface/wiki/Surface-Go#wi-fi-firmware + warnings = [ + '' + A working version of the ath10k QCA6174 firmware has been added to the kernel.org linux-firmware + repo, making this fix obsolete. + See: + - https://github.com/linux-surface/linux-surface/issues/542#issuecomment-976995453 + - https://github.com/linux-surface/linux-surface/wiki/Surface-Go#wi-fi-firmware - NOTE: This module option will probably be removed in the near future. - '']; + NOTE: This module option will probably be removed in the near future. + '' + ]; hardware.enableAllFirmware = true; hardware.firmware = [ - (pkgs.callPackage ./ath10k-replace.nix {}) + (pkgs.callPackage ./ath10k-replace.nix { }) ]; boot.extraModprobeConfig = mkDefault '' diff --git a/microsoft/surface/surface-pro-intel/default.nix b/microsoft/surface/surface-pro-intel/default.nix index 20ebbbab..c50e4515 100644 --- a/microsoft/surface/surface-pro-intel/default.nix +++ b/microsoft/surface/surface-pro-intel/default.nix @@ -15,7 +15,7 @@ services.iptsd.enable = lib.mkDefault true; environment.systemPackages = [ pkgs.surface-control ]; - + services.thermald = lib.mkDefault { enable = true; configFile = ./thermal-conf.xml; diff --git a/milkv/pioneer/default.nix b/milkv/pioneer/default.nix index aaf685a7..a7297e6d 100644 --- a/milkv/pioneer/default.nix +++ b/milkv/pioneer/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { boot = { @@ -11,9 +16,11 @@ "sdhci_sophgo" ]; }; - kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./linux.nix { - inherit (config.boot) kernelPatches; - }); + kernelPackages = pkgs.linuxPackagesFor ( + pkgs.callPackage ./linux.nix { + inherit (config.boot) kernelPatches; + } + ); kernelParams = lib.mkDefault [ "earlycon" "console=ttyS0,115200" diff --git a/milkv/pioneer/firmware.nix b/milkv/pioneer/firmware.nix index fb49962b..2adedf74 100644 --- a/milkv/pioneer/firmware.nix +++ b/milkv/pioneer/firmware.nix @@ -1,12 +1,13 @@ -{ stdenv -, writeText -, opensbi -, fip -, zsbl -, linuxboot-kernel -, linuxboot-initrd -, dtbs ? "${linuxboot-kernel}/dtbs" -, ... +{ + stdenv, + writeText, + opensbi, + fip, + zsbl, + linuxboot-kernel, + linuxboot-initrd, + dtbs ? "${linuxboot-kernel}/dtbs", + ... }: let diff --git a/milkv/pioneer/linux.nix b/milkv/pioneer/linux.nix index b2396c75..48c4ecd1 100644 --- a/milkv/pioneer/linux.nix +++ b/milkv/pioneer/linux.nix @@ -1,44 +1,58 @@ -{ buildLinux, fetchFromGitHub, kernelPatches, lib, ... } @ args: +{ + buildLinux, + fetchFromGitHub, + kernelPatches, + lib, + ... +}@args: let modDirVersion = "6.6.20"; in -buildLinux (args // { - inherit kernelPatches modDirVersion; - version = "${modDirVersion}-milkv-pioneer"; - src = fetchFromGitHub { - owner = "sophgo"; - repo = "linux-riscv"; - rev = "caa949e3690fe8a4656313b2b56f52666fa880db"; - hash = "sha256-qJpR3KMgvP4tfPfBfQ/MiEWg/uuuxHYuACK8taKKK3E="; - }; +buildLinux ( + args + // { + inherit kernelPatches modDirVersion; + version = "${modDirVersion}-milkv-pioneer"; + src = fetchFromGitHub { + owner = "sophgo"; + repo = "linux-riscv"; + rev = "caa949e3690fe8a4656313b2b56f52666fa880db"; + hash = "sha256-qJpR3KMgvP4tfPfBfQ/MiEWg/uuuxHYuACK8taKKK3E="; + }; - defconfig = "sophgo_mango_normal_defconfig"; - structuredExtraConfig = let inherit (lib.kernel) freeform module yes; in { - # LinuxBoot will override the console bootparams which will result - # in the distro kernel to be booted with e.g. console=tty1 only. - # https://github.com/sophgo/bootloader-riscv/issues/71 - # Force output on serial console through the config. This is also - # needed to get the forced serial-getty to be started. - # We also list tty1 again because according to - # https://docs.kernel.org/admin-guide/serial-console.html and - # https://0pointer.de/blog/projects/serial-console.html - # this will be the main console. - CMDLINE = freeform "console=ttyS0,115200 console=tty1"; - CMDLINE_EXTEND = yes; + defconfig = "sophgo_mango_normal_defconfig"; + structuredExtraConfig = + let + inherit (lib.kernel) freeform module yes; + in + { + # LinuxBoot will override the console bootparams which will result + # in the distro kernel to be booted with e.g. console=tty1 only. + # https://github.com/sophgo/bootloader-riscv/issues/71 + # Force output on serial console through the config. This is also + # needed to get the forced serial-getty to be started. + # We also list tty1 again because according to + # https://docs.kernel.org/admin-guide/serial-console.html and + # https://0pointer.de/blog/projects/serial-console.html + # this will be the main console. + CMDLINE = freeform "console=ttyS0,115200 console=tty1"; + CMDLINE_EXTEND = yes; - # Enable these explicitly because they are not enabled by the defconfig. - # The all-hardware profile expects these to be built. - VIRTIO_MENU = yes; - VIRTIO_PCI = module; + # Enable these explicitly because they are not enabled by the defconfig. + # The all-hardware profile expects these to be built. + VIRTIO_MENU = yes; + VIRTIO_PCI = module; - # There is an i2c mcu driver (drivers/soc/sophgo/umcu) which is always - # compiled into the kernel. Hence some of the i2c support also needs to - # be compiled in instead of being compiled as a module. - I2C = yes; - I2C_CHARDEV = yes; - I2C_DESIGNWARE_PLATFORM = yes; - }; + # There is an i2c mcu driver (drivers/soc/sophgo/umcu) which is always + # compiled into the kernel. Hence some of the i2c support also needs to + # be compiled in instead of being compiled as a module. + I2C = yes; + I2C_CHARDEV = yes; + I2C_DESIGNWARE_PLATFORM = yes; + }; - extraMeta.branch = "sg2042-dev-6.6"; -} // (args.argsOverride or { })) + extraMeta.branch = "sg2042-dev-6.6"; + } + // (args.argsOverride or { }) +) diff --git a/milkv/pioneer/linuxboot-initrd.nix b/milkv/pioneer/linuxboot-initrd.nix index 507fc0e3..a0cfd7ef 100644 --- a/milkv/pioneer/linuxboot-initrd.nix +++ b/milkv/pioneer/linuxboot-initrd.nix @@ -1,9 +1,10 @@ -{ buildPackages -, fetchFromGitHub -, fetchpatch -, linux-firmware -, buildGoModule -, ... +{ + buildPackages, + fetchFromGitHub, + fetchpatch, + linux-firmware, + buildGoModule, + ... }: # Based on diff --git a/milkv/pioneer/linuxboot-kernel.nix b/milkv/pioneer/linuxboot-kernel.nix index 5f8fd815..d7d400e3 100644 --- a/milkv/pioneer/linuxboot-kernel.nix +++ b/milkv/pioneer/linuxboot-kernel.nix @@ -1,4 +1,10 @@ -{ fetchFromGitHub, lib, linuxManualConfig, stdenv, ... }: +{ + fetchFromGitHub, + lib, + linuxManualConfig, + stdenv, + ... +}: linuxManualConfig rec { inherit lib stdenv; diff --git a/milkv/pioneer/sd-image.nix b/milkv/pioneer/sd-image.nix index eaa378c4..dccfdd28 100644 --- a/milkv/pioneer/sd-image.nix +++ b/milkv/pioneer/sd-image.nix @@ -1,4 +1,10 @@ -{ config, lib, modulesPath, pkgs, ... }: +{ + config, + lib, + modulesPath, + pkgs, + ... +}: let inherit (pkgs) callPackage; @@ -10,7 +16,14 @@ let linuxboot-initrd = callPackage ./linuxboot-initrd.nix { }; dtbs = config.hardware.deviceTree.package; firmware = callPackage ./firmware.nix { - inherit fip zsbl opensbi linuxboot-kernel linuxboot-initrd dtbs; + inherit + fip + zsbl + opensbi + linuxboot-kernel + linuxboot-initrd + dtbs + ; }; in { diff --git a/milkv/pioneer/zsbl.nix b/milkv/pioneer/zsbl.nix index a275d301..9890e6fc 100644 --- a/milkv/pioneer/zsbl.nix +++ b/milkv/pioneer/zsbl.nix @@ -1,11 +1,12 @@ -{ buildPackages -, bison -, fetchFromGitHub -, flex -, lib -, stdenv +{ + buildPackages, + bison, + fetchFromGitHub, + flex, + lib, + stdenv, -, ... + ... }: stdenv.mkDerivation rec { pname = "zsbl-sg2042"; diff --git a/minisforum/v3/audio.nix b/minisforum/v3/audio.nix index 029b87ce..0cefc40a 100644 --- a/minisforum/v3/audio.nix +++ b/minisforum/v3/audio.nix @@ -1,7 +1,7 @@ { ... }: { # Fix microphone. - # Based on https://github.com/mudkipme/awesome-minisforum-v3/issues/10#issuecomment-2317474057 (Volume control workaround doesn't work on Arch) + # Based on https://github.com/mudkipme/awesome-minisforum-v3/issues/10#issuecomment-2317474057 (Volume control workaround doesn't work on Arch) boot.extraModprobeConfig = '' options snd-hda-intel model=alc256-asus-aio ''; diff --git a/minisforum/v3/sensors.nix b/minisforum/v3/sensors.nix index 0f336e90..453f29ed 100644 --- a/minisforum/v3/sensors.nix +++ b/minisforum/v3/sensors.nix @@ -5,7 +5,7 @@ hardware.sensor.iio.enable = lib.mkDefault true; services.fprintd.enable = lib.mkDefault true; - + # Override ACPI DSDT to fix the accelerometer. # A driver already exists for a similar sensor. # This overrides the IDs to make the existing driver work. @@ -16,7 +16,7 @@ name = "minisforum-acpi-override"; CPIO_PATH = "kernel/firmware/acpi"; - src = pkgs.callPackage ./src.nix {}; + src = pkgs.callPackage ./src.nix { }; patches = [ ./dsdt.patch ]; nativeBuildInputs = with pkgs; [ diff --git a/morefine/m600/default.nix b/morefine/m600/default.nix index 48790760..a2cae8d8 100644 --- a/morefine/m600/default.nix +++ b/morefine/m600/default.nix @@ -1,4 +1,5 @@ -{ lib, ...}: { +{ lib, ... }: +{ imports = [ ../../common/cpu/amd ../../common/cpu/amd/pstate.nix diff --git a/msi/b350-tomahawk/default.nix b/msi/b350-tomahawk/default.nix index 664c1029..440f32ae 100644 --- a/msi/b350-tomahawk/default.nix +++ b/msi/b350-tomahawk/default.nix @@ -5,5 +5,5 @@ ../../common/pc ]; - boot.kernelModules = ["nct6775"]; + boot.kernelModules = [ "nct6775" ]; } diff --git a/msi/b550-a-pro/default.nix b/msi/b550-a-pro/default.nix index e1070b0e..e1588005 100644 --- a/msi/b550-a-pro/default.nix +++ b/msi/b550-a-pro/default.nix @@ -5,5 +5,5 @@ ../../common/pc ]; - boot.kernelModules = ["nct6683"]; + boot.kernelModules = [ "nct6683" ]; } diff --git a/msi/gl62/default.nix b/msi/gl62/default.nix index 977af651..bae5dea5 100644 --- a/msi/gl62/default.nix +++ b/msi/gl62/default.nix @@ -2,7 +2,7 @@ { imports = [ - ../../common/pc/laptop/ssd + ../../common/pc/ssd ../../common/cpu/intel ../../common/gpu/nvidia/prime.nix ../../common/gpu/nvidia/pascal diff --git a/msi/gl65/10SDR-492/default.nix b/msi/gl65/10SDR-492/default.nix index 75289d4b..f2e56656 100644 --- a/msi/gl65/10SDR-492/default.nix +++ b/msi/gl65/10SDR-492/default.nix @@ -2,7 +2,7 @@ { imports = [ - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ../../../common/cpu/intel/comet-lake ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/turing diff --git a/nxp/common/bsp/imx-atf.nix b/nxp/common/bsp/imx-atf.nix index efd8c43f..3325a13a 100644 --- a/nxp/common/bsp/imx-atf.nix +++ b/nxp/common/bsp/imx-atf.nix @@ -1,7 +1,7 @@ { - buildArmTrustedFirmware , - targetBoard , - fetchgit , + buildArmTrustedFirmware, + targetBoard, + fetchgit, }: { @@ -15,8 +15,11 @@ platform = targetBoard; enableParallelBuilding = true; # To build with tee.bin use extraMakeFlags = [ "bl31 SPD=opteed" ]; - extraMakeFlags = [ "PIE_LDFLAGS=--no-warn-rwx-segments LDFLAGS=--no-warn-rwx-segments" "bl31" ]; - extraMeta.platforms = ["aarch64-linux"]; - filesToInstall = ["build/${targetBoard}/release/bl31.bin"]; + extraMakeFlags = [ + "PIE_LDFLAGS=--no-warn-rwx-segments LDFLAGS=--no-warn-rwx-segments" + "bl31" + ]; + extraMeta.platforms = [ "aarch64-linux" ]; + filesToInstall = [ "build/${targetBoard}/release/bl31.bin" ]; }; } diff --git a/nxp/common/bsp/imx-firmware.nix b/nxp/common/bsp/imx-firmware.nix index 207d7ea2..46e905f8 100644 --- a/nxp/common/bsp/imx-firmware.nix +++ b/nxp/common/bsp/imx-firmware.nix @@ -1,5 +1,5 @@ { - pkgs , + pkgs, targetBoard, }: @@ -47,15 +47,21 @@ pkgs.stdenv.mkDerivation rec { ${firmwareSeco} --auto-accept --force ''; - filesToInstall = [ - "firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/dpfw.bin" - "firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/hdmi?xfw.bin" - ] ++ pkgs.lib.optional ( targetBoard == "imx8qm" ) - ("imx-sc-firmware-${fwScVersion}/mx8qm-mek-scfw-tcm.bin" + " " + - "imx-seco-${fwSecoVersion}/firmware/seco/mx8qmb0-ahab-container.img") - ++ pkgs.lib.optional ( targetBoard == "imx8qxp" ) - ("imx-sc-firmware-${fwScVersion}/mx8qx-mek-scfw-tcm.bin" + " " + - "imx-seco-${fwSecoVersion}/firmware/seco/mx8qxc0-ahab-container.img"); + filesToInstall = + [ + "firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/dpfw.bin" + "firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/hdmi?xfw.bin" + ] + ++ pkgs.lib.optional (targetBoard == "imx8qm") ( + "imx-sc-firmware-${fwScVersion}/mx8qm-mek-scfw-tcm.bin" + + " " + + "imx-seco-${fwSecoVersion}/firmware/seco/mx8qmb0-ahab-container.img" + ) + ++ pkgs.lib.optional (targetBoard == "imx8qxp") ( + "imx-sc-firmware-${fwScVersion}/mx8qx-mek-scfw-tcm.bin" + + " " + + "imx-seco-${fwSecoVersion}/firmware/seco/mx8qxc0-ahab-container.img" + ); installPhase = '' mkdir -p $out diff --git a/nxp/common/bsp/imx-optee-os.nix b/nxp/common/bsp/imx-optee-os.nix index eeef5a85..839d3dcd 100644 --- a/nxp/common/bsp/imx-optee-os.nix +++ b/nxp/common/bsp/imx-optee-os.nix @@ -5,9 +5,9 @@ let pkgsCross = import { - crossSystem = { - config = "aarch64-unknown-linux-gnu"; - }; + crossSystem = { + config = "aarch64-unknown-linux-gnu"; + }; }; outdir = "out/arm-plat-imx/core"; @@ -18,7 +18,7 @@ let in pkgs.stdenv.mkDerivation rec { - + pname = "imx-optee-os"; version = "5.15.32_2.0.0"; diff --git a/nxp/common/bsp/imx-uboot.nix b/nxp/common/bsp/imx-uboot.nix index 25cca39e..c2773f43 100644 --- a/nxp/common/bsp/imx-uboot.nix +++ b/nxp/common/bsp/imx-uboot.nix @@ -1,8 +1,10 @@ -{ pkgs , +{ + pkgs, targetBoard, }: -with pkgs; let +with pkgs; +let inherit buildUBoot; imx8qxp-attrs = { @@ -21,14 +23,25 @@ with pkgs; let patches = [ ../patches/0001-Add-UEFI-boot-for-imx8qm.patch ]; }; - imx8-attrs = if (targetBoard == "imx8qxp") then imx8qxp-attrs - else if (targetBoard == "imx8qm") then imx8qm-attrs - else {}; + imx8-attrs = + if (targetBoard == "imx8qxp") then + imx8qxp-attrs + else if (targetBoard == "imx8qm") then + imx8qm-attrs + else + { }; - inherit (callPackage ./imx-atf.nix { inherit buildArmTrustedFirmware; targetBoard = imx8-attrs.atf; }) armTrustedFirmwareiMX8; + inherit + (callPackage ./imx-atf.nix { + inherit buildArmTrustedFirmware; + targetBoard = imx8-attrs.atf; + }) + armTrustedFirmwareiMX8 + ; imx-firmware = callPackage ./imx-firmware.nix { inherit pkgs targetBoard; }; imx-mkimage = buildPackages.callPackage ./imx-mkimage.nix { inherit pkgs; }; -in { +in +{ ubootImx8 = buildUBoot { version = "2022.04"; src = fetchgit { @@ -41,7 +54,7 @@ in { patches = imx8-attrs.patches; enableParallelBuilding = true; defconfig = "${targetBoard}_mek_defconfig"; - extraMeta.platforms = ["aarch64-linux"]; + extraMeta.platforms = [ "aarch64-linux" ]; preBuildPhases = [ "copyBinaries" ]; copyBinaries = '' @@ -54,10 +67,9 @@ in { cat u-boot.bin head.hash > u-boot-hash.bin dd if=u-boot-hash.bin of=u-boot-atf.bin bs=1K seek=128 ${imx-mkimage} -soc ${imx8-attrs.soc} -rev B0 -append ahab-container.img -c -scfw ${imx8-attrs.scfw} -ap u-boot-atf.bin a35 0x80000000 -out flash.bin - ''; + ''; filesToInstall = [ "flash.bin" ]; }; inherit imx-firmware; } - diff --git a/nxp/common/modules.nix b/nxp/common/modules.nix index 16bf0ca4..e35eb405 100644 --- a/nxp/common/modules.nix +++ b/nxp/common/modules.nix @@ -1,4 +1,5 @@ -{ pkgs, lib, ... }: { +{ pkgs, lib, ... }: +{ nixpkgs.hostPlatform = "aarch64-linux"; boot = { diff --git a/nxp/imx8mp-evk/bsp/imx8mp-atf.nix b/nxp/imx8mp-evk/bsp/imx8mp-atf.nix index 55454c4a..a3ac8107 100644 --- a/nxp/imx8mp-evk/bsp/imx8mp-atf.nix +++ b/nxp/imx8mp-evk/bsp/imx8mp-atf.nix @@ -1,34 +1,65 @@ { lib, - pkgs, - buildArmTrustedFirmware, fetchgit, enable-tee, + stdenv, + buildPackages, + pkgsCross, + openssl, }: -with pkgs; let - opteedflag = - if enable-tee - then "SPD=opteed" - else ""; +let + opteedflag = if enable-tee then "SPD=opteed" else ""; target-board = "imx8mp"; in - buildArmTrustedFirmware rec { - pname = "imx8mp-atf"; - platform = target-board; - enableParallelBuilding = true; - extraMeta.platforms = ["aarch64-linux"]; +stdenv.mkDerivation rec { + pname = "imx8mp-atf"; + version = "lf6.1.55_2.2.0"; + platform = target-board; + enableParallelBuilding = true; - src = fetchgit { - url = "https://github.com/nxp-imx/imx-atf.git"; - #lf6.1.55_2.2.0 - rev = "08e9d4eef2262c0dd072b4325e8919e06d349e02"; - sha256 = "sha256-96EddJXlFEkP/LIGVgNBvUP4IDI3BbDE/c9Yub22gnc="; - }; + src = fetchgit { + url = "https://github.com/nxp-imx/imx-atf.git"; + rev = "08e9d4eef2262c0dd072b4325e8919e06d349e02"; + sha256 = "sha256-96EddJXlFEkP/LIGVgNBvUP4IDI3BbDE/c9Yub22gnc="; + }; - extraMakeFlags = lib.concatLists [ - (lib.optional (lib.versionAtLeast pkgs.binutils.version "2.39") "LDFLAGS=--no-warn-rwx-segments") - ["PLAT=${platform}" "bl31" "${opteedflag}"] - ]; + depsBuildBuild = [ buildPackages.stdenv.cc ]; - filesToInstall = ["build/${target-board}/release/bl31.bin"]; - } + # For Cortex-M0 firmware in RK3399 + nativeBuildInputs = [ pkgsCross.arm-embedded.stdenv.cc ]; + + buildInputs = [ openssl ]; + + makeFlags = [ + "HOSTCC=$(CC_FOR_BUILD)" + "M0_CROSS_COMPILE=${pkgsCross.arm-embedded.stdenv.cc.targetPrefix}" + "CROSS_COMPILE=${stdenv.cc.targetPrefix}" + # binutils 2.39 regression + # `warning: /build/source/build/rk3399/release/bl31/bl31.elf has a LOAD segment with RWX permissions` + # See also: https://developer.trustedfirmware.org/T996 + "LDFLAGS=-no-warn-rwx-segments" + "PLAT=${platform}" + "bl31" + "${opteedflag}" + ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out + cp build/${target-board}/release/bl31.bin $out + + runHook postInstall + ''; + + hardeningDisable = [ "all" ]; + dontStrip = true; + + meta = with lib; { + homepage = "https://github.com/nxp-imx/imx-atf"; + description = "Reference implementation of secure world software for ARMv8-A"; + license = [ licenses.bsd3 ]; + maintainers = with maintainers; [ gngram ]; + platforms = [ "aarch64-linux" ]; + }; +} diff --git a/nxp/imx8mp-evk/bsp/imx8mp-boot.nix b/nxp/imx8mp-evk/bsp/imx8mp-boot.nix index 25e72ccb..8a74f500 100644 --- a/nxp/imx8mp-evk/bsp/imx8mp-boot.nix +++ b/nxp/imx8mp-evk/bsp/imx8mp-boot.nix @@ -2,32 +2,33 @@ pkgs, enable-tee ? true, }: -with pkgs; let +with pkgs; +let fw-ver = "202006"; - cp-tee = - if enable-tee - then "install -m 0644 ${imx8mp-optee-os}/tee.bin ./iMX8M/tee.bin" - else ""; + cp-tee = if enable-tee then "install -m 0644 ${imx8mp-optee-os}/tee.bin ./iMX8M/tee.bin" else ""; imx8mp-atf = pkgs.callPackage ./imx8mp-atf.nix { - inherit (pkgs) buildArmTrustedFirmware; inherit enable-tee; }; - imx8mp-firmware = pkgs.callPackage ./imx8mp-firmware.nix {}; - imx8mp-uboot = pkgs.callPackage ./imx8mp-uboot.nix {}; - imx8mp-optee-os = pkgs.callPackage ./imx8mp-optee-os.nix {}; -in { + imx8mp-firmware = pkgs.callPackage ./imx8mp-firmware.nix { }; + imx8mp-uboot = pkgs.callPackage ./imx8mp-uboot.nix { }; + imx8mp-optee-os = pkgs.callPackage ./imx8mp-optee-os.nix { }; + src = pkgs.fetchgit { + url = "https://github.com/nxp-imx/imx-mkimage.git"; + rev = "c4365450fb115d87f245df2864fee1604d97c06a"; + sha256 = "sha256-KVIVHwBpAwd1RKy3RrYxGIniE45CDlN5RQTXsMg1Jwk="; + }; + shortRev = builtins.substring 0 8 src.rev; +in +{ imx8m-boot = pkgs.stdenv.mkDerivation rec { + inherit src; name = "imx8mp-mkimage"; version = "lf-6.1.55-2.2.0"; - src = pkgs.fetchgit { - url = "https://github.com/nxp-imx/imx-mkimage.git"; - rev = "c4365450fb115d87f245df2864fee1604d97c06a"; - sha256 = "sha256-xycEaWKVM63BlDyBKNN0OefyK6iX/fQOTvv4fRVM55U="; - leaveDotGit = true; - }; postPatch = '' + substituteInPlace Makefile \ + --replace 'git rev-parse --short=8 HEAD' 'echo ${shortRev}' substituteInPlace Makefile \ --replace 'CC = gcc' 'CC = clang' patchShebangs scripts diff --git a/nxp/imx8mp-evk/bsp/imx8mp-firmware.nix b/nxp/imx8mp-evk/bsp/imx8mp-firmware.nix index 5dba9c70..361257fb 100644 --- a/nxp/imx8mp-evk/bsp/imx8mp-firmware.nix +++ b/nxp/imx8mp-evk/bsp/imx8mp-firmware.nix @@ -1,19 +1,19 @@ -{pkgs, ...}: +{ pkgs, ... }: with pkgs; - stdenv.mkDerivation rec { - pname = "imx8mp-firmware"; - version = "8.22"; +stdenv.mkDerivation rec { + pname = "imx8mp-firmware"; + version = "8.22"; - src = pkgs.fetchurl { - url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-${version}.bin"; - sha256 = "sha256-lMi86sVuxQPCMuYU931rvY4Xx9qnHU5lHqj9UDTDA1A="; - }; + src = pkgs.fetchurl { + url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-${version}.bin"; + sha256 = "sha256-lMi86sVuxQPCMuYU931rvY4Xx9qnHU5lHqj9UDTDA1A="; + }; - dontUnpack = true; - dontStrip = true; + dontUnpack = true; + dontStrip = true; - installPhase = '' - ${pkgs.bash}/bin/bash $src --auto-accept --force - mv firmware-imx-${version} $out - ''; - } + installPhase = '' + ${pkgs.bash}/bin/bash $src --auto-accept --force + mv firmware-imx-${version} $out + ''; +} diff --git a/nxp/imx8mp-evk/bsp/imx8mp-optee-os.nix b/nxp/imx8mp-evk/bsp/imx8mp-optee-os.nix index 70789f11..4119efb1 100644 --- a/nxp/imx8mp-evk/bsp/imx8mp-optee-os.nix +++ b/nxp/imx8mp-evk/bsp/imx8mp-optee-os.nix @@ -1,66 +1,67 @@ -{pkgs}: let +{ pkgs }: +let python3 = pkgs.buildPackages.python3; toolchain = pkgs.gcc9Stdenv.cc; binutils = pkgs.gcc9Stdenv.cc.bintools.bintools_bin; cpp = pkgs.gcc; in - pkgs.stdenv.mkDerivation rec { - pname = "imx8mp-optee-os"; - version = "lf-6.1.55-2.2.0"; +pkgs.stdenv.mkDerivation rec { + pname = "imx8mp-optee-os"; + version = "lf-6.1.55-2.2.0"; - nativeBuildInputs = [ - python3 - ]; + nativeBuildInputs = [ + python3 + ]; - enableParallelBuilding = true; + enableParallelBuilding = true; - propagatedBuildInputs = with python3.pkgs; [ - pycryptodomex - pyelftools - cryptography - ]; + propagatedBuildInputs = with python3.pkgs; [ + pycryptodomex + pyelftools + cryptography + ]; - src = pkgs.fetchgit { - url = "https://github.com/nxp-imx/imx-optee-os.git"; - rev = "a303fc80f7c4bd713315687a1fa1d6ed136e78ee"; - sha256 = "sha256-OpyG812DX0c06bRZPKWB2cNu6gtZCOvewDhsKgrGB+s="; - }; + src = pkgs.fetchgit { + url = "https://github.com/nxp-imx/imx-optee-os.git"; + rev = "a303fc80f7c4bd713315687a1fa1d6ed136e78ee"; + sha256 = "sha256-OpyG812DX0c06bRZPKWB2cNu6gtZCOvewDhsKgrGB+s="; + }; - postPatch = '' - substituteInPlace scripts/arm32_sysreg.py \ - --replace '/usr/bin/env python3' '${python3}/bin/python' - substituteInPlace scripts/gen_tee_bin.py \ - --replace '/usr/bin/env python3' '${python3}/bin/python' - substituteInPlace scripts/pem_to_pub_c.py \ - --replace '/usr/bin/env python3' '${python3}/bin/python' - substituteInPlace ta/pkcs11/scripts/verify-helpers.sh \ - --replace '/bin/bash' '${pkgs.bash}/bin/bash' - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))cpp" ${cpp}/bin/cpp - ''; + postPatch = '' + substituteInPlace scripts/arm32_sysreg.py \ + --replace '/usr/bin/env python3' '${python3}/bin/python' + substituteInPlace scripts/gen_tee_bin.py \ + --replace '/usr/bin/env python3' '${python3}/bin/python' + substituteInPlace scripts/pem_to_pub_c.py \ + --replace '/usr/bin/env python3' '${python3}/bin/python' + substituteInPlace ta/pkcs11/scripts/verify-helpers.sh \ + --replace '/bin/bash' '${pkgs.bash}/bin/bash' + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))cpp" ${cpp}/bin/cpp + ''; - makeFlags = [ - "PLATFORM=imx" - "PLATFORM_FLAVOR=mx8mpevk" - "CFG_ARM64_core=y" - "CFG_TEE_TA_LOG_LEVEL=0" - "CFG_TEE_CORE_LOG_LEVEL=0" - "CROSS_COMPILE=${toolchain}/bin/${toolchain.targetPrefix}" - "CROSS_COMPILE64=${toolchain}/bin/${toolchain.targetPrefix}" - ]; + makeFlags = [ + "PLATFORM=imx" + "PLATFORM_FLAVOR=mx8mpevk" + "CFG_ARM64_core=y" + "CFG_TEE_TA_LOG_LEVEL=0" + "CFG_TEE_CORE_LOG_LEVEL=0" + "CROSS_COMPILE=${toolchain}/bin/${toolchain.targetPrefix}" + "CROSS_COMPILE64=${toolchain}/bin/${toolchain.targetPrefix}" + ]; - installPhase = '' - mkdir -p $out - cp ./out/arm-plat-imx/core/tee-raw.bin $out/tee.bin - ''; - } + installPhase = '' + mkdir -p $out + cp ./out/arm-plat-imx/core/tee-raw.bin $out/tee.bin + ''; +} diff --git a/nxp/imx8mp-evk/bsp/imx8mp-uboot.nix b/nxp/imx8mp-evk/bsp/imx8mp-uboot.nix index c542af22..14586d47 100644 --- a/nxp/imx8mp-evk/bsp/imx8mp-uboot.nix +++ b/nxp/imx8mp-evk/bsp/imx8mp-uboot.nix @@ -1,90 +1,91 @@ -{ stdenv -, lib -, bison -, dtc -, fetchgit -, flex -, gnutls -, libuuid -, ncurses -, openssl -, which -, perl -, buildPackages +{ + stdenv, + lib, + bison, + dtc, + fetchgit, + flex, + gnutls, + libuuid, + ncurses, + openssl, + which, + perl, + buildPackages, }: let ubsrc = fetchgit { - url = "https://github.com/nxp-imx/uboot-imx.git"; - # tag: "lf-6.1.55-2.2.0" - rev = "49b102d98881fc28af6e0a8af5ea2186c1d90a5f"; - sha256 = "sha256-1j6X82DqezEizeWoSS600XKPNwrQ4yT0vZuUImKAVVA="; - }; + url = "https://github.com/nxp-imx/uboot-imx.git"; + # tag: "lf-6.1.55-2.2.0" + rev = "49b102d98881fc28af6e0a8af5ea2186c1d90a5f"; + sha256 = "sha256-1j6X82DqezEizeWoSS600XKPNwrQ4yT0vZuUImKAVVA="; + }; in - (stdenv.mkDerivation { - pname = "imx8mp-uboot"; - version = "2023.04"; - src = ubsrc; +(stdenv.mkDerivation { + pname = "imx8mp-uboot"; + version = "2023.04"; + src = ubsrc; - postPatch = '' - patchShebangs tools - patchShebangs scripts - ''; + postPatch = '' + patchShebangs tools + patchShebangs scripts + ''; - nativeBuildInputs = [ - bison - flex - openssl - which - ncurses - libuuid - gnutls - openssl - perl - ]; + nativeBuildInputs = [ + bison + flex + openssl + which + ncurses + libuuid + gnutls + openssl + perl + ]; - depsBuildBuild = [ buildPackages.stdenv.cc ]; - hardeningDisable = [ "all" ]; - enableParallelBuilding = true; + depsBuildBuild = [ buildPackages.stdenv.cc ]; + hardeningDisable = [ "all" ]; + enableParallelBuilding = true; - makeFlags = [ - "DTC=${lib.getExe buildPackages.dtc}" - "CROSS_COMPILE=${stdenv.cc.targetPrefix}" - ]; + makeFlags = [ + "DTC=${lib.getExe buildPackages.dtc}" + "CROSS_COMPILE=${stdenv.cc.targetPrefix}" + ]; - extraConfig = '' - CONFIG_USE_BOOTCOMMAND=y - CONFIG_BOOTCOMMAND="setenv ramdisk_addr_r 0x45000000; setenv fdt_addr_r 0x44000000; run distro_bootcmd; " - CONFIG_CMD_BOOTEFI_SELFTEST=y - CONFIG_CMD_BOOTEFI=y - CONFIG_EFI_LOADER=y - CONFIG_BLK=y - CONFIG_PARTITIONS=y - CONFIG_DM_DEVICE_REMOVE=n - CONFIG_CMD_CACHE=y - ''; + extraConfig = '' + CONFIG_USE_BOOTCOMMAND=y + CONFIG_BOOTCOMMAND="setenv ramdisk_addr_r 0x45000000; setenv fdt_addr_r 0x44000000; run distro_bootcmd; " + CONFIG_CMD_BOOTEFI_SELFTEST=y + CONFIG_CMD_BOOTEFI=y + CONFIG_EFI_LOADER=y + CONFIG_BLK=y + CONFIG_PARTITIONS=y + CONFIG_DM_DEVICE_REMOVE=n + CONFIG_CMD_CACHE=y + ''; - passAsFile = [ "extraConfig" ]; + passAsFile = [ "extraConfig" ]; - configurePhase = '' - runHook preConfigure + configurePhase = '' + runHook preConfigure - make imx8mp_evk_defconfig - cat $extraConfigPath >> .config + make imx8mp_evk_defconfig + cat $extraConfigPath >> .config - runHook postConfigure - ''; + runHook postConfigure + ''; - installPhase = '' - runHook preInstall + installPhase = '' + runHook preInstall - mkdir -p $out - cp ./u-boot-nodtb.bin $out - cp ./spl/u-boot-spl.bin $out - cp ./arch/arm/dts/imx8mp-evk.dtb $out - cp .config $out + mkdir -p $out + cp ./u-boot-nodtb.bin $out + cp ./spl/u-boot-spl.bin $out + cp ./arch/arm/dts/imx8mp-evk.dtb $out + cp .config $out - runHook postInstall - ''; + runHook postInstall + ''; - dontStrip = true; - }) + dontStrip = true; +}) diff --git a/nxp/imx8mp-evk/default.nix b/nxp/imx8mp-evk/default.nix index c4ba0505..13ec359a 100644 --- a/nxp/imx8mp-evk/default.nix +++ b/nxp/imx8mp-evk/default.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ nixpkgs.overlays = [ (import ./overlay.nix) ]; @@ -8,7 +9,7 @@ ]; boot.loader.grub.extraFiles = { - "imx8mp-evk.dtb" = "${pkgs.callPackage ./bsp/imx8mp-linux.nix {}}/dtbs/freescale/imx8mp-evk.dtb"; + "imx8mp-evk.dtb" = "${pkgs.callPackage ./bsp/imx8mp-linux.nix { }}/dtbs/freescale/imx8mp-evk.dtb"; }; hardware.deviceTree = { diff --git a/nxp/imx8mp-evk/modules.nix b/nxp/imx8mp-evk/modules.nix index d53f60d2..ec4e28f7 100644 --- a/nxp/imx8mp-evk/modules.nix +++ b/nxp/imx8mp-evk/modules.nix @@ -2,15 +2,16 @@ pkgs, lib, ... -}: { +}: +{ nixpkgs.hostPlatform = "aarch64-linux"; boot = { - kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./bsp/imx8mp-linux.nix {}); + kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./bsp/imx8mp-linux.nix { }); initrd.includeDefaultModules = lib.mkForce false; }; - disabledModules = ["profiles/all-hardware.nix"]; + disabledModules = [ "profiles/all-hardware.nix" ]; hardware.deviceTree.enable = true; } diff --git a/nxp/imx8mp-evk/overlay.nix b/nxp/imx8mp-evk/overlay.nix index 7f5d0c71..72166a37 100644 --- a/nxp/imx8mp-evk/overlay.nix +++ b/nxp/imx8mp-evk/overlay.nix @@ -1,3 +1,3 @@ -final: prev: { - inherit (final.callPackage ./bsp/imx8mp-boot.nix {pkgs = final;}) imx8m-boot; +final: _prev: { + inherit (final.callPackage ./bsp/imx8mp-boot.nix { pkgs = final; }) imx8m-boot; } diff --git a/nxp/imx8mq-evk/bsp/imx8mq-atf.nix b/nxp/imx8mq-evk/bsp/imx8mq-atf.nix index 0d5028d6..151008bf 100644 --- a/nxp/imx8mq-evk/bsp/imx8mq-atf.nix +++ b/nxp/imx8mq-evk/bsp/imx8mq-atf.nix @@ -1,34 +1,65 @@ { lib, - pkgs, - buildArmTrustedFirmware, fetchgit, enable-tee, + stdenv, + buildPackages, + pkgsCross, + openssl, }: -with pkgs; let - opteedflag = - if enable-tee - then "SPD=opteed" - else ""; +let + opteedflag = if enable-tee then "SPD=opteed" else ""; target-board = "imx8mq"; in - buildArmTrustedFirmware rec { - pname = "imx8mq-atf"; - platform = target-board; - enableParallelBuilding = true; - extraMeta.platforms = ["aarch64-linux"]; +stdenv.mkDerivation rec { + pname = "imx8mq-atf"; + version = "lf6.1.55_2.2.0"; + platform = target-board; + enableParallelBuilding = true; - src = fetchgit { - url = "https://github.com/nxp-imx/imx-atf.git"; - #lf6.1.55_2.2.0 - rev = "08e9d4eef2262c0dd072b4325e8919e06d349e02"; - sha256 = "sha256-96EddJXlFEkP/LIGVgNBvUP4IDI3BbDE/c9Yub22gnc="; - }; + src = fetchgit { + url = "https://github.com/nxp-imx/imx-atf.git"; + rev = "08e9d4eef2262c0dd072b4325e8919e06d349e02"; + sha256 = "sha256-96EddJXlFEkP/LIGVgNBvUP4IDI3BbDE/c9Yub22gnc="; + }; - extraMakeFlags = lib.concatLists [ - (lib.optional (lib.versionAtLeast pkgs.binutils.version "2.39") "LDFLAGS=--no-warn-rwx-segments") - ["PLAT=${platform}" "bl31" "${opteedflag}"] - ]; + depsBuildBuild = [ buildPackages.stdenv.cc ]; - filesToInstall = ["build/${target-board}/release/bl31.bin"]; - } + # For Cortex-M0 firmware in RK3399 + nativeBuildInputs = [ pkgsCross.arm-embedded.stdenv.cc ]; + + buildInputs = [ openssl ]; + + makeFlags = [ + "HOSTCC=$(CC_FOR_BUILD)" + "M0_CROSS_COMPILE=${pkgsCross.arm-embedded.stdenv.cc.targetPrefix}" + "CROSS_COMPILE=${stdenv.cc.targetPrefix}" + # binutils 2.39 regression + # `warning: /build/source/build/rk3399/release/bl31/bl31.elf has a LOAD segment with RWX permissions` + # See also: https://developer.trustedfirmware.org/T996 + "LDFLAGS=-no-warn-rwx-segments" + "PLAT=${platform}" + "bl31" + "${opteedflag}" + ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out + cp build/${target-board}/release/bl31.bin $out + + runHook postInstall + ''; + + hardeningDisable = [ "all" ]; + dontStrip = true; + + meta = with lib; { + homepage = "https://github.com/nxp-imx/imx-atf"; + description = "Reference implementation of secure world software for ARMv8-A"; + license = [ licenses.bsd3 ]; + maintainers = with maintainers; [ gngram ]; + platforms = [ "aarch64-linux" ]; + }; +} diff --git a/nxp/imx8mq-evk/bsp/imx8mq-boot.nix b/nxp/imx8mq-evk/bsp/imx8mq-boot.nix index 72fcfc0a..f38b3501 100644 --- a/nxp/imx8mq-evk/bsp/imx8mq-boot.nix +++ b/nxp/imx8mq-evk/bsp/imx8mq-boot.nix @@ -2,31 +2,32 @@ pkgs, enable-tee ? false, }: -with pkgs; let - cp-tee = - if enable-tee - then "install -m 0644 ${imx8mq-optee-os}/tee.bin ./iMX8M/tee.bin" - else ""; +with pkgs; +let + cp-tee = if enable-tee then "install -m 0644 ${imx8mq-optee-os}/tee.bin ./iMX8M/tee.bin" else ""; imx8mq-atf = pkgs.callPackage ./imx8mq-atf.nix { - inherit (pkgs) buildArmTrustedFirmware; inherit enable-tee; }; - imx8mq-firmware = pkgs.callPackage ./imx8mq-firmware.nix {}; - imx8mq-uboot = pkgs.callPackage ./imx8mq-uboot.nix {}; - imx8mq-optee-os = pkgs.callPackage ./imx8mq-optee-os.nix {}; -in { + imx8mq-firmware = pkgs.callPackage ./imx8mq-firmware.nix { }; + imx8mq-uboot = pkgs.callPackage ./imx8mq-uboot.nix { }; + imx8mq-optee-os = pkgs.callPackage ./imx8mq-optee-os.nix { }; + src = pkgs.fetchgit { + url = "https://github.com/nxp-imx/imx-mkimage.git"; + rev = "c4365450fb115d87f245df2864fee1604d97c06a"; + sha256 = "sha256-KVIVHwBpAwd1RKy3RrYxGIniE45CDlN5RQTXsMg1Jwk="; + }; + shortRev = builtins.substring 0 8 src.rev; +in +{ imx8m-boot = pkgs.stdenv.mkDerivation rec { + inherit src; name = "imx8mq-mkimage"; version = "lf-6.1.55-2.2.0"; - src = pkgs.fetchgit { - url = "https://github.com/nxp-imx/imx-mkimage.git"; - rev = "c4365450fb115d87f245df2864fee1604d97c06a"; - sha256 = "sha256-xycEaWKVM63BlDyBKNN0OefyK6iX/fQOTvv4fRVM55U="; - leaveDotGit = true; - }; postPatch = '' + substituteInPlace Makefile \ + --replace 'git rev-parse --short=8 HEAD' 'echo ${shortRev}' substituteInPlace Makefile \ --replace 'CC = gcc' 'CC = clang' patchShebangs scripts diff --git a/nxp/imx8mq-evk/bsp/imx8mq-firmware.nix b/nxp/imx8mq-evk/bsp/imx8mq-firmware.nix index e576f87f..05dba5f3 100644 --- a/nxp/imx8mq-evk/bsp/imx8mq-firmware.nix +++ b/nxp/imx8mq-evk/bsp/imx8mq-firmware.nix @@ -1,19 +1,19 @@ -{pkgs, ...}: +{ pkgs, ... }: with pkgs; - stdenv.mkDerivation rec { - pname = "imx8mq-firmware"; - version = "8.22"; +stdenv.mkDerivation rec { + pname = "imx8mq-firmware"; + version = "8.22"; - src = pkgs.fetchurl { - url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-${version}.bin"; - sha256 = "sha256-lMi86sVuxQPCMuYU931rvY4Xx9qnHU5lHqj9UDTDA1A="; - }; + src = pkgs.fetchurl { + url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-${version}.bin"; + sha256 = "sha256-lMi86sVuxQPCMuYU931rvY4Xx9qnHU5lHqj9UDTDA1A="; + }; - dontUnpack = true; - dontStrip = true; + dontUnpack = true; + dontStrip = true; - installPhase = '' - ${pkgs.bash}/bin/bash $src --auto-accept --force - mv firmware-imx-${version} $out - ''; - } + installPhase = '' + ${pkgs.bash}/bin/bash $src --auto-accept --force + mv firmware-imx-${version} $out + ''; +} diff --git a/nxp/imx8mq-evk/bsp/imx8mq-linux.nix b/nxp/imx8mq-evk/bsp/imx8mq-linux.nix index 8e433b8c..5c2fb535 100644 --- a/nxp/imx8mq-evk/bsp/imx8mq-linux.nix +++ b/nxp/imx8mq-evk/bsp/imx8mq-linux.nix @@ -1,54 +1,56 @@ -{pkgs, ...} @ args: +{ pkgs, ... }@args: with pkgs; - buildLinux (args - // rec { - version = "6.1.55"; - name = "imx8mq-linux"; +buildLinux ( + args + // rec { + version = "6.1.55"; + name = "imx8mq-linux"; - # modDirVersion needs to be x.y.z, will automatically add .0 if needed - modDirVersion = version; + # modDirVersion needs to be x.y.z, will automatically add .0 if needed + modDirVersion = version; - defconfig = "imx_v8_defconfig"; + defconfig = "imx_v8_defconfig"; - # https://github.com/NixOS/nixpkgs/pull/366004 - # introduced a breaking change that if a module is declared but it is not being used it will faill. - ignoreConfigErrors = true; + # https://github.com/NixOS/nixpkgs/pull/366004 + # introduced a breaking change that if a module is declared but it is not being used it will faill. + ignoreConfigErrors = true; - kernelPatches = [ - ]; + kernelPatches = [ + ]; - autoModules = false; + autoModules = false; - extraConfig = '' - CRYPTO_TLS m - TLS y - MD_RAID0 m - MD_RAID1 m - MD_RAID10 m - MD_RAID456 m - DM_VERITY m - LOGO y - FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER n - FB_EFI n - EFI_STUB y - EFI y - VIRTIO y - VIRTIO_PCI y - VIRTIO_BLK y - DRM_VIRTIO_GPU y - EXT4_FS y - USBIP_CORE m - USBIP_VHCI_HCD m - USBIP_HOST m - USBIP_VUDC m - ''; + extraConfig = '' + CRYPTO_TLS m + TLS y + MD_RAID0 m + MD_RAID1 m + MD_RAID10 m + MD_RAID456 m + DM_VERITY m + LOGO y + FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER n + FB_EFI n + EFI_STUB y + EFI y + VIRTIO y + VIRTIO_PCI y + VIRTIO_BLK y + DRM_VIRTIO_GPU y + EXT4_FS y + USBIP_CORE m + USBIP_VHCI_HCD m + USBIP_HOST m + USBIP_VUDC m + ''; - src = fetchFromGitHub { - owner = "nxp-imx"; - repo = "linux-imx"; - # tag: lf-6.1.55-2.2.0 - rev = "770c5fe2c1d1529fae21b7043911cd50c6cf087e"; - sha256 = "sha256-tIWt75RUrjB6KmUuAYBVyAC1dmVGSUAgqV5ROJh3xU0="; - }; - } - // (args.argsOverride or {})) + src = fetchFromGitHub { + owner = "nxp-imx"; + repo = "linux-imx"; + # tag: lf-6.1.55-2.2.0 + rev = "770c5fe2c1d1529fae21b7043911cd50c6cf087e"; + sha256 = "sha256-tIWt75RUrjB6KmUuAYBVyAC1dmVGSUAgqV5ROJh3xU0="; + }; + } + // (args.argsOverride or { }) +) diff --git a/nxp/imx8mq-evk/bsp/imx8mq-optee-os.nix b/nxp/imx8mq-evk/bsp/imx8mq-optee-os.nix index 4fa6e3e5..73b60a35 100644 --- a/nxp/imx8mq-evk/bsp/imx8mq-optee-os.nix +++ b/nxp/imx8mq-evk/bsp/imx8mq-optee-os.nix @@ -1,66 +1,67 @@ -{pkgs}: let +{ pkgs }: +let python3 = pkgs.buildPackages.python3; toolchain = pkgs.gcc9Stdenv.cc; binutils = pkgs.gcc9Stdenv.cc.bintools.bintools_bin; cpp = pkgs.gcc; in - pkgs.stdenv.mkDerivation rec { - pname = "imx8mq-optee-os"; - version = "lf-6.1.55-2.2.0"; +pkgs.stdenv.mkDerivation rec { + pname = "imx8mq-optee-os"; + version = "lf-6.1.55-2.2.0"; - nativeBuildInputs = [ - python3 - ]; + nativeBuildInputs = [ + python3 + ]; - enableParallelBuilding = true; + enableParallelBuilding = true; - propagatedBuildInputs = with python3.pkgs; [ - pycryptodomex - pyelftools - cryptography - ]; + propagatedBuildInputs = with python3.pkgs; [ + pycryptodomex + pyelftools + cryptography + ]; - src = pkgs.fetchgit { - url = "https://github.com/nxp-imx/imx-optee-os.git"; - rev = "a303fc80f7c4bd713315687a1fa1d6ed136e78ee"; - sha256 = "sha256-OpyG812DX0c06bRZPKWB2cNu6gtZCOvewDhsKgrGB+s="; - }; + src = pkgs.fetchgit { + url = "https://github.com/nxp-imx/imx-optee-os.git"; + rev = "a303fc80f7c4bd713315687a1fa1d6ed136e78ee"; + sha256 = "sha256-OpyG812DX0c06bRZPKWB2cNu6gtZCOvewDhsKgrGB+s="; + }; - postPatch = '' - substituteInPlace scripts/arm32_sysreg.py \ - --replace '/usr/bin/env python3' '${python3}/bin/python' - substituteInPlace scripts/gen_tee_bin.py \ - --replace '/usr/bin/env python3' '${python3}/bin/python' - substituteInPlace scripts/pem_to_pub_c.py \ - --replace '/usr/bin/env python3' '${python3}/bin/python' - substituteInPlace ta/pkcs11/scripts/verify-helpers.sh \ - --replace '/bin/bash' '${pkgs.bash}/bin/bash' - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))cpp" ${cpp}/bin/cpp - ''; + postPatch = '' + substituteInPlace scripts/arm32_sysreg.py \ + --replace '/usr/bin/env python3' '${python3}/bin/python' + substituteInPlace scripts/gen_tee_bin.py \ + --replace '/usr/bin/env python3' '${python3}/bin/python' + substituteInPlace scripts/pem_to_pub_c.py \ + --replace '/usr/bin/env python3' '${python3}/bin/python' + substituteInPlace ta/pkcs11/scripts/verify-helpers.sh \ + --replace '/bin/bash' '${pkgs.bash}/bin/bash' + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))cpp" ${cpp}/bin/cpp + ''; - makeFlags = [ - "PLATFORM=imx" - "PLATFORM_FLAVOR=mx8mqevk" - "CFG_ARM64_core=y" - "CFG_TEE_TA_LOG_LEVEL=0" - "CFG_TEE_CORE_LOG_LEVEL=0" - "CROSS_COMPILE=${toolchain}/bin/${toolchain.targetPrefix}" - "CROSS_COMPILE64=${toolchain}/bin/${toolchain.targetPrefix}" - ]; + makeFlags = [ + "PLATFORM=imx" + "PLATFORM_FLAVOR=mx8mqevk" + "CFG_ARM64_core=y" + "CFG_TEE_TA_LOG_LEVEL=0" + "CFG_TEE_CORE_LOG_LEVEL=0" + "CROSS_COMPILE=${toolchain}/bin/${toolchain.targetPrefix}" + "CROSS_COMPILE64=${toolchain}/bin/${toolchain.targetPrefix}" + ]; - installPhase = '' - mkdir -p $out - cp ./out/arm-plat-imx/core/tee-raw.bin $out/tee.bin - ''; - } + installPhase = '' + mkdir -p $out + cp ./out/arm-plat-imx/core/tee-raw.bin $out/tee.bin + ''; +} diff --git a/nxp/imx8mq-evk/bsp/imx8mq-uboot.nix b/nxp/imx8mq-evk/bsp/imx8mq-uboot.nix index fbbf92a1..7bb9c2df 100644 --- a/nxp/imx8mq-evk/bsp/imx8mq-uboot.nix +++ b/nxp/imx8mq-evk/bsp/imx8mq-uboot.nix @@ -1,90 +1,91 @@ -{ stdenv -, lib -, bison -, dtc -, fetchgit -, flex -, gnutls -, libuuid -, ncurses -, openssl -, which -, perl -, buildPackages +{ + stdenv, + lib, + bison, + dtc, + fetchgit, + flex, + gnutls, + libuuid, + ncurses, + openssl, + which, + perl, + buildPackages, }: let ubsrc = fetchgit { - url = "https://github.com/nxp-imx/uboot-imx.git"; - # tag: "lf-6.1.55-2.2.0" - rev = "49b102d98881fc28af6e0a8af5ea2186c1d90a5f"; - sha256 = "sha256-1j6X82DqezEizeWoSS600XKPNwrQ4yT0vZuUImKAVVA="; - }; + url = "https://github.com/nxp-imx/uboot-imx.git"; + # tag: "lf-6.1.55-2.2.0" + rev = "49b102d98881fc28af6e0a8af5ea2186c1d90a5f"; + sha256 = "sha256-1j6X82DqezEizeWoSS600XKPNwrQ4yT0vZuUImKAVVA="; + }; in - (stdenv.mkDerivation { - pname = "imx8mq-uboot"; - version = "2023.04"; - src = ubsrc; +(stdenv.mkDerivation { + pname = "imx8mq-uboot"; + version = "2023.04"; + src = ubsrc; - postPatch = '' - patchShebangs tools - patchShebangs scripts - ''; + postPatch = '' + patchShebangs tools + patchShebangs scripts + ''; - nativeBuildInputs = [ - bison - flex - openssl - which - ncurses - libuuid - gnutls - openssl - perl - ]; + nativeBuildInputs = [ + bison + flex + openssl + which + ncurses + libuuid + gnutls + openssl + perl + ]; - depsBuildBuild = [ buildPackages.stdenv.cc ]; - hardeningDisable = [ "all" ]; - enableParallelBuilding = true; + depsBuildBuild = [ buildPackages.stdenv.cc ]; + hardeningDisable = [ "all" ]; + enableParallelBuilding = true; - makeFlags = [ - "DTC=${lib.getExe buildPackages.dtc}" - "CROSS_COMPILE=${stdenv.cc.targetPrefix}" - ]; + makeFlags = [ + "DTC=${lib.getExe buildPackages.dtc}" + "CROSS_COMPILE=${stdenv.cc.targetPrefix}" + ]; - extraConfig = '' - CONFIG_USE_BOOTCOMMAND=y - CONFIG_BOOTCOMMAND="setenv ramdisk_addr_r 0x45000000; setenv fdt_addr_r 0x44000000; run distro_bootcmd; " - CONFIG_CMD_BOOTEFI_SELFTEST=y - CONFIG_CMD_BOOTEFI=y - CONFIG_EFI_LOADER=y - CONFIG_BLK=y - CONFIG_PARTITIONS=y - CONFIG_DM_DEVICE_REMOVE=n - CONFIG_CMD_CACHE=y - ''; + extraConfig = '' + CONFIG_USE_BOOTCOMMAND=y + CONFIG_BOOTCOMMAND="setenv ramdisk_addr_r 0x45000000; setenv fdt_addr_r 0x44000000; run distro_bootcmd; " + CONFIG_CMD_BOOTEFI_SELFTEST=y + CONFIG_CMD_BOOTEFI=y + CONFIG_EFI_LOADER=y + CONFIG_BLK=y + CONFIG_PARTITIONS=y + CONFIG_DM_DEVICE_REMOVE=n + CONFIG_CMD_CACHE=y + ''; - passAsFile = [ "extraConfig" ]; + passAsFile = [ "extraConfig" ]; - configurePhase = '' - runHook preConfigure + configurePhase = '' + runHook preConfigure - make imx8mq_evk_defconfig - cat $extraConfigPath >> .config + make imx8mq_evk_defconfig + cat $extraConfigPath >> .config - runHook postConfigure - ''; + runHook postConfigure + ''; - installPhase = '' - runHook preInstall + installPhase = '' + runHook preInstall - mkdir -p $out - cp ./u-boot-nodtb.bin $out - cp ./spl/u-boot-spl.bin $out - cp ./arch/arm/dts/imx8mq-evk.dtb $out - cp .config $out + mkdir -p $out + cp ./u-boot-nodtb.bin $out + cp ./spl/u-boot-spl.bin $out + cp ./arch/arm/dts/imx8mq-evk.dtb $out + cp .config $out - runHook postInstall - ''; + runHook postInstall + ''; - dontStrip = true; - }) + dontStrip = true; +}) diff --git a/nxp/imx8mq-evk/default.nix b/nxp/imx8mq-evk/default.nix index ca35c269..95504599 100644 --- a/nxp/imx8mq-evk/default.nix +++ b/nxp/imx8mq-evk/default.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ nixpkgs.overlays = [ (import ./overlay.nix) ]; @@ -8,7 +9,7 @@ ]; boot.loader.grub.extraFiles = { - "imx8mq-evk.dtb" = "${pkgs.callPackage ./bsp/imx8mq-linux.nix {}}/dtbs/freescale/imx8mq-evk.dtb"; + "imx8mq-evk.dtb" = "${pkgs.callPackage ./bsp/imx8mq-linux.nix { }}/dtbs/freescale/imx8mq-evk.dtb"; }; hardware.deviceTree = { diff --git a/nxp/imx8mq-evk/modules.nix b/nxp/imx8mq-evk/modules.nix index 4408bebc..0307d133 100644 --- a/nxp/imx8mq-evk/modules.nix +++ b/nxp/imx8mq-evk/modules.nix @@ -2,15 +2,16 @@ pkgs, lib, ... -}: { +}: +{ nixpkgs.hostPlatform = "aarch64-linux"; boot = { - kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./bsp/imx8mq-linux.nix {}); + kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./bsp/imx8mq-linux.nix { }); initrd.includeDefaultModules = lib.mkForce false; }; - disabledModules = ["profiles/all-hardware.nix"]; + disabledModules = [ "profiles/all-hardware.nix" ]; hardware.deviceTree.enable = true; } diff --git a/nxp/imx8mq-evk/overlay.nix b/nxp/imx8mq-evk/overlay.nix index 31af2bdc..ea53ce88 100644 --- a/nxp/imx8mq-evk/overlay.nix +++ b/nxp/imx8mq-evk/overlay.nix @@ -1,3 +1,3 @@ -final: prev: { - inherit (final.callPackage ./bsp/imx8mq-boot.nix {pkgs = final;}) imx8m-boot; +final: _prev: { + inherit (final.callPackage ./bsp/imx8mq-boot.nix { pkgs = final; }) imx8m-boot; } diff --git a/nxp/imx8qm-mek/default.nix b/nxp/imx8qm-mek/default.nix index 4974455c..52c8697f 100644 --- a/nxp/imx8qm-mek/default.nix +++ b/nxp/imx8qm-mek/default.nix @@ -10,7 +10,9 @@ ]; boot.loader.grub.extraFiles = { - "imx8qm-mek.dtb" = "${pkgs.callPackage ../common/bsp/linux-imx8.nix { }}/dtbs/freescale/imx8qm-mek.dtb"; + "imx8qm-mek.dtb" = "${ + pkgs.callPackage ../common/bsp/linux-imx8.nix { } + }/dtbs/freescale/imx8qm-mek.dtb"; }; hardware.deviceTree = { diff --git a/nxp/imx8qm-mek/overlay.nix b/nxp/imx8qm-mek/overlay.nix index db250883..12d1d946 100644 --- a/nxp/imx8qm-mek/overlay.nix +++ b/nxp/imx8qm-mek/overlay.nix @@ -1,3 +1,10 @@ -final: prev: { - inherit ( final.callPackage ../common/bsp/imx-uboot.nix { pkgs = final; targetBoard = "imx8qm"; }) ubootImx8 imx-firmware; +final: _prev: { + inherit + (final.callPackage ../common/bsp/imx-uboot.nix { + pkgs = final; + targetBoard = "imx8qm"; + }) + ubootImx8 + imx-firmware + ; } diff --git a/nxp/imx8qxp-mek/overlay.nix b/nxp/imx8qxp-mek/overlay.nix index 21b339d7..bcb344b7 100644 --- a/nxp/imx8qxp-mek/overlay.nix +++ b/nxp/imx8qxp-mek/overlay.nix @@ -1,3 +1,10 @@ -final: prev: { - inherit ( final.callPackage ../common/bsp/imx-uboot.nix { pkgs = final; targetBoard = "imx8qxp"; }) ubootImx8 imx-firmware; +final: _prev: { + inherit + (final.callPackage ../common/bsp/imx-uboot.nix { + pkgs = final; + targetBoard = "imx8qxp"; + }) + ubootImx8 + imx-firmware + ; } diff --git a/olimex/teres_i/default.nix b/olimex/teres_i/default.nix index f72cb1d4..4f2c97d5 100644 --- a/olimex/teres_i/default.nix +++ b/olimex/teres_i/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ...}: +{ lib, pkgs, ... }: { hardware.deviceTree = { @@ -10,12 +10,12 @@ consoleLogLevel = lib.mkDefault 7; kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; - kernelParams = lib.mkDefault ["console=ttyS0,115200n8"]; - extraModulePackages = lib.mkDefault []; + kernelParams = lib.mkDefault [ "console=ttyS0,115200n8" ]; + extraModulePackages = lib.mkDefault [ ]; initrd = { - availableKernelModules = lib.mkDefault ["usbhid"]; - kernelModules = lib.mkDefault []; + availableKernelModules = lib.mkDefault [ "usbhid" ]; + kernelModules = lib.mkDefault [ ]; }; loader = { diff --git a/omen/14-fb0798ng/default.nix b/omen/14-fb0798ng/default.nix index b1382455..f5cc17d7 100644 --- a/omen/14-fb0798ng/default.nix +++ b/omen/14-fb0798ng/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ config, lib, ... }: { imports = [ @@ -10,7 +10,7 @@ ]; # Enables ACPI platform profiles - boot = lib.mkIf (lib.versionAtLeast pkgs.linux.version "6.1") { + boot = lib.mkIf (lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.1") { kernelModules = [ "hp-wmi" ]; }; diff --git a/omen/15-ce002ns/default.nix b/omen/15-ce002ns/default.nix index c787d3a0..990d59f8 100644 --- a/omen/15-ce002ns/default.nix +++ b/omen/15-ce002ns/default.nix @@ -5,7 +5,7 @@ ../../common/cpu/intel/kaby-lake ../../common/gpu/nvidia/pascal ../../common/pc/laptop - ../../common/pc/laptop/ssd + ../../common/pc/ssd ../../common/pc/laptop/hdd ]; } diff --git a/omen/15-en0010ca/default.nix b/omen/15-en0010ca/default.nix index da3c85e8..c99e8066 100644 --- a/omen/15-en0010ca/default.nix +++ b/omen/15-en0010ca/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ config, lib, ... }: { imports = [ @@ -12,7 +12,7 @@ ]; # Enables ACPI platform profiles - boot = lib.mkIf (lib.versionAtLeast pkgs.linux.version "6.1") { + boot = lib.mkIf (lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.1") { kernelModules = [ "hp-wmi" ]; }; diff --git a/omen/15-en1007sa/default.nix b/omen/15-en1007sa/default.nix index 704e4d8b..cdb09a82 100644 --- a/omen/15-en1007sa/default.nix +++ b/omen/15-en1007sa/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ config, lib, ... }: { imports = [ @@ -11,7 +11,7 @@ ]; # Enables ACPI platform profiles - boot = lib.mkIf (lib.versionAtLeast pkgs.linux.version "6.1") { + boot = lib.mkIf (lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.1") { kernelModules = [ "hp-wmi" ]; }; diff --git a/omen/16-n0005ne/default.nix b/omen/16-n0005ne/default.nix index e8bfea83..c8d5636c 100644 --- a/omen/16-n0005ne/default.nix +++ b/omen/16-n0005ne/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ config, lib, ... }: { imports = [ @@ -10,7 +10,7 @@ ]; # Enables ACPI platform profiles - boot = lib.mkIf (lib.versionAtLeast pkgs.linux.version "6.1") { + boot = lib.mkIf (lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.1") { kernelModules = [ "hp-wmi" ]; }; } diff --git a/omen/16-n0280nd/default.nix b/omen/16-n0280nd/default.nix index 704e4d8b..cdb09a82 100644 --- a/omen/16-n0280nd/default.nix +++ b/omen/16-n0280nd/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ config, lib, ... }: { imports = [ @@ -11,7 +11,7 @@ ]; # Enables ACPI platform profiles - boot = lib.mkIf (lib.versionAtLeast pkgs.linux.version "6.1") { + boot = lib.mkIf (lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.1") { kernelModules = [ "hp-wmi" ]; }; diff --git a/onenetbook/4/default.nix b/onenetbook/4/default.nix index 6b108b4c..c0b77f94 100644 --- a/onenetbook/4/default.nix +++ b/onenetbook/4/default.nix @@ -4,7 +4,7 @@ imports = [ ../../common/cpu/intel ../../common/pc/laptop - ../../common/pc/laptop/ssd + ../../common/pc/ssd ]; # OneNetbook 4 has `GXTP7386:00 27C6:011A Stylus` exporting no buttons in 5.12 @@ -16,7 +16,7 @@ # `hid-multitouch-onenetbook4` is the fixed one, don't use `hid-multitouch`. boot.blacklistedKernelModules = [ "hid-multitouch" ]; boot.extraModulePackages = [ - (config.boot.kernelPackages.callPackage ./goodix-stylus-mastykin {}) + (config.boot.kernelPackages.callPackage ./goodix-stylus-mastykin { }) ]; # OneNetbook 4 has an accelerometer, diff --git a/onenetbook/4/goodix-stylus-mastykin/default.nix b/onenetbook/4/goodix-stylus-mastykin/default.nix index 14c5e5cd..8b81fdb0 100644 --- a/onenetbook/4/goodix-stylus-mastykin/default.nix +++ b/onenetbook/4/goodix-stylus-mastykin/default.nix @@ -1,4 +1,11 @@ -{ stdenv, lib, kernel, fetchpatch, runCommand, patch }: +{ + stdenv, + lib, + kernel, + fetchpatch, + runCommand, + patch, +}: let patch1_original = fetchpatch { @@ -6,24 +13,18 @@ let name = "goodix-stylus-mastykin-1-pen-support.patch"; sha256 = "sha256-1oc8OvfhScYvtsMeV9A4hU+09i59tEJ6HZS6jspsJR8="; }; - patch1_updated_5_12_12 = runCommand - "goodix-stylus-mastykin-1-pen-support-5.12.12.patch" {} - '' - cat ${patch1_original} > $out - ${patch}/bin/patch $out < ${./5.12.12.patch.patch} - ''; - patch1_updated_6_1 = runCommand - "goodix-stylus-mastykin-1-pen-support-6.1.patch" {} - '' - cat ${patch1_original} > $out - ${patch}/bin/patch $out < ${./6.1.patch.patch} - ''; - patch1_updated_6_12 = runCommand - "goodix-stylus-mastykin-1-pen-support-6.12.patch" {} - '' - cat ${patch1_original} > $out - ${patch}/bin/patch $out < ${./6.12.patch.patch} - ''; + patch1_updated_5_12_12 = runCommand "goodix-stylus-mastykin-1-pen-support-5.12.12.patch" { } '' + cat ${patch1_original} > $out + ${patch}/bin/patch $out < ${./5.12.12.patch.patch} + ''; + patch1_updated_6_1 = runCommand "goodix-stylus-mastykin-1-pen-support-6.1.patch" { } '' + cat ${patch1_original} > $out + ${patch}/bin/patch $out < ${./6.1.patch.patch} + ''; + patch1_updated_6_12 = runCommand "goodix-stylus-mastykin-1-pen-support-6.12.patch" { } '' + cat ${patch1_original} > $out + ${patch}/bin/patch $out < ${./6.12.patch.patch} + ''; patch1 = if (lib.versionAtLeast kernel.version "6.12") then patch1_updated_6_12 @@ -31,7 +32,8 @@ let patch1_updated_6_1 else if (lib.versionAtLeast kernel.version "5.12.12") then patch1_updated_5_12_12 - else patch1_original; + else + patch1_original; patch2 = fetchpatch { url = "https://marc.info/?l=linux-input&m=161847127221531&q=p4"; name = "goodix-stylus-mastykin-2-buttons.patch"; @@ -42,11 +44,17 @@ stdenv.mkDerivation rec { name = "hid-multitouch-onenetbook4-${version}"; inherit (kernel) version; - hardeningDisable = [ "pic" "format" ]; + hardeningDisable = [ + "pic" + "format" + ]; nativeBuildInputs = kernel.moduleBuildDependencies; src = ./.; - patches = [ patch1 patch2 ]; + patches = [ + patch1 + patch2 + ]; postUnpack = '' tar -C goodix-stylus-mastykin \ diff --git a/pine64/pinebook-pro/keyboard-updater/default.nix b/pine64/pinebook-pro/keyboard-updater/default.nix index 3f3cf712..2ed428cf 100644 --- a/pine64/pinebook-pro/keyboard-updater/default.nix +++ b/pine64/pinebook-pro/keyboard-updater/default.nix @@ -1,4 +1,9 @@ -{ stdenv, fetchFromGitHub, xxd, libusb }: +{ + stdenv, + fetchFromGitHub, + xxd, + libusb1, +}: stdenv.mkDerivation { pname = "pinebook-pro-keyboard-updater"; @@ -9,7 +14,7 @@ stdenv.mkDerivation { ]; buildInputs = [ - libusb + libusb1 ]; installPhase = '' diff --git a/pine64/rockpro64/README.md b/pine64/rockpro64/README.md index e4695a47..5eced1c6 100644 --- a/pine64/rockpro64/README.md +++ b/pine64/rockpro64/README.md @@ -12,3 +12,11 @@ firmware. Alternatively, starting from the _Tow-Boot_ disk image on eMMC is easier to deal with and understand than having to deal with _U-Boot_ manually. + +## Console + +To configure default console I/O to use serial instead of HDMI (default): + +```nix +hardware.rockpro64.console = "serial"; +``` diff --git a/pine64/rockpro64/console.nix b/pine64/rockpro64/console.nix new file mode 100644 index 00000000..d8a213dc --- /dev/null +++ b/pine64/rockpro64/console.nix @@ -0,0 +1,17 @@ +{ config, lib, ... }: +{ + options.hardware.rockpro64.console = lib.mkOption { + default = "hdmi"; + description = "Default console to use at boot."; + type = lib.types.enum [ + "hdmi" + "serial" + ]; + }; + config = lib.mkIf (config.hardware.rockpro64.console == "hdmi") { + boot.kernelParams = [ + "console=ttyS0" + "console=tty0" + ]; + }; +} diff --git a/pine64/rockpro64/default.nix b/pine64/rockpro64/default.nix index 9ac08e83..22f82195 100644 --- a/pine64/rockpro64/default.nix +++ b/pine64/rockpro64/default.nix @@ -1,10 +1,17 @@ { lib, ... }: { + imports = [ + ./console.nix + ]; boot.initrd.kernelModules = [ # PCIe/NVMe "nvme" "pcie_rockchip_host" "phy_rockchip_pcie" + # Network + "dwmac_rk" + # HDMI + "rockchipdrm" ]; # control the fan on the rockpro64 (like the one in the NAS case) hardware.fancontrol = { diff --git a/pine64/star64/default.nix b/pine64/star64/default.nix index ce7134bd..e286533c 100644 --- a/pine64/star64/default.nix +++ b/pine64/star64/default.nix @@ -1,9 +1,22 @@ -{ config, lib, pkgs, ... }: { - nixpkgs.overlays = [(self: super: { - makeModulesClosure = x: super.makeModulesClosure (x // { - allowMissing = true; - }); - })]; +{ + config, + lib, + pkgs, + ... +}: +{ + nixpkgs.overlays = [ + (_self: super: { + makeModulesClosure = + x: + super.makeModulesClosure ( + x + // { + allowMissing = true; + } + ); + }) + ]; # Somehow ttyS0 doesn't get enabled by default systemd.services."serial-getty@ttyS0".enable = lib.mkDefault true; @@ -12,15 +25,27 @@ boot = { # Force no ZFS (from nixos/modules/profiles/base.nix) until updated to kernel 6.0 # TODO still valid for star64? - supportedFilesystems = - lib.mkForce [ "btrfs" "reiserfs" "vfat" "f2fs" "xfs" "ntfs" "cifs" ]; + supportedFilesystems = lib.mkForce [ + "btrfs" + "reiserfs" + "vfat" + "f2fs" + "xfs" + "ntfs" + "cifs" + ]; consoleLogLevel = lib.mkDefault 7; - kernelPackages = lib.mkDefault (pkgs.callPackage ./linux-5.15.nix { - inherit (config.boot) kernelPatches; - }); + kernelPackages = lib.mkDefault ( + pkgs.callPackage ./linux-5.15.nix { + inherit (config.boot) kernelPatches; + } + ); - kernelParams = - lib.mkDefault [ "console=tty0" "console=ttyS0,115200n8" "earlycon=sbi" ]; + kernelParams = lib.mkDefault [ + "console=tty0" + "console=ttyS0,115200n8" + "earlycon=sbi" + ]; initrd.availableKernelModules = [ "8250_dw" # serial port driver @@ -39,8 +64,7 @@ }; }; - hardware.deviceTree.name = - lib.mkDefault "starfive/jh7110-pine64-star64.dtb"; + hardware.deviceTree.name = lib.mkDefault "starfive/jh7110-pine64-star64.dtb"; # Only "performance" and "schedutil" are available, # and "performance" takes precedence by default, which is a waste of power. diff --git a/pine64/star64/firmware.nix b/pine64/star64/firmware.nix index e0173a6c..5242f779 100644 --- a/pine64/star64/firmware.nix +++ b/pine64/star64/firmware.nix @@ -1,5 +1,13 @@ -{ callPackage, pkgsBuildHost, writeText, writeShellApplication -, stdenv, dtc, mtdutils, coreutils }: +{ + callPackage, + pkgsBuildHost, + writeText, + writeShellApplication, + stdenv, + dtc, + mtdutils, + coreutils, +}: let uboot = callPackage ./uboot.nix { }; opensbi = callPackage ./opensbi.nix { @@ -37,7 +45,8 @@ let }; }; ''; -in rec { +in +rec { inherit opensbi uboot; spl = stdenv.mkDerivation { name = "pine64-star64-spl"; diff --git a/pine64/star64/linux-5.15.nix b/pine64/star64/linux-5.15.nix index 020af357..28d9adbb 100644 --- a/pine64/star64/linux-5.15.nix +++ b/pine64/star64/linux-5.15.nix @@ -1,237 +1,257 @@ -{ lib, callPackage, linuxPackagesFor, kernelPatches, fetchpatch, ... }: +{ + lib, + callPackage, + linuxPackagesFor, + kernelPatches, + fetchpatch, + ... +}: let modDirVersion = "5.15.131"; - linuxPkg = { lib, fetchFromGitHub, buildLinux, ... }@args: - buildLinux (args // { - version = "${modDirVersion}-fishwaldo-star64"; + linuxPkg = + { + lib, + fetchFromGitHub, + buildLinux, + ... + }@args: + buildLinux ( + args + // { + version = "${modDirVersion}-fishwaldo-star64"; - src = fetchFromGitHub { - owner = "Fishwaldo"; - repo = "Star64_linux"; - rev = "1456c984f15e21e28fb8a9ce96d0ca10e61a71c4"; # Star64_devel branch - hash = "sha256-I5wzmxiY7PWpahYCqTOAmYEiJvpRPpUV7S21Kn9lLwg="; - }; + src = fetchFromGitHub { + owner = "Fishwaldo"; + repo = "Star64_linux"; + rev = "1456c984f15e21e28fb8a9ce96d0ca10e61a71c4"; # Star64_devel branch + hash = "sha256-I5wzmxiY7PWpahYCqTOAmYEiJvpRPpUV7S21Kn9lLwg="; + }; - inherit modDirVersion; - defconfig = "pine64_star64_defconfig"; - kernelPatches = [ - { patch = fetchpatch { - url = "https://github.com/torvalds/linux/commit/215bebc8c6ac438c382a6a56bd2764a2d4e1da72.diff"; - hash = "sha256-1ZqmVOkgcDBRkHvVRPH8I5G1STIS1R/l/63PzQQ0z0I="; - includes = ["security/keys/dh.c"]; - }; - } - { patch = fetchpatch { - url = "https://github.com/starfive-tech/linux/pull/108/commits/9ae8cb751c4d1fd2146b279a8e67887590e9d07a.diff"; - hash = "sha256-EY0lno+HkY5mradBUPII3qqu0xh+BVQRzveCQcaht0M="; - }; - } - { patch = ./irq-desc-to-data.patch; } - ] ++ kernelPatches; + inherit modDirVersion; + defconfig = "pine64_star64_defconfig"; + kernelPatches = [ + { + patch = fetchpatch { + url = "https://github.com/torvalds/linux/commit/215bebc8c6ac438c382a6a56bd2764a2d4e1da72.diff"; + hash = "sha256-1ZqmVOkgcDBRkHvVRPH8I5G1STIS1R/l/63PzQQ0z0I="; + includes = [ "security/keys/dh.c" ]; + }; + } + { + patch = fetchpatch { + url = "https://github.com/starfive-tech/linux/pull/108/commits/9ae8cb751c4d1fd2146b279a8e67887590e9d07a.diff"; + hash = "sha256-EY0lno+HkY5mradBUPII3qqu0xh+BVQRzveCQcaht0M="; + }; + } + { patch = ./irq-desc-to-data.patch; } + ] ++ kernelPatches; - structuredExtraConfig = with lib.kernel; { - # A ton of stuff just does not build. We disable it all. - # Most of it is not important except drm. - # https://github.com/starfive-tech/linux/issues/79 + structuredExtraConfig = with lib.kernel; { + # A ton of stuff just does not build. We disable it all. + # Most of it is not important except drm. + # https://github.com/starfive-tech/linux/issues/79 - # Removed files, re-added to the makefile by accident in - # https://github.com/Fishwaldo/Star64_linux/commit/cd96097d17a494974dfc5e9909476145ab4f09f5 - CRYPTO_RMD128 = no; - CRYPTO_RMD256 = no; - CRYPTO_RMD320 = no; - CRYPTO_TGR192 = no; - CRYPTO_SALSA20 = no; + # Removed files, re-added to the makefile by accident in + # https://github.com/Fishwaldo/Star64_linux/commit/cd96097d17a494974dfc5e9909476145ab4f09f5 + CRYPTO_RMD128 = no; + CRYPTO_RMD256 = no; + CRYPTO_RMD320 = no; + CRYPTO_TGR192 = no; + CRYPTO_SALSA20 = no; - CRYPTO_SM4 = no; # modpost: undefined stuff - CRYPTO_DEV_CCREE = no; # reverse dep of CRYPTO_SM4 - NLS_CODEPAGE_949 = no; - VIDEO_OV5640 = no; # conflicts with starfive VIN_SENSOR_OV5640 + CRYPTO_SM4 = no; # modpost: undefined stuff + CRYPTO_DEV_CCREE = no; # reverse dep of CRYPTO_SM4 + NLS_CODEPAGE_949 = no; + VIDEO_OV5640 = no; # conflicts with starfive VIN_SENSOR_OV5640 - DRM_IMG = no; - DRM_IMG_ROGUE = no; - DRM_VERISILICON = no; + DRM_IMG = no; + DRM_IMG_ROGUE = no; + DRM_VERISILICON = no; - # brute force disable drm - CEC_CORE = no; - CEC_NOTIFIER = no; - DRM = lib.mkForce no; - DRM_MIPI_DBI = no; - DRM_MIPI_DSI = no; - DRM_DP_AUX_BUS = no; - DRM_DP_AUX_CHARDEV = lib.mkForce no; - DRM_KMS_HELPER = no; - DRM_FBDEV_EMULATION = lib.mkForce no; - DRM_LOAD_EDID_FIRMWARE = lib.mkForce no; - DRM_TTM = no; - DRM_VRAM_HELPER = no; - DRM_TTM_HELPER = no; - DRM_GEM_CMA_HELPER = no; - DRM_KMS_CMA_HELPER = no; - DRM_GEM_SHMEM_HELPER = no; - DRM_SCHED = no; - DRM_I2C_CH7006 = no; - DRM_I2C_SIL164 = no; - DRM_I2C_NXP_TDA998X = no; # https://github.com/starfive-tech/linux/pull/86 - DRM_I2C_NXP_TDA9950 = no; - DRM_KOMEDA = no; - DRM_RADEON = no; - DRM_AMDGPU = no; - DRM_AMDGPU_SI = lib.mkForce no; - DRM_AMDGPU_CIK = lib.mkForce no; - DRM_AMDGPU_USERPTR = lib.mkForce no; - DRM_AMD_DC = no; - DRM_AMD_DC_HDCP = lib.mkForce no; - DRM_AMD_DC_SI = lib.mkForce no; - DRM_NOUVEAU = no; - NOUVEAU_LEGACY_CTX_SUPPORT = no; - DRM_NOUVEAU_BACKLIGHT = no; - DRM_VGEM = no; - DRM_VKMS = no; - DRM_UDL = no; - DRM_AST = no; - DRM_MGAG200 = no; - DRM_RCAR_DW_HDMI = no; - DRM_QXL = no; - DRM_VIRTIO_GPU = no; - DRM_PANEL = no; - DRM_PANEL_ABT_Y030XX067A = no; - DRM_PANEL_ARM_VERSATILE = no; - DRM_PANEL_ASUS_Z00T_TM5P5_NT35596 = no; - DRM_PANEL_BOE_HIMAX8279D = no; - DRM_PANEL_BOE_TV101WUM_NL6 = no; - DRM_PANEL_DSI_CM = no; - DRM_PANEL_LVDS = no; - DRM_PANEL_SIMPLE = no; - DRM_PANEL_ELIDA_KD35T133 = no; - DRM_PANEL_FEIXIN_K101_IM2BA02 = no; - DRM_PANEL_FEIYANG_FY07024DI26A30D = no; - DRM_PANEL_ILITEK_IL9322 = no; - DRM_PANEL_ILITEK_ILI9341 = no; - DRM_PANEL_ILITEK_ILI9881C = no; - DRM_PANEL_INNOLUX_EJ030NA = no; - DRM_PANEL_INNOLUX_P079ZCA = no; - DRM_PANEL_JDI_LT070ME05000 = no; - DRM_PANEL_KHADAS_TS050 = no; - DRM_PANEL_KINGDISPLAY_KD097D04 = no; - DRM_PANEL_LEADTEK_LTK050H3146W = no; - DRM_PANEL_LEADTEK_LTK500HD1829 = no; - DRM_PANEL_SAMSUNG_LD9040 = no; - DRM_PANEL_LG_LB035Q02 = no; - DRM_PANEL_LG_LG4573 = no; - DRM_PANEL_NEC_NL8048HL11 = no; - DRM_PANEL_NOVATEK_NT35510 = no; - DRM_PANEL_NOVATEK_NT36672A = no; - DRM_PANEL_NOVATEK_NT39016 = no; - DRM_PANEL_MANTIX_MLAF057WE51 = no; - DRM_PANEL_OLIMEX_LCD_OLINUXINO = no; - DRM_PANEL_ORISETECH_OTM8009A = no; - DRM_PANEL_OSD_OSD101T2587_53TS = no; - DRM_PANEL_PANASONIC_VVX10F034N00 = no; - DRM_PANEL_RASPBERRYPI_TOUCHSCREEN = no; - DRM_PANEL_RAYDIUM_RM67191 = no; - DRM_PANEL_RAYDIUM_RM68200 = no; - DRM_PANEL_RONBO_RB070D30 = no; - DRM_PANEL_SAMSUNG_ATNA33XC20 = no; - DRM_PANEL_SAMSUNG_DB7430 = no; - DRM_PANEL_SAMSUNG_S6D16D0 = no; - DRM_PANEL_SAMSUNG_S6E3HA2 = no; - DRM_PANEL_SAMSUNG_S6E63J0X03 = no; - DRM_PANEL_SAMSUNG_S6E63M0 = no; - DRM_PANEL_SAMSUNG_S6E63M0_SPI = no; - DRM_PANEL_SAMSUNG_S6E63M0_DSI = no; - DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01 = no; - DRM_PANEL_SAMSUNG_S6E8AA0 = no; - DRM_PANEL_SAMSUNG_SOFEF00 = no; - DRM_PANEL_SEIKO_43WVF1G = no; - DRM_PANEL_SHARP_LQ101R1SX01 = no; - DRM_PANEL_SHARP_LS037V7DW01 = no; - DRM_PANEL_SHARP_LS043T1LE01 = no; - DRM_PANEL_SITRONIX_ST7701 = no; - DRM_PANEL_SITRONIX_ST7703 = no; - DRM_PANEL_SITRONIX_ST7789V = no; - DRM_PANEL_SONY_ACX565AKM = no; - DRM_PANEL_TDO_TL070WSH30 = no; - DRM_PANEL_TPO_TD028TTEC1 = no; - DRM_PANEL_TPO_TD043MTEA1 = no; - DRM_PANEL_TPO_TPG110 = no; - DRM_PANEL_TRULY_NT35597_WQXGA = no; - DRM_PANEL_VISIONOX_RM69299 = no; - DRM_PANEL_WIDECHIPS_WS2401 = no; - DRM_PANEL_XINPENG_XPP055C272 = no; - DRM_BRIDGE = no; - DRM_PANEL_BRIDGE = no; - DRM_CDNS_DSI = no; - DRM_CHIPONE_ICN6211 = no; - DRM_CHRONTEL_CH7033 = no; - DRM_DISPLAY_CONNECTOR = no; - DRM_LONTIUM_LT8912B = no; - DRM_LONTIUM_LT9611 = no; - DRM_LONTIUM_LT9611UXC = no; - DRM_ITE_IT66121 = no; - DRM_LVDS_CODEC = no; - DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW = no; - DRM_NWL_MIPI_DSI = no; - DRM_NXP_PTN3460 = no; - DRM_PARADE_PS8622 = no; - DRM_PARADE_PS8640 = no; - DRM_SIL_SII8620 = no; - DRM_SII902X = no; - DRM_SII9234 = no; - DRM_SIMPLE_BRIDGE = no; - DRM_THINE_THC63LVD1024 = no; - DRM_TOSHIBA_TC358762 = no; - DRM_TOSHIBA_TC358764 = no; - DRM_TOSHIBA_TC358767 = no; - DRM_TOSHIBA_TC358768 = no; - DRM_TOSHIBA_TC358775 = no; - DRM_TI_TFP410 = no; - DRM_TI_SN65DSI83 = no; - DRM_TI_SN65DSI86 = no; - DRM_TI_TPD12S015 = no; - DRM_ANALOGIX_ANX6345 = no; - DRM_ANALOGIX_ANX78XX = no; - DRM_ANALOGIX_DP = no; - DRM_ANALOGIX_ANX7625 = no; - DRM_I2C_ADV7511 = no; - DRM_I2C_ADV7511_CEC = no; - DRM_CDNS_MHDP8546 = no; - DRM_DW_HDMI = no; - DRM_DW_HDMI_AHB_AUDIO = no; - DRM_DW_HDMI_I2S_AUDIO = no; - DRM_DW_HDMI_CEC = no; - DRM_ETNAVIV = no; - DRM_ETNAVIV_THERMAL = no; - DRM_MXS = no; - DRM_MXSFB = no; - DRM_ARCPGU = no; - DRM_BOCHS = no; - DRM_CIRRUS_QEMU = no; - DRM_GM12U320 = no; - TINYDRM_HX8357D = no; - TINYDRM_ILI9225 = no; - TINYDRM_ILI9341 = no; - TINYDRM_ILI9486 = no; - TINYDRM_MI0283QT = no; - TINYDRM_REPAPER = no; - TINYDRM_ST7586 = no; - TINYDRM_ST7735R = no; - DRM_GUD = no; - DRM_LEGACY = no; - DRM_TDFX = no; - DRM_R128 = no; - DRM_MGA = no; - DRM_VIA = no; - DRM_SAVAGE = no; - VIDEOMODE_HELPERS = no; - SND_PCM_ELD = no; - SND_PCM_IEC958 = no; - SND_HDA_COMPONENT = no; - SND_SOC_HDMI_CODEC = no; - VIRTIO_DMA_SHARED_BUFFER = no; - }; + # brute force disable drm + CEC_CORE = no; + CEC_NOTIFIER = no; + DRM = lib.mkForce no; + DRM_MIPI_DBI = no; + DRM_MIPI_DSI = no; + DRM_DP_AUX_BUS = no; + DRM_DP_AUX_CHARDEV = lib.mkForce no; + DRM_KMS_HELPER = no; + DRM_FBDEV_EMULATION = lib.mkForce no; + DRM_LOAD_EDID_FIRMWARE = lib.mkForce no; + DRM_TTM = no; + DRM_VRAM_HELPER = no; + DRM_TTM_HELPER = no; + DRM_GEM_CMA_HELPER = no; + DRM_KMS_CMA_HELPER = no; + DRM_GEM_SHMEM_HELPER = no; + DRM_SCHED = no; + DRM_I2C_CH7006 = no; + DRM_I2C_SIL164 = no; + DRM_I2C_NXP_TDA998X = no; # https://github.com/starfive-tech/linux/pull/86 + DRM_I2C_NXP_TDA9950 = no; + DRM_KOMEDA = no; + DRM_RADEON = no; + DRM_AMDGPU = no; + DRM_AMDGPU_SI = lib.mkForce no; + DRM_AMDGPU_CIK = lib.mkForce no; + DRM_AMDGPU_USERPTR = lib.mkForce no; + DRM_AMD_DC = no; + DRM_AMD_DC_HDCP = lib.mkForce no; + DRM_AMD_DC_SI = lib.mkForce no; + DRM_NOUVEAU = no; + NOUVEAU_LEGACY_CTX_SUPPORT = no; + DRM_NOUVEAU_BACKLIGHT = no; + DRM_VGEM = no; + DRM_VKMS = no; + DRM_UDL = no; + DRM_AST = no; + DRM_MGAG200 = no; + DRM_RCAR_DW_HDMI = no; + DRM_QXL = no; + DRM_VIRTIO_GPU = no; + DRM_PANEL = no; + DRM_PANEL_ABT_Y030XX067A = no; + DRM_PANEL_ARM_VERSATILE = no; + DRM_PANEL_ASUS_Z00T_TM5P5_NT35596 = no; + DRM_PANEL_BOE_HIMAX8279D = no; + DRM_PANEL_BOE_TV101WUM_NL6 = no; + DRM_PANEL_DSI_CM = no; + DRM_PANEL_LVDS = no; + DRM_PANEL_SIMPLE = no; + DRM_PANEL_ELIDA_KD35T133 = no; + DRM_PANEL_FEIXIN_K101_IM2BA02 = no; + DRM_PANEL_FEIYANG_FY07024DI26A30D = no; + DRM_PANEL_ILITEK_IL9322 = no; + DRM_PANEL_ILITEK_ILI9341 = no; + DRM_PANEL_ILITEK_ILI9881C = no; + DRM_PANEL_INNOLUX_EJ030NA = no; + DRM_PANEL_INNOLUX_P079ZCA = no; + DRM_PANEL_JDI_LT070ME05000 = no; + DRM_PANEL_KHADAS_TS050 = no; + DRM_PANEL_KINGDISPLAY_KD097D04 = no; + DRM_PANEL_LEADTEK_LTK050H3146W = no; + DRM_PANEL_LEADTEK_LTK500HD1829 = no; + DRM_PANEL_SAMSUNG_LD9040 = no; + DRM_PANEL_LG_LB035Q02 = no; + DRM_PANEL_LG_LG4573 = no; + DRM_PANEL_NEC_NL8048HL11 = no; + DRM_PANEL_NOVATEK_NT35510 = no; + DRM_PANEL_NOVATEK_NT36672A = no; + DRM_PANEL_NOVATEK_NT39016 = no; + DRM_PANEL_MANTIX_MLAF057WE51 = no; + DRM_PANEL_OLIMEX_LCD_OLINUXINO = no; + DRM_PANEL_ORISETECH_OTM8009A = no; + DRM_PANEL_OSD_OSD101T2587_53TS = no; + DRM_PANEL_PANASONIC_VVX10F034N00 = no; + DRM_PANEL_RASPBERRYPI_TOUCHSCREEN = no; + DRM_PANEL_RAYDIUM_RM67191 = no; + DRM_PANEL_RAYDIUM_RM68200 = no; + DRM_PANEL_RONBO_RB070D30 = no; + DRM_PANEL_SAMSUNG_ATNA33XC20 = no; + DRM_PANEL_SAMSUNG_DB7430 = no; + DRM_PANEL_SAMSUNG_S6D16D0 = no; + DRM_PANEL_SAMSUNG_S6E3HA2 = no; + DRM_PANEL_SAMSUNG_S6E63J0X03 = no; + DRM_PANEL_SAMSUNG_S6E63M0 = no; + DRM_PANEL_SAMSUNG_S6E63M0_SPI = no; + DRM_PANEL_SAMSUNG_S6E63M0_DSI = no; + DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01 = no; + DRM_PANEL_SAMSUNG_S6E8AA0 = no; + DRM_PANEL_SAMSUNG_SOFEF00 = no; + DRM_PANEL_SEIKO_43WVF1G = no; + DRM_PANEL_SHARP_LQ101R1SX01 = no; + DRM_PANEL_SHARP_LS037V7DW01 = no; + DRM_PANEL_SHARP_LS043T1LE01 = no; + DRM_PANEL_SITRONIX_ST7701 = no; + DRM_PANEL_SITRONIX_ST7703 = no; + DRM_PANEL_SITRONIX_ST7789V = no; + DRM_PANEL_SONY_ACX565AKM = no; + DRM_PANEL_TDO_TL070WSH30 = no; + DRM_PANEL_TPO_TD028TTEC1 = no; + DRM_PANEL_TPO_TD043MTEA1 = no; + DRM_PANEL_TPO_TPG110 = no; + DRM_PANEL_TRULY_NT35597_WQXGA = no; + DRM_PANEL_VISIONOX_RM69299 = no; + DRM_PANEL_WIDECHIPS_WS2401 = no; + DRM_PANEL_XINPENG_XPP055C272 = no; + DRM_BRIDGE = no; + DRM_PANEL_BRIDGE = no; + DRM_CDNS_DSI = no; + DRM_CHIPONE_ICN6211 = no; + DRM_CHRONTEL_CH7033 = no; + DRM_DISPLAY_CONNECTOR = no; + DRM_LONTIUM_LT8912B = no; + DRM_LONTIUM_LT9611 = no; + DRM_LONTIUM_LT9611UXC = no; + DRM_ITE_IT66121 = no; + DRM_LVDS_CODEC = no; + DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW = no; + DRM_NWL_MIPI_DSI = no; + DRM_NXP_PTN3460 = no; + DRM_PARADE_PS8622 = no; + DRM_PARADE_PS8640 = no; + DRM_SIL_SII8620 = no; + DRM_SII902X = no; + DRM_SII9234 = no; + DRM_SIMPLE_BRIDGE = no; + DRM_THINE_THC63LVD1024 = no; + DRM_TOSHIBA_TC358762 = no; + DRM_TOSHIBA_TC358764 = no; + DRM_TOSHIBA_TC358767 = no; + DRM_TOSHIBA_TC358768 = no; + DRM_TOSHIBA_TC358775 = no; + DRM_TI_TFP410 = no; + DRM_TI_SN65DSI83 = no; + DRM_TI_SN65DSI86 = no; + DRM_TI_TPD12S015 = no; + DRM_ANALOGIX_ANX6345 = no; + DRM_ANALOGIX_ANX78XX = no; + DRM_ANALOGIX_DP = no; + DRM_ANALOGIX_ANX7625 = no; + DRM_I2C_ADV7511 = no; + DRM_I2C_ADV7511_CEC = no; + DRM_CDNS_MHDP8546 = no; + DRM_DW_HDMI = no; + DRM_DW_HDMI_AHB_AUDIO = no; + DRM_DW_HDMI_I2S_AUDIO = no; + DRM_DW_HDMI_CEC = no; + DRM_ETNAVIV = no; + DRM_ETNAVIV_THERMAL = no; + DRM_MXS = no; + DRM_MXSFB = no; + DRM_ARCPGU = no; + DRM_BOCHS = no; + DRM_CIRRUS_QEMU = no; + DRM_GM12U320 = no; + TINYDRM_HX8357D = no; + TINYDRM_ILI9225 = no; + TINYDRM_ILI9341 = no; + TINYDRM_ILI9486 = no; + TINYDRM_MI0283QT = no; + TINYDRM_REPAPER = no; + TINYDRM_ST7586 = no; + TINYDRM_ST7735R = no; + DRM_GUD = no; + DRM_LEGACY = no; + DRM_TDFX = no; + DRM_R128 = no; + DRM_MGA = no; + DRM_VIA = no; + DRM_SAVAGE = no; + VIDEOMODE_HELPERS = no; + SND_PCM_ELD = no; + SND_PCM_IEC958 = no; + SND_HDA_COMPONENT = no; + SND_SOC_HDMI_CODEC = no; + VIRTIO_DMA_SHARED_BUFFER = no; + }; - extraMeta.branch = "Star64_devel"; - } // (args.argsOverride or { })); + extraMeta.branch = "Star64_devel"; + } + // (args.argsOverride or { }) + ); -in lib.recurseIntoAttrs (linuxPackagesFor (callPackage linuxPkg { })) +in +lib.recurseIntoAttrs (linuxPackagesFor (callPackage linuxPkg { })) diff --git a/pine64/star64/opensbi.nix b/pine64/star64/opensbi.nix index 5b46fec6..e9a79129 100644 --- a/pine64/star64/opensbi.nix +++ b/pine64/star64/opensbi.nix @@ -1,14 +1,18 @@ -{ opensbi, withPayload, withFDT }: +{ + opensbi, + withPayload, + withFDT, +}: (opensbi.override { inherit withPayload withFDT; -}).overrideAttrs (attrs: { - makeFlags = attrs.makeFlags ++ [ - # opensbi generic platform default FW_TEXT_START is 0x80000000 - # For JH7110, need to specify the FW_TEXT_START to 0x40000000 - # Otherwise, the fw_payload.bin downloading via jtag will not run. - # https://github.com/starfive-tech/VisionFive2/blob/7733673d27052dc5a48f1cb1d060279dfa3f0241/Makefile#L274 - "FW_TEXT_START=0x40000000" - ]; -}) - +}).overrideAttrs + (attrs: { + makeFlags = attrs.makeFlags ++ [ + # opensbi generic platform default FW_TEXT_START is 0x80000000 + # For JH7110, need to specify the FW_TEXT_START to 0x40000000 + # Otherwise, the fw_payload.bin downloading via jtag will not run. + # https://github.com/starfive-tech/VisionFive2/blob/7733673d27052dc5a48f1cb1d060279dfa3f0241/Makefile#L274 + "FW_TEXT_START=0x40000000" + ]; + }) diff --git a/pine64/star64/sd-image.nix b/pine64/star64/sd-image.nix index 07d00ae8..e76b0c03 100644 --- a/pine64/star64/sd-image.nix +++ b/pine64/star64/sd-image.nix @@ -1,7 +1,14 @@ -{ config, pkgs, modulesPath, ... }: +{ + config, + pkgs, + modulesPath, + ... +}: -let firmware = pkgs.callPackage ./firmware.nix { }; -in { +let + firmware = pkgs.callPackage ./firmware.nix { }; +in +{ imports = [ "${modulesPath}/profiles/base.nix" "${modulesPath}/installer/sd-card/sd-image.nix" @@ -9,8 +16,7 @@ in { ]; sdImage = { - imageName = - "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-pine64-star64.img"; + imageName = "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-pine64-star64.img"; # Overridden by postBuildCommands populateFirmwareCommands = ""; diff --git a/pine64/star64/spl-tool.nix b/pine64/star64/spl-tool.nix index 6b91a36e..0f1f8df9 100644 --- a/pine64/star64/spl-tool.nix +++ b/pine64/star64/spl-tool.nix @@ -1,6 +1,6 @@ { stdenv, fetchFromGitHub }: -stdenv.mkDerivation rec{ +stdenv.mkDerivation rec { pname = "spi_tool"; version = "unstable-2023-04-14"; src = fetchFromGitHub { diff --git a/purism/librem/5r4/audio.nix b/purism/librem/5r4/audio.nix index 8c8b00b9..9c49fa7a 100644 --- a/purism/librem/5r4/audio.nix +++ b/purism/librem/5r4/audio.nix @@ -1,13 +1,14 @@ -{ config -, lib -, pkgs -, ... -}: { +{ + config, + lib, + pkgs, + ... +}: +{ config = - lib.mkIf config.hardware.librem5.audio - { - services.dbus.packages = [ pkgs.callaudiod ]; - } + lib.mkIf config.hardware.librem5.audio { + services.dbus.packages = [ pkgs.callaudiod ]; + } // ( let paConfig = { @@ -18,24 +19,25 @@ ''; }; in - if lib.versionOlder (lib.versions.majorMinor lib.version) "25.05" - then { - assertions = [ - { - assertion = config.hardware.pulseaudio.enable; - message = "Call audio on Librem5 requires pulse audio to be enabled through `hardware.pulseaudio.enable`."; - } - ]; - hardware.pulseaudio = paConfig; - } - else { - assertions = [ - { - assertion = config.services.pulseaudio.enable; - message = "Call audio on Librem5 requires pulse audio to be enabled through `services.pulseaudio.enable`."; - } - ]; - services.pulseaudio = paConfig; - } + if lib.versionOlder (lib.versions.majorMinor lib.version) "25.05" then + { + assertions = [ + { + assertion = config.hardware.pulseaudio.enable; + message = "Call audio on Librem5 requires pulse audio to be enabled through `hardware.pulseaudio.enable`."; + } + ]; + hardware.pulseaudio = paConfig; + } + else + { + assertions = [ + { + assertion = config.services.pulseaudio.enable; + message = "Call audio on Librem5 requires pulse audio to be enabled through `services.pulseaudio.enable`."; + } + ]; + services.pulseaudio = paConfig; + } ); } diff --git a/purism/librem/5r4/default.nix b/purism/librem/5r4/default.nix index 339b43b3..33eeefdd 100644 --- a/purism/librem/5r4/default.nix +++ b/purism/librem/5r4/default.nix @@ -1,9 +1,15 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.hardware.librem5; linuxPackages_librem5 = pkgs.linuxPackagesFor (pkgs.callPackage ./kernel.nix { }); ubootLibrem5 = pkgs.callPackage ./u-boot { }; -in { +in +{ options = { hardware.librem5 = { package = lib.mkOption { @@ -11,7 +17,11 @@ in { default = pkgs.callPackage ./librem5-base { }; }; wifiCard = lib.mkOption { - type = lib.types.enum [ "redpine" "sparklan" "none" ]; + type = lib.types.enum [ + "redpine" + "sparklan" + "none" + ]; description = '' Which wi-fi card is installed in your phone. diff --git a/purism/librem/5r4/kernel.nix b/purism/librem/5r4/kernel.nix index 0ffbb3d3..9e42a586 100644 --- a/purism/librem/5r4/kernel.nix +++ b/purism/librem/5r4/kernel.nix @@ -1,28 +1,31 @@ -{ lib -, buildLinux -, fetchFromGitLab -, ... -} @ args: -buildLinux (args +{ + lib, + buildLinux, + fetchFromGitLab, + ... +}@args: +buildLinux ( + args // rec { - defconfig = "librem5_defconfig"; - version = "6.6.74-librem5"; - modDirVersion = version; - src = fetchFromGitLab { - domain = "source.puri.sm"; - owner = "Librem5"; - repo = "linux"; - rev = "pureos/6.6.74pureos1"; - hash = "sha256-qUPY+2fHVu7SFc+Uf8U7QtkQJJsE/4I1SavpLqJ/34c="; - }; - kernelPatches = [ ]; - # see https://github.com/NixOS/nixpkgs/pull/366004 - ignoreConfigErrors = true; + defconfig = "librem5_defconfig"; + version = "6.6.74-librem5"; + modDirVersion = version; + src = fetchFromGitLab { + domain = "source.puri.sm"; + owner = "Librem5"; + repo = "linux"; + rev = "pureos/6.6.74pureos1"; + hash = "sha256-qUPY+2fHVu7SFc+Uf8U7QtkQJJsE/4I1SavpLqJ/34c="; + }; + kernelPatches = [ ]; + # see https://github.com/NixOS/nixpkgs/pull/366004 + ignoreConfigErrors = true; - structuredExtraConfig = with lib.kernel; { - # buildLinux overrides this and defaults to 32, so go back to the value defined librem5_defconfig - # this is required for millipixels to take photos, otherwise the VIDIOC_REQ_BUFS ioctl returns ENOMEM - CMA_SIZE_MBYTES = lib.mkForce (freeform "320"); - }; -} - // args.argsOverride or { }) + structuredExtraConfig = with lib.kernel; { + # buildLinux overrides this and defaults to 32, so go back to the value defined librem5_defconfig + # this is required for millipixels to take photos, otherwise the VIDIOC_REQ_BUFS ioctl returns ENOMEM + CMA_SIZE_MBYTES = lib.mkForce (freeform "320"); + }; + } + // args.argsOverride or { } +) diff --git a/purism/librem/5r4/librem5-base/default.nix b/purism/librem/5r4/librem5-base/default.nix index da9a39e2..5ad48597 100644 --- a/purism/librem/5r4/librem5-base/default.nix +++ b/purism/librem/5r4/librem5-base/default.nix @@ -1,4 +1,10 @@ -{ stdenv, fetchFromGitLab, shellcheck, kmod, lib }: +{ + stdenv, + fetchFromGitLab, + shellcheck, + kmod, + lib, +}: stdenv.mkDerivation { pname = "librem5-base"; version = "unstable"; diff --git a/purism/librem/5r4/lockdown-fix.nix b/purism/librem/5r4/lockdown-fix.nix index 121ded30..08ee137f 100644 --- a/purism/librem/5r4/lockdown-fix.nix +++ b/purism/librem/5r4/lockdown-fix.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: lib.mkIf config.hardware.librem5.lockdownFix { # We blacklist the drivers so they don't load during early boot when the sensors are disconnected, boot.blacklistedKernelModules = [ @@ -17,10 +22,10 @@ lib.mkIf config.hardware.librem5.lockdownFix { }; # udev rules from librem5-base handle going into "lockdown mode" and back. - assertions = [{ - assertion = with config.hardware.librem5; - lockdownFix -> installUdevPackages; - message = - "'hardware.librem5.lockdownFix' requires 'hardware.librem5.installUdevPackages', but it is not enabled."; - }]; + assertions = [ + { + assertion = with config.hardware.librem5; lockdownFix -> installUdevPackages; + message = "'hardware.librem5.lockdownFix' requires 'hardware.librem5.installUdevPackages', but it is not enabled."; + } + ]; } diff --git a/purism/librem/5r4/u-boot/default.nix b/purism/librem/5r4/u-boot/default.nix index a6b00a79..43dcee43 100644 --- a/purism/librem/5r4/u-boot/default.nix +++ b/purism/librem/5r4/u-boot/default.nix @@ -1,4 +1,12 @@ -{ stdenv, gcc11Stdenv, buildUBoot, fetchurl, fetchFromGitLab, lib, bison }: +{ + stdenv, + gcc11Stdenv, + buildUBoot, + fetchurl, + fetchFromGitLab, + lib, + bison, +}: let firmware-imx = stdenv.mkDerivation (fa: { pname = "firmware-imx"; @@ -20,7 +28,7 @@ let meta.license = lib.licenses.unfree; }); - arm-trusted-firmware-imx8mq = gcc11Stdenv.mkDerivation (fa: { + arm-trusted-firmware-imx8mq = gcc11Stdenv.mkDerivation (_fa: { pname = "arm-trusted-firmware-bl31"; version = "unstable-2020-07-08"; src = fetchFromGitLab { @@ -33,7 +41,10 @@ let enableParallelBuilding = true; hardeningDisable = [ "all" ]; NIX_LDFLAGS = "--no-warn-rwx-segments"; - buildFlags = [ "PLAT=imx8mq" "bl31" ]; + buildFlags = [ + "PLAT=imx8mq" + "bl31" + ]; installPhase = '' mkdir -p $out cp build/imx8mq/release/bl31.bin $out @@ -51,7 +62,7 @@ let rev = "956aa590c93977992743b41c45d3c7ee5a024915"; # this is the latest commit on the upstream/librem5 branch hash = "sha256-MsIIlarN+WFFEzc0ptLAgS7BwJ6Cosy42xo0EwPn1AU="; }; - patches = []; + patches = [ ]; BL31 = "${arm-trusted-firmware-imx8mq}/bl31.bin"; preConfigure = '' cp $BL31 . diff --git a/radxa/README.md b/radxa/README.md index b17e6b67..484f2b3f 100644 --- a/radxa/README.md +++ b/radxa/README.md @@ -57,8 +57,16 @@ Below is an annoated flake example to create the initial boot image. system = "aarch64-linux"; modules = [ nixos-hardware.nixosModules.rock-4c-plus # Update the system according to your device. + + # Or, if the default platform firmware is not available in the NixOS version you are using: + # (import nixos-hardware.nixosModules.rock-pi-e { + # lib = nixpkgs-unfree.lib; + # config = nixpkgs-unfree.config; + # pkgs = nixpkgs-unfree.legacyPackages.aarch64-linux; + # }) + disko.nixosModules.disko # disko usage is optional in the running system, but we need it to generate the initial boot image. - "${nixos-hardware}/radxa/disko.nix" # Common Radxa Disko profile. it is system-agnostic. + "${nixos-hardware}/radxa/disko.nix" # Common Radxa Disko profile. It is system-agnostic. { disko = { imageBuilder = { @@ -74,8 +82,8 @@ Below is an annoated flake example to create the initial boot image. # Override the default bootloader with a cross built one. # Use this if you do not have binfmt configured on your system. # For NixOS, please add `boot.binfmt.emulatedSystems = [ "aarch64-linux" ];` to your system configuration. - # Update the system and the firmware package according to your device. - # hardware.radxa.rock-4c-plus.platformFirmware = nixpkgs-unfree.legacyPackages.x86_64-linux.pkgsCross.aarch64-multiplatform.ubootRock4CPlus; + # Read the device module to see how it was configured. + # hardware.rockchip.platformFirmware = nixpkgs-unfree.legacyPackages.x86_64-linux.pkgsCross.aarch64-multiplatform.ubootRock4CPlus; users.users.radxa = { isNormalUser = true; @@ -92,3 +100,13 @@ Below is an annoated flake example to create the initial boot image. }; } ``` + +For most of the supported products, you only need to change the device module ( +i.e. `nixos-hardware.nixosModules.rock-4c-plus`) to match the one you are using. + +## Known issues + +* Currently, the `hardware.radxa` module and Radxa-maintained SoC vendor modules +(eg. `hardware.rockchip`) are tightly coupled and not intended for end-user to +use. Those options are currently used internally for hardware enablement, and +end-user should not need to modify them. Consider those interfaces **unstable**. diff --git a/radxa/default.nix b/radxa/default.nix index fb311df7..e687ff88 100644 --- a/radxa/default.nix +++ b/radxa/default.nix @@ -1,11 +1,13 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: let cfg = config.hardware.radxa; -in { +in +{ options.hardware.radxa = { enable = lib.mkEnableOption "Radxa system support"; }; diff --git a/radxa/disko.nix b/radxa/disko.nix index 30c30a97..739f4575 100644 --- a/radxa/disko.nix +++ b/radxa/disko.nix @@ -1,11 +1,10 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: -let - cfg = config.hardware.radxa; -in { +{ imports = [ ../rockchip/disko.nix ]; diff --git a/radxa/rock-4c-plus/default.nix b/radxa/rock-4c-plus/default.nix index 5fb9d5d3..956fc546 100644 --- a/radxa/rock-4c-plus/default.nix +++ b/radxa/rock-4c-plus/default.nix @@ -1,30 +1,21 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: -let - cfg = config.hardware.radxa.rock-4c-plus; - rkCfg = config.hardware.rockchip; -in { +{ imports = [ ../. - ../../rockchip/rk3399 + ../../rockchip ]; - options.hardware.radxa.rock-4c-plus = { - platformFirmware = lib.mkPackageOption pkgs "ubootRock4CPlus" { }; - }; - config = { hardware = { radxa.enable = true; rockchip = { rk3399.enable = true; - diskoExtraPostVM = '' - dd conv=notrunc,fsync if=${cfg.platformFirmware}/idbloader.img of=$out/${rkCfg.diskoImageName} bs=512 seek=64 - dd conv=notrunc,fsync if=${cfg.platformFirmware}/u-boot.itb of=$out/${rkCfg.diskoImageName} bs=512 seek=16384 - ''; + platformFirmware = lib.mkDefault pkgs.ubootRock4CPlus; }; }; }; diff --git a/radxa/rock-5b/default.nix b/radxa/rock-5b/default.nix new file mode 100644 index 00000000..891ae26c --- /dev/null +++ b/radxa/rock-5b/default.nix @@ -0,0 +1,22 @@ +{ + lib, + pkgs, + config, + ... +}: +{ + imports = [ + ../. + ../../rockchip + ]; + + config = { + hardware = { + radxa.enable = true; + rockchip = { + rk3588.enable = true; + platformFirmware = lib.mkDefault pkgs.ubootRock5ModelB; + }; + }; + }; +} diff --git a/radxa/rock-pi-4/default.nix b/radxa/rock-pi-4/default.nix new file mode 100644 index 00000000..d6000816 --- /dev/null +++ b/radxa/rock-pi-4/default.nix @@ -0,0 +1,22 @@ +{ + lib, + pkgs, + config, + ... +}: +{ + imports = [ + ../. + ../../rockchip + ]; + + config = { + hardware = { + radxa.enable = true; + rockchip = { + rk3399.enable = true; + platformFirmware = lib.mkDefault pkgs.ubootRockPi4; + }; + }; + }; +} diff --git a/radxa/rock-pi-e/default.nix b/radxa/rock-pi-e/default.nix new file mode 100644 index 00000000..95ad4106 --- /dev/null +++ b/radxa/rock-pi-e/default.nix @@ -0,0 +1,22 @@ +{ + lib, + pkgs, + config, + ... +}: +{ + imports = [ + ../. + ../../rockchip + ]; + + config = { + hardware = { + radxa.enable = true; + rockchip = { + rk3328.enable = true; + platformFirmware = lib.mkDefault pkgs.ubootRockPiE; + }; + }; + }; +} diff --git a/raspberry-pi/2/default.nix b/raspberry-pi/2/default.nix index 368cb27f..2e61025c 100644 --- a/raspberry-pi/2/default.nix +++ b/raspberry-pi/2/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ...}: +{ lib, pkgs, ... }: { boot = { diff --git a/raspberry-pi/3/default.nix b/raspberry-pi/3/default.nix index 57da74a3..00e052f6 100644 --- a/raspberry-pi/3/default.nix +++ b/raspberry-pi/3/default.nix @@ -1,6 +1,7 @@ -{ lib -, pkgs -, ... +{ + lib, + pkgs, + ... }: { @@ -11,8 +12,7 @@ # https://github.com/NixOS/nixpkgs/issues/154163#issuecomment-1350599022 nixpkgs.overlays = [ (_final: super: { - makeModulesClosure = x: - super.makeModulesClosure (x // { allowMissing = true; }); + makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; }); }) ]; diff --git a/raspberry-pi/4/apply-overlays-dtmerge.nix b/raspberry-pi/4/apply-overlays-dtmerge.nix index e5b52d37..ab6d5296 100644 --- a/raspberry-pi/4/apply-overlays-dtmerge.nix +++ b/raspberry-pi/4/apply-overlays-dtmerge.nix @@ -1,48 +1,67 @@ # modification of nixpkgs deviceTree.applyOverlays to resolve https://github.com/NixOS/nixpkgs/issues/125354 # derived from https://github.com/NixOS/nixpkgs/blob/916ca8f2b0c208def051f8ea9760c534a40309db/pkgs/os-specific/linux/device-tree/default.nix -{ lib, stdenvNoCC, dtc, libraspberrypi }: +{ + lib, + stdenvNoCC, + dtc, + libraspberrypi, +}: -with lib; (base: overlays': stdenvNoCC.mkDerivation { - name = "device-tree-overlays"; - nativeBuildInputs = [ dtc libraspberrypi ]; - buildCommand = let - overlays = toList overlays'; - in '' - mkdir -p $out - cd "${base}" - find . -type f -name '*.dtb' -print0 \ - | xargs -0 cp -v --no-preserve=mode --target-directory "$out" --parents +with lib; +( + base: overlays': + stdenvNoCC.mkDerivation { + name = "device-tree-overlays"; + nativeBuildInputs = [ + dtc + libraspberrypi + ]; + buildCommand = + let + overlays = toList overlays'; + in + '' + mkdir -p $out + cd "${base}" + find . -type f -name '*.dtb' -print0 \ + | xargs -0 cp -v --no-preserve=mode --target-directory "$out" --parents - for dtb in $(find "$out" -type f -name '*.dtb'); do - dtbCompat=$(fdtget -t s "$dtb" / compatible 2>/dev/null || true) - # skip files without `compatible` string - test -z "$dtbCompat" && continue + for dtb in $(find "$out" -type f -name '*.dtb'); do + dtbCompat=$(fdtget -t s "$dtb" / compatible 2>/dev/null || true) + # skip files without `compatible` string + test -z "$dtbCompat" && continue - ${flip (concatMapStringsSep "\n") overlays (o: '' - overlayCompat="$(fdtget -t s "${o.dtboFile}" / compatible)" + ${flip (concatMapStringsSep "\n") overlays (o: '' + overlayCompat="$(fdtget -t s "${o.dtboFile}" / compatible)" - # skip incompatible and non-matching overlays - if [[ ! "$dtbCompat" =~ "$overlayCompat" ]]; then - echo "Skipping overlay ${o.name}: incompatible with $(basename "$dtb")" - elif ${if ((o.filter or null) == null) then "false" else '' - [[ "''${dtb//${o.filter}/}" == "$dtb" ]] - ''} - then - echo "Skipping overlay ${o.name}: filter does not match $(basename "$dtb")" - else - echo -n "Applying overlay ${o.name} to $(basename "$dtb")... " - mv "$dtb"{,.in} + # skip incompatible and non-matching overlays + if [[ ! "$dtbCompat" =~ "$overlayCompat" ]]; then + echo "Skipping overlay ${o.name}: incompatible with $(basename "$dtb")" + elif ${ + if ((o.filter or null) == null) then + "false" + else + '' + [[ "''${dtb//${o.filter}/}" == "$dtb" ]] + '' + } + then + echo "Skipping overlay ${o.name}: filter does not match $(basename "$dtb")" + else + echo -n "Applying overlay ${o.name} to $(basename "$dtb")... " + mv "$dtb"{,.in} - # dtmerge requires a .dtbo ext for dtbo files, otherwise it adds it to the given file implicitly - dtboWithExt="$TMPDIR/$(basename "${o.dtboFile}").dtbo" - cp -r ${o.dtboFile} "$dtboWithExt" + # dtmerge requires a .dtbo ext for dtbo files, otherwise it adds it to the given file implicitly + dtboWithExt="$TMPDIR/$(basename "${o.dtboFile}").dtbo" + cp -r ${o.dtboFile} "$dtboWithExt" - dtmerge "$dtb.in" "$dtb" "$dtboWithExt" + dtmerge "$dtb.in" "$dtb" "$dtboWithExt" - echo "ok" - rm "$dtb.in" "$dtboWithExt" - fi - '')} + echo "ok" + rm "$dtb.in" "$dtboWithExt" + fi + '')} - done''; -}) + done''; + } +) diff --git a/raspberry-pi/4/audio.nix b/raspberry-pi/4/audio.nix index 38773864..08c0b921 100644 --- a/raspberry-pi/4/audio.nix +++ b/raspberry-pi/4/audio.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.hardware.raspberry-pi."4".audio; @@ -38,9 +43,10 @@ in # set tsched=0 in pulseaudio config to avoid audio glitches # see https://wiki.archlinux.org/title/PulseAudio/Troubleshooting#Glitches,_skips_or_crackling - hardware.pulseaudio.configFile = lib.mkOverride 990 (pkgs.runCommand "default.pa" {} '' - sed 's/module-udev-detect$/module-udev-detect tsched=0/' ${config.hardware.pulseaudio.package}/etc/pulse/default.pa > $out - ''); + hardware.pulseaudio.configFile = lib.mkOverride 990 ( + pkgs.runCommand "default.pa" { } '' + sed 's/module-udev-detect$/module-udev-detect tsched=0/' ${config.hardware.pulseaudio.package}/etc/pulse/default.pa > $out + '' + ); }; } - diff --git a/raspberry-pi/4/default.nix b/raspberry-pi/4/default.nix index ca2c7a89..e02ba0b3 100644 --- a/raspberry-pi/4/default.nix +++ b/raspberry-pi/4/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: { imports = [ @@ -8,6 +13,7 @@ ./cpu-revision.nix ./digi-amp-plus.nix ./dwc2.nix + ./gpio.nix ./i2c.nix ./leds.nix ./modesetting.nix @@ -39,7 +45,6 @@ hardware.deviceTree.filter = lib.mkDefault "bcm2711-rpi-*.dtb"; - assertions = [ { assertion = (lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.1"); diff --git a/raspberry-pi/4/dwc2.nix b/raspberry-pi/4/dwc2.nix index bdb63b18..874efa24 100644 --- a/raspberry-pi/4/dwc2.nix +++ b/raspberry-pi/4/dwc2.nix @@ -25,7 +25,11 @@ in https://www.kernel.org/doc/Documentation/usb/gadget-testing.txt ''; dr_mode = lib.mkOption { - type = lib.types.enum [ "host" "peripheral" "otg" ]; + type = lib.types.enum [ + "host" + "peripheral" + "otg" + ]; default = "otg"; description = '' Dual role mode setting for the dwc2 USB controller driver. diff --git a/raspberry-pi/4/gpio.nix b/raspberry-pi/4/gpio.nix new file mode 100644 index 00000000..dc12965c --- /dev/null +++ b/raspberry-pi/4/gpio.nix @@ -0,0 +1,41 @@ +{ + pkgs, + lib, + config, + ... +}: +{ + options.hardware.raspberry-pi."4".gpio = { + enable = lib.mkOption { + type = lib.types.bool; + description = "Enable udev rules and kernelParams that make lgpio and pigpio work"; + default = false; + }; + }; + config = + let + cfg = config.hardware.raspberry-pi."4".gpio; + in + lib.mkIf cfg.enable { + users.groups.gpio = lib.mkDefault { }; + + # the bit that matters to lgpio here is + # "${pkgs.coreutils}/bin/chgrp gpio /dev/%k && chmod 660 /dev/%k" + # see https://github.com/NixOS/nixpkgs/pull/352308 + + # sudo udevadm test --action=add /dev/gpiochip0 to test + + # import lgpio; lgpio.gpiochip_open(0) should show "1" and not raise + # an exception + + services.udev.extraRules = lib.mkBefore '' + KERNEL=="gpiomem", GROUP="gpio", MODE="0660" + SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ACTION=="add", PROGRAM="${pkgs.bash}/bin/bash -c '${pkgs.coreutils}/bin/chgrp gpio /dev/%k && chmod 660 /dev/%k && ${pkgs.coreutils}/bin/chgrp -R gpio /sys/class/gpio && ${pkgs.coreutils}/bin/chmod -R g=u /sys/class/gpio'" + SUBSYSTEM=="gpio", ACTION=="add", PROGRAM="${pkgs.bash}/bin/bash -c '${pkgs.coreutils}/bin/chgrp -R gpio /sys%p && ${pkgs.coreutils}/bin/chmod -R g=u /sys%p'" + ''; + + boot.kernelParams = [ + "iomem=relaxed" # for pigpiod + ]; + }; +} diff --git a/raspberry-pi/4/i2c.nix b/raspberry-pi/4/i2c.nix index 0355397e..5939a78a 100644 --- a/raspberry-pi/4/i2c.nix +++ b/raspberry-pi/4/i2c.nix @@ -2,24 +2,31 @@ let cfg = config.hardware.raspberry-pi."4"; - optionalProperty = name: value: lib.optionalString (value != null) "${name} = <${builtins.toString value}>;"; - simple-overlay = { target, status, frequency }: { - name = "${target}-${status}-overlay"; - dtsText = '' - /dts-v1/; - /plugin/; - / { - compatible = "brcm,bcm2711"; - fragment@0 { - target = <&${target}>; - __overlay__ { - status = "${status}"; - ${optionalProperty "clock-frequency" frequency} + optionalProperty = + name: value: lib.optionalString (value != null) "${name} = <${builtins.toString value}>;"; + simple-overlay = + { + target, + status, + frequency, + }: + { + name = "${target}-${status}-overlay"; + dtsText = '' + /dts-v1/; + /plugin/; + / { + compatible = "brcm,bcm2711"; + fragment@0 { + target = <&${target}>; + __overlay__ { + status = "${status}"; + ${optionalProperty "clock-frequency" frequency} + }; }; }; - }; - ''; - }; + ''; + }; in { options.hardware.raspberry-pi."4" = { @@ -54,21 +61,25 @@ in (lib.mkIf cfg.i2c0.enable { i2c.enable = lib.mkDefault true; deviceTree = { - overlays = [ (simple-overlay { - target = "i2c0if"; - status = "okay"; - inherit (cfg.i2c0) frequency; - }) ]; + overlays = [ + (simple-overlay { + target = "i2c0if"; + status = "okay"; + inherit (cfg.i2c0) frequency; + }) + ]; }; }) (lib.mkIf cfg.i2c1.enable { i2c.enable = lib.mkDefault true; deviceTree = { - overlays = [ (simple-overlay { - target = "i2c1"; - status = "okay"; - inherit (cfg.i2c1) frequency; - }) ]; + overlays = [ + (simple-overlay { + target = "i2c1"; + status = "okay"; + inherit (cfg.i2c1) frequency; + }) + ]; }; }) ]; diff --git a/raspberry-pi/4/leds.nix b/raspberry-pi/4/leds.nix index 5f58fa22..3860fff5 100644 --- a/raspberry-pi/4/leds.nix +++ b/raspberry-pi/4/leds.nix @@ -2,12 +2,14 @@ let cfg = config.hardware.raspberry-pi."4".leds; - mkDisableOption = name: lib.mkOption { - default = false; - example = true; - description = "Whether to disable ${name}."; - type = lib.types.bool; - }; + mkDisableOption = + name: + lib.mkOption { + default = false; + example = true; + description = "Whether to disable ${name}."; + type = lib.types.bool; + }; in { options.hardware = { @@ -71,23 +73,25 @@ in { name = "disable-act-led"; filter = "*rpi-4-b*"; - dtsText = let - kernelVersion = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.2"; - target = if kernelVersion then "<&led_act>" else "<&act_led>"; - in '' - /dts-v1/; - /plugin/; - /{ - compatible = "raspberrypi,4-model-b"; - fragment@0 { - target = ${target}; - __overlay__ { - gpios = <&gpio 42 0>; /* first two values copied from bcm2711-rpi-4-b.dts */ - linux,default-trigger = "none"; - }; - }; - }; - ''; + dtsText = + let + kernelVersion = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.2"; + target = if kernelVersion then "<&led_act>" else "<&act_led>"; + in + '' + /dts-v1/; + /plugin/; + /{ + compatible = "raspberrypi,4-model-b"; + fragment@0 { + target = ${target}; + __overlay__ { + gpios = <&gpio 42 0>; /* first two values copied from bcm2711-rpi-4-b.dts */ + linux,default-trigger = "none"; + }; + }; + }; + ''; } ]; }; @@ -101,23 +105,25 @@ in { name = "disable-pwr-led"; filter = "*rpi-4-b*"; - dtsText = let - kernelVersion = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.2"; - target = if kernelVersion then "<&led_pwr>" else "<&pwr_led>"; - in '' - /dts-v1/; - /plugin/; - /{ - compatible = "raspberrypi,4-model-b"; - fragment@0 { - target = ${target}; - __overlay__ { - gpios = <&expgpio 2 0>; /* first two values copied from bcm2711-rpi-4-b.dts */ - linux,default-trigger = "default-on"; - }; - }; - }; - ''; + dtsText = + let + kernelVersion = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.2"; + target = if kernelVersion then "<&led_pwr>" else "<&pwr_led>"; + in + '' + /dts-v1/; + /plugin/; + /{ + compatible = "raspberrypi,4-model-b"; + fragment@0 { + target = ${target}; + __overlay__ { + gpios = <&expgpio 2 0>; /* first two values copied from bcm2711-rpi-4-b.dts */ + linux,default-trigger = "default-on"; + }; + }; + }; + ''; } ]; }; diff --git a/raspberry-pi/4/pkgs-overlays.nix b/raspberry-pi/4/pkgs-overlays.nix index 8c3e29af..95109c21 100644 --- a/raspberry-pi/4/pkgs-overlays.nix +++ b/raspberry-pi/4/pkgs-overlays.nix @@ -6,7 +6,8 @@ let applyOverlays = _final.callPackage ./apply-overlays-dtmerge.nix { }; }; }; -in { +in +{ options.hardware = { raspberry-pi."4".apply-overlays-dtmerge = { enable = lib.mkEnableOption '' diff --git a/raspberry-pi/4/poe-hat.nix b/raspberry-pi/4/poe-hat.nix index 5d6cf8d0..0eb8d847 100644 --- a/raspberry-pi/4/poe-hat.nix +++ b/raspberry-pi/4/poe-hat.nix @@ -2,7 +2,8 @@ let cfg = config.hardware.raspberry-pi."4".poe-hat; -in { +in +{ options.hardware = { raspberry-pi."4".poe-hat = { enable = lib.mkEnableOption '' @@ -18,7 +19,7 @@ in { hardware.deviceTree = { overlays = [ - # Equivalent to: https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts + # Equivalent to: https://github.com/raspberrypi/linux/blob/rpi-6.6.y/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts { name = "rpi-poe-overlay"; dtsText = '' @@ -38,7 +39,7 @@ in { compatible = "pwm-fan"; cooling-levels = <0 1 10 100 255>; #cooling-cells = <2>; - pwms = <&fwpwm 0 80000>; + pwms = <&fwpwm 0 80000 0>; }; }; }; diff --git a/raspberry-pi/4/poe-plus-hat.nix b/raspberry-pi/4/poe-plus-hat.nix index bd7c28ec..985971f3 100644 --- a/raspberry-pi/4/poe-plus-hat.nix +++ b/raspberry-pi/4/poe-plus-hat.nix @@ -2,7 +2,8 @@ let cfg = config.hardware.raspberry-pi."4".poe-plus-hat; -in { +in +{ options.hardware = { raspberry-pi."4".poe-plus-hat = { enable = lib.mkEnableOption '' @@ -19,8 +20,8 @@ in { hardware.deviceTree = { overlays = [ # Combined equivalent to: - # * https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts - # * https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts + # * https://github.com/raspberrypi/linux/blob/rpi-6.6.y/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts + # * https://github.com/raspberrypi/linux/blob/rpi-6.6.y/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts { name = "rpi-poe-plus-overlay"; dtsText = '' @@ -40,7 +41,7 @@ in { compatible = "pwm-fan"; cooling-levels = <0 1 10 100 255>; #cooling-cells = <2>; - pwms = <&fwpwm 0 80000>; + pwms = <&fwpwm 0 80000 0>; }; }; }; diff --git a/raspberry-pi/4/pwm0.nix b/raspberry-pi/4/pwm0.nix index 5470eaf4..665f81be 100644 --- a/raspberry-pi/4/pwm0.nix +++ b/raspberry-pi/4/pwm0.nix @@ -14,37 +14,39 @@ in config = lib.mkIf cfg.enable { hardware.deviceTree = { - overlays = [{ - name = "pwm-overlay"; - dtsText = '' - /dts-v1/; - /plugin/; - / { - compatible = "brcm,bcm2711"; + overlays = [ + { + name = "pwm-overlay"; + dtsText = '' + /dts-v1/; + /plugin/; + / { + compatible = "brcm,bcm2711"; - fragment@0 { - target = <&gpio>; - __overlay__ { - pwm_pins: pwm_pins { - brcm,pins = <18>; - brcm,function = <2>; /* Alt5 */ + fragment@0 { + target = <&gpio>; + __overlay__ { + pwm_pins: pwm_pins { + brcm,pins = <18>; + brcm,function = <2>; /* Alt5 */ + }; }; }; - }; - fragment@1 { - target = <&pwm>; - __overlay__ { - pinctrl-names = "default"; - assigned-clock-rates = <100000000>; - status = "okay"; - pinctrl-0 = <&pwm_pins>; + fragment@1 { + target = <&pwm>; + __overlay__ { + pinctrl-names = "default"; + assigned-clock-rates = <100000000>; + status = "okay"; + pinctrl-0 = <&pwm_pins>; + }; }; - }; - }; - ''; - }]; + }; + ''; + } + ]; }; }; } diff --git a/raspberry-pi/4/tv-hat.nix b/raspberry-pi/4/tv-hat.nix index 8c480f43..263d6fcf 100644 --- a/raspberry-pi/4/tv-hat.nix +++ b/raspberry-pi/4/tv-hat.nix @@ -2,7 +2,8 @@ let cfg = config.hardware.raspberry-pi."4".tv-hat; -in { +in +{ options.hardware = { raspberry-pi."4".tv-hat = { enable = lib.mkEnableOption '' diff --git a/raspberry-pi/4/xhci.nix b/raspberry-pi/4/xhci.nix index b5398f2e..eb1d2ada 100644 --- a/raspberry-pi/4/xhci.nix +++ b/raspberry-pi/4/xhci.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.hardware.raspberry-pi."4".xhci; -in { +in +{ options.hardware = { raspberry-pi."4".xhci = { enable = lib.mkEnableOption '' diff --git a/raspberry-pi/5/default.nix b/raspberry-pi/5/default.nix index aba0178f..12d51b4d 100644 --- a/raspberry-pi/5/default.nix +++ b/raspberry-pi/5/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: let linux_rpi5 = pkgs.linux_rpi4.override { rpiVersion = 5; @@ -18,12 +23,12 @@ in # Needed for Xorg to start (https://github.com/raspberrypi-ui/gldriver-test/blob/master/usr/lib/systemd/scripts/rp1_test.sh) # This won't work for displays connected to the RP1 (DPI/composite/MIPI DSI), since I don't have one to test. services.xserver.extraConfig = '' - Section "OutputClass" - Identifier "vc4" - MatchDriver "vc4" - Driver "modesetting" - Option "PrimaryGPU" "true" - EndSection + Section "OutputClass" + Identifier "vc4" + MatchDriver "vc4" + Driver "modesetting" + Option "PrimaryGPU" "true" + EndSection ''; assertions = [ diff --git a/rockchip/default.nix b/rockchip/default.nix index 461baedd..f0195f9d 100644 --- a/rockchip/default.nix +++ b/rockchip/default.nix @@ -1,23 +1,45 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: let cfg = config.hardware.rockchip; -in { +in +{ + imports = [ + ./rk3328 + ./rk3399 + ./rk3588 + ]; + options.hardware.rockchip = { enable = lib.mkEnableOption "Rockchip SoC support"; diskoImageName = lib.mkOption { type = lib.types.str; default = "main.raw"; description = '' - The output image name for Disko. - Can be used by diskoExtraPostVM. + The output image name of Disko. + You need to match this value with the real image name. Setting it alone + won't change the output image name, as it is controlled by Disko module. + + Can be used in diskoExtraPostVM. ''; }; + platformFirmware = lib.mkPackageOption pkgs "platform firmware" { + default = null; + }; diskoExtraPostVM = lib.mkOption { type = lib.types.str; + default = '' + ${lib.getExe' pkgs.coreutils "dd"} conv=notrunc,fsync if=${config.hardware.rockchip.platformFirmware}/idbloader.img of=$out/${config.hardware.rockchip.diskoImageName} bs=512 seek=64 + ${lib.getExe' pkgs.coreutils "dd"} conv=notrunc,fsync if=${config.hardware.rockchip.platformFirmware}/u-boot.itb of=$out/${config.hardware.rockchip.diskoImageName} bs=512 seek=16384 + ''; + defaultText = lib.literalExpression '' + ${lib.getExe' pkgs.coreutils "dd"} conv=notrunc,fsync if=${config.hardware.rockchip.platformFirmware}/idbloader.img of=$out/${config.hardware.rockchip.diskoImageName} bs=512 seek=64 + ${lib.getExe' pkgs.coreutils "dd"} conv=notrunc,fsync if=${config.hardware.rockchip.platformFirmware}/u-boot.itb of=$out/${config.hardware.rockchip.diskoImageName} bs=512 seek=16384 + ''; description = '' The post VM hook for Disko's Image Builder. Can be used to install platform firmware like U-Boot. diff --git a/rockchip/disko.nix b/rockchip/disko.nix index 7d6b4c9a..fa846c2e 100644 --- a/rockchip/disko.nix +++ b/rockchip/disko.nix @@ -1,11 +1,13 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: let cfg = config.hardware.rockchip; -in { +in +{ imports = [ rk3399/disko.nix ]; diff --git a/rockchip/rk3328/default.nix b/rockchip/rk3328/default.nix new file mode 100644 index 00000000..804be1a5 --- /dev/null +++ b/rockchip/rk3328/default.nix @@ -0,0 +1,18 @@ +{ + lib, + pkgs, + config, + ... +}: +let + cfg = config.hardware.rockchip.rk3328; +in +{ + options.hardware.rockchip.rk3328 = { + enable = lib.mkEnableOption "Rockchip RK3328 support"; + }; + + config = lib.mkIf cfg.enable { + hardware.rockchip.enable = true; + }; +} diff --git a/rockchip/rk3399/default.nix b/rockchip/rk3399/default.nix index 3aea18fd..17f92779 100644 --- a/rockchip/rk3399/default.nix +++ b/rockchip/rk3399/default.nix @@ -1,17 +1,15 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: let cfg = config.hardware.rockchip.rk3399; -in { - imports = [ - ../. - ]; - +in +{ options.hardware.rockchip.rk3399 = { - enable = lib.mkEnableOption "Rockchip RK3399 support"; + enable = lib.mkEnableOption "Rockchip RK3399 support"; }; config = lib.mkIf cfg.enable { diff --git a/rockchip/rk3399/disko.nix b/rockchip/rk3399/disko.nix index bae10ef5..b48972b4 100644 --- a/rockchip/rk3399/disko.nix +++ b/rockchip/rk3399/disko.nix @@ -1,14 +1,18 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: let cfg = config.hardware.rockchip.rk3399; -in { +in +{ config = lib.mkIf cfg.enable { - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - "arm-trusted-firmware-rk3399" - ]; + nixpkgs.config.allowUnfreePredicate = + pkg: + builtins.elem (lib.getName pkg) [ + "arm-trusted-firmware-rk3399" + ]; }; } diff --git a/rockchip/rk3588/default.nix b/rockchip/rk3588/default.nix new file mode 100644 index 00000000..7dff0b64 --- /dev/null +++ b/rockchip/rk3588/default.nix @@ -0,0 +1,18 @@ +{ + lib, + pkgs, + config, + ... +}: +let + cfg = config.hardware.rockchip.rk3588; +in +{ + options.hardware.rockchip.rk3588 = { + enable = lib.mkEnableOption "Rockchip RK3588 support"; + }; + + config = lib.mkIf cfg.enable { + hardware.rockchip.enable = true; + }; +} diff --git a/samsung/np900x3c/default.nix b/samsung/np900x3c/default.nix index 1d850eb5..83261ed9 100644 --- a/samsung/np900x3c/default.nix +++ b/samsung/np900x3c/default.nix @@ -1,2 +1,2 @@ # TODO: use ../../common/pc/laptop -{} +{ } diff --git a/scripts/update-tests-hash b/scripts/update-tests-hash new file mode 100755 index 00000000..f2508b9a --- /dev/null +++ b/scripts/update-tests-hash @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Helper script to update the tests flake hash +set -euo pipefail + +# Go to the root of the repository +cd "$(dirname "$0")/.." + +echo "Updating tests.narHash..." >&2 + +# Update the flake lock file +nix --extra-experimental-features 'flakes nix-command' flake lock ./tests + +# Generate the hash +nix --extra-experimental-features 'flakes nix-command' hash path ./tests > ./tests.narHash + +echo "Hash updated successfully: $(cat tests.narHash)" \ No newline at end of file diff --git a/slimbook/hero/rpl-rtx/default.nix b/slimbook/hero/rpl-rtx/default.nix index b71c22c7..f1a249de 100644 --- a/slimbook/hero/rpl-rtx/default.nix +++ b/slimbook/hero/rpl-rtx/default.nix @@ -6,7 +6,7 @@ ../../../common/gpu/nvidia/ada-lovelace ../../../common/gpu/nvidia/prime.nix ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; hardware = { diff --git a/starfive/visionfive/v1/default.nix b/starfive/visionfive/v1/default.nix index 4a3c3dd0..0d55a3e9 100644 --- a/starfive/visionfive/v1/default.nix +++ b/starfive/visionfive/v1/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ...}: +{ + config, + lib, + pkgs, + ... +}: { hardware.deviceTree.name = lib.mkDefault "starfive/jh7100-starfive-visionfive-v1.dtb"; @@ -7,9 +12,19 @@ boot = { # Force no ZFS (from nixos/modules/profiles/base.nix) until updated to kernel 6.0 - supportedFilesystems = lib.mkForce [ "btrfs" "reiserfs" "vfat" "f2fs" "xfs" "ntfs" "cifs" ]; + supportedFilesystems = lib.mkForce [ + "btrfs" + "reiserfs" + "vfat" + "f2fs" + "xfs" + "ntfs" + "cifs" + ]; consoleLogLevel = lib.mkDefault 7; - kernelPackages = lib.mkDefault (pkgs.callPackage ./linux.nix { inherit (config.boot) kernelPatches; }); + kernelPackages = lib.mkDefault ( + pkgs.callPackage ./linux.nix { inherit (config.boot) kernelPatches; } + ); kernelParams = lib.mkDefault [ "console=tty0" diff --git a/starfive/visionfive/v1/firmware.nix b/starfive/visionfive/v1/firmware.nix index 3ea63757..308e355c 100644 --- a/starfive/visionfive/v1/firmware.nix +++ b/starfive/visionfive/v1/firmware.nix @@ -1,6 +1,7 @@ -{ runCommand -, buildPackages -, pkgs +{ + runCommand, + buildPackages, + pkgs, }: let @@ -10,26 +11,29 @@ let withPayload = "${uboot}/u-boot.bin"; withFDT = "${uboot}/u-boot.dtb"; }; -in runCommand "firmware-starfive-visionfive-v1" { - nativeBuildInputs = with buildPackages; [ xxd ]; -} '' - function handle_file { - inFile=$1 - echo inFile: $inFile - outFile=$2 - inSize=`stat -c "%s" $inFile` - inSize32HexBe=`printf "%08x\n" $inSize` - inSize32HexLe=''${inSize32HexBe:6:2}''${inSize32HexBe:4:2}''${inSize32HexBe:2:2}''${inSize32HexBe:0:2} - echo "inSize: $inSize (0x$inSize32HexBe, LE:0x$inSize32HexLe)" - echo $inSize32HexLe | xxd -r -ps > $outFile - cat $inFile >> $outFile - echo outFile: $outFile - outSize=`stat -c "%s" $outFile` - outSize32HexBe=`printf "%08x\n" $outSize` - echo "outSize: $outSize (0x$outSize32HexBe)" +in +runCommand "firmware-starfive-visionfive-v1" + { + nativeBuildInputs = with buildPackages; [ xxd ]; } + '' + function handle_file { + inFile=$1 + echo inFile: $inFile + outFile=$2 + inSize=`stat -c "%s" $inFile` + inSize32HexBe=`printf "%08x\n" $inSize` + inSize32HexLe=''${inSize32HexBe:6:2}''${inSize32HexBe:4:2}''${inSize32HexBe:2:2}''${inSize32HexBe:0:2} + echo "inSize: $inSize (0x$inSize32HexBe, LE:0x$inSize32HexLe)" + echo $inSize32HexLe | xxd -r -ps > $outFile + cat $inFile >> $outFile + echo outFile: $outFile + outSize=`stat -c "%s" $outFile` + outSize32HexBe=`printf "%08x\n" $outSize` + echo "outSize: $outSize (0x$outSize32HexBe)" + } - mkdir -p "$out/nix-support" - echo "file bin \"$out/opensbi_u-boot_starfive_visionfive_v1.bin\"" >> "$out/nix-support/hydra-build-products" - handle_file ${opensbi}/share/opensbi/lp64/generic/firmware/fw_payload.bin $out/opensbi_u-boot_starfive_visionfive_v1.bin -'' + mkdir -p "$out/nix-support" + echo "file bin \"$out/opensbi_u-boot_starfive_visionfive_v1.bin\"" >> "$out/nix-support/hydra-build-products" + handle_file ${opensbi}/share/opensbi/lp64/generic/firmware/fw_payload.bin $out/opensbi_u-boot_starfive_visionfive_v1.bin + '' diff --git a/starfive/visionfive/v1/linux.nix b/starfive/visionfive/v1/linux.nix index 88909099..157745ed 100644 --- a/starfive/visionfive/v1/linux.nix +++ b/starfive/visionfive/v1/linux.nix @@ -1,36 +1,44 @@ -{ lib -, callPackage -, linuxPackagesFor -, kernelPatches -, ... }: +{ + lib, + callPackage, + linuxPackagesFor, + kernelPatches, + ... +}: let modDirVersion = "6.0.0"; - linuxPkg = { fetchFromGitHub, buildLinux, ... } @ args: - buildLinux (args // { - inherit modDirVersion kernelPatches; - version = "${modDirVersion}-starfive-visionfive-v1"; + linuxPkg = + { fetchFromGitHub, buildLinux, ... }@args: + buildLinux ( + args + // { + inherit modDirVersion kernelPatches; + version = "${modDirVersion}-starfive-visionfive-v1"; - src = fetchFromGitHub { - owner = "starfive-tech"; - repo = "linux"; - rev = "cfcb617265422c0af0ae5bc9688dceba2d10b27a"; - sha256 = "sha256-EAMCOtJZ51xSLySQPaZyomfa/1Xs9kNedz04tIbELqg="; - }; + src = fetchFromGitHub { + owner = "starfive-tech"; + repo = "linux"; + rev = "cfcb617265422c0af0ae5bc9688dceba2d10b27a"; + sha256 = "sha256-EAMCOtJZ51xSLySQPaZyomfa/1Xs9kNedz04tIbELqg="; + }; - defconfig = "starfive_jh7100_fedora_defconfig"; + defconfig = "starfive_jh7100_fedora_defconfig"; - structuredExtraConfig = with lib.kernel; { - KEXEC = yes; - SERIAL_8250_DW = yes; - PINCTRL_STARFIVE = yes; - DW_AXI_DMAC_STARFIVE = yes; - PTP_1588_CLOCK = yes; - STMMAC_ETH = yes; - STMMAC_PCI = yes; - }; + structuredExtraConfig = with lib.kernel; { + KEXEC = yes; + SERIAL_8250_DW = yes; + PINCTRL_STARFIVE = yes; + DW_AXI_DMAC_STARFIVE = yes; + PTP_1588_CLOCK = yes; + STMMAC_ETH = yes; + STMMAC_PCI = yes; + }; - extraMeta.branch = "visionfive"; - } // (args.argsOverride or { })); -in lib.recurseIntoAttrs (linuxPackagesFor (callPackage linuxPkg { })) + extraMeta.branch = "visionfive"; + } + // (args.argsOverride or { }) + ); +in +lib.recurseIntoAttrs (linuxPackagesFor (callPackage linuxPkg { })) diff --git a/starfive/visionfive/v1/sd-image.nix b/starfive/visionfive/v1/sd-image.nix index 6b4acfc5..7b855c44 100644 --- a/starfive/visionfive/v1/sd-image.nix +++ b/starfive/visionfive/v1/sd-image.nix @@ -1,10 +1,16 @@ # To build, use: # nix-build "" -I nixos-config=starfive/visionfive/v1/sd-image.nix -A config.system.build.sdImage -{ config, pkgs, modulesPath, ... }: +{ + config, + pkgs, + modulesPath, + ... +}: let firmware = pkgs.callPackage ./firmware.nix { }; -in { +in +{ imports = [ "${modulesPath}/profiles/base.nix" "${modulesPath}/installer/sd-card/sd-image.nix" diff --git a/starfive/visionfive/v1/uboot.nix b/starfive/visionfive/v1/uboot.nix index 9eebeb9f..4f3d6a52 100644 --- a/starfive/visionfive/v1/uboot.nix +++ b/starfive/visionfive/v1/uboot.nix @@ -1,5 +1,6 @@ -{ fetchFromGitHub -, buildUBoot +{ + fetchFromGitHub, + buildUBoot, }: buildUBoot { @@ -13,5 +14,8 @@ buildUBoot { }; defconfig = "starfive_jh7100_visionfive_smode_defconfig"; - filesToInstall = [ "u-boot.bin" "u-boot.dtb" ]; + filesToInstall = [ + "u-boot.bin" + "u-boot.dtb" + ]; } diff --git a/starfive/visionfive/v2/firmware.nix b/starfive/visionfive/v2/firmware.nix index b6291152..54360093 100644 --- a/starfive/visionfive/v2/firmware.nix +++ b/starfive/visionfive/v2/firmware.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.hardware.visionfive2; in @@ -34,15 +39,19 @@ in config = { system.build = { - opensbi = (pkgs.callPackage ./opensbi.nix {}).overrideAttrs (f: p: { - src = if cfg.opensbi.src != null then cfg.opensbi.src else p.src; - patches = if cfg.opensbi.patches != null then cfg.opensbi.patches else (p.patches or []); - }); + opensbi = (pkgs.callPackage ./opensbi.nix { }).overrideAttrs ( + _f: p: { + src = if cfg.opensbi.src != null then cfg.opensbi.src else p.src; + patches = if cfg.opensbi.patches != null then cfg.opensbi.patches else (p.patches or [ ]); + } + ); - uboot = (pkgs.callPackage ./uboot.nix { inherit (config.system.build) opensbi; }).overrideAttrs (f: p: { - src = if cfg.uboot.src != null then cfg.uboot.src else p.src; - patches = if cfg.uboot.patches != null then cfg.uboot.patches else (p.patches or []); - }); + uboot = (pkgs.callPackage ./uboot.nix { inherit (config.system.build) opensbi; }).overrideAttrs ( + _f: p: { + src = if cfg.uboot.src != null then cfg.uboot.src else p.src; + patches = if cfg.uboot.patches != null then cfg.uboot.patches else (p.patches or [ ]); + } + ); updater-flash = pkgs.writeShellApplication { name = "visionfive2-firmware-update-flash"; diff --git a/starfive/visionfive/v2/sd-image.nix b/starfive/visionfive/v2/sd-image.nix index a14b87b2..667dc3fa 100644 --- a/starfive/visionfive/v2/sd-image.nix +++ b/starfive/visionfive/v2/sd-image.nix @@ -1,4 +1,9 @@ -{ config, pkgs, modulesPath, ... }: +{ + config, + pkgs, + modulesPath, + ... +}: { imports = [ "${modulesPath}/profiles/base.nix" @@ -7,8 +12,7 @@ ]; sdImage = { - imageName = - "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-starfive-visionfive2.img"; + imageName = "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-starfive-visionfive2.img"; # Overridden by postBuildCommands populateFirmwareCommands = ""; diff --git a/starfive/visionfive/v2/spl-tool.nix b/starfive/visionfive/v2/spl-tool.nix index cd0a77b0..a4543373 100644 --- a/starfive/visionfive/v2/spl-tool.nix +++ b/starfive/visionfive/v2/spl-tool.nix @@ -1,6 +1,6 @@ { stdenv, fetchFromGitHub }: -stdenv.mkDerivation (finalAttrs: { +stdenv.mkDerivation (_finalAttrs: { pname = "spi_tool"; version = "0x01010101"; src = fetchFromGitHub { diff --git a/starfive/visionfive/v2/uboot.nix b/starfive/visionfive/v2/uboot.nix index ef92cce3..6fe62a70 100644 --- a/starfive/visionfive/v2/uboot.nix +++ b/starfive/visionfive/v2/uboot.nix @@ -1,5 +1,6 @@ -{ buildUBoot -, opensbi +{ + buildUBoot, + opensbi, }: buildUBoot { diff --git a/starlabs/starlite/i5/default.nix b/starlabs/starlite/i5/default.nix index 018a5766..62e9d5a3 100644 --- a/starlabs/starlite/i5/default.nix +++ b/starlabs/starlite/i5/default.nix @@ -3,7 +3,7 @@ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; # Turn on IIO for accelerometer screen rotation. diff --git a/supermicro/default.nix b/supermicro/default.nix index 9c5a2bb3..817f01d1 100644 --- a/supermicro/default.nix +++ b/supermicro/default.nix @@ -1,5 +1,8 @@ { pkgs, ... }: { - boot.kernelModules = [ "ipmi_devintf" "ipmi_si" ]; + boot.kernelModules = [ + "ipmi_devintf" + "ipmi_si" + ]; environment.systemPackages = [ pkgs.ipmitool ]; } diff --git a/supermicro/x10sll-f/default.nix b/supermicro/x10sll-f/default.nix index c0200510..cbba1eb8 100644 --- a/supermicro/x10sll-f/default.nix +++ b/supermicro/x10sll-f/default.nix @@ -3,7 +3,10 @@ ../. ]; - boot.kernelModules = [ "jc42" "tpm_rng" ]; + boot.kernelModules = [ + "jc42" + "tpm_rng" + ]; # services.cron.systemCronJobs = [ # # Reset 5-minute watchdog timer every minute diff --git a/system76/darp6/default.nix b/system76/darp6/default.nix index 3f93993e..b5a2560f 100644 --- a/system76/darp6/default.nix +++ b/system76/darp6/default.nix @@ -10,25 +10,30 @@ # system76-io-dkms also appears to be loaded on darp6 with Pop!_OS, and # system76-dkms does not, and in fact refuses to load. -{ config, lib, options, pkgs, ... }: +{ + config, + lib, + options, + pkgs, + ... +}: let cfg = config.hardware.system76.darp6; # Allow silencing the warning about these options if either is defined. soundSettingsDefined = - options.hardware.system76.darp6.soundVendorId.isDefined || - options.hardware.system76.darp6.soundSubsystemId.isDefined; + options.hardware.system76.darp6.soundVendorId.isDefined + || options.hardware.system76.darp6.soundSubsystemId.isDefined; # We neeed both options non-null to be able to apply the headset fixup though. soundSettingsAvailable = - soundSettingsDefined && - (cfg.soundVendorId != null && cfg.soundSubsystemId != null); + soundSettingsDefined && (cfg.soundVendorId != null && cfg.soundSubsystemId != null); in { imports = [ ../. ../../common/pc/laptop - ../../common/pc/laptop/ssd + ../../common/pc/ssd ]; options.hardware.system76.darp6 = { diff --git a/system76/galp5-1650/default.nix b/system76/galp5-1650/default.nix index c2fcf231..71820f6d 100644 --- a/system76/galp5-1650/default.nix +++ b/system76/galp5-1650/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ ../. diff --git a/system76/gaze18/default.nix b/system76/gaze18/default.nix index dd4302b8..61b3f92f 100644 --- a/system76/gaze18/default.nix +++ b/system76/gaze18/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ ../. diff --git a/system76/thelio-mega/default.nix b/system76/thelio-mega/default.nix new file mode 100644 index 00000000..b88f1366 --- /dev/null +++ b/system76/thelio-mega/default.nix @@ -0,0 +1,16 @@ +# Hardware profile for the Thelio Mega desktop workstation by System76. +# +# https://system76.com/desktops/thelio-mega-r4-n3/configure +{ + config, + lib, + ... +}: +{ + imports = [ + ../../common/cpu/amd + ../../common/gpu/nvidia + ]; + + hardware.nvidia.open = true; +} diff --git a/tests/build-profile.nix b/tests/build-profile.nix index 786fa8b6..3c20380d 100644 --- a/tests/build-profile.nix +++ b/tests/build-profile.nix @@ -2,20 +2,23 @@ (pkgs.nixos [ profile - ({ config, lib, ... }: { - nixpkgs.pkgs = pkgs; - boot.loader.systemd-boot.enable = !config.boot.loader.generic-extlinux-compatible.enable; - # we forcefully disable grub here just for testing purposes, even though some profiles might still use grub in the end. - boot.loader.grub.enable = false; + ( + { config, lib, ... }: + { + nixpkgs.pkgs = pkgs; + boot.loader.systemd-boot.enable = !config.boot.loader.generic-extlinux-compatible.enable; + # we forcefully disable grub here just for testing purposes, even though some profiles might still use grub in the end. + boot.loader.grub.enable = false; - # so we can have assertions that require a certain minimum kernel version, - # We use a priority of 1200 here, which is higher than the default of 1000 - boot.kernelPackages = lib.mkOverride 1200 pkgs.linuxPackages_latest; + # so we can have assertions that require a certain minimum kernel version, + # We use a priority of 1200 here, which is higher than the default of 1000 + boot.kernelPackages = lib.mkOverride 1200 pkgs.linuxPackages_latest; - fileSystems."/" = { - device = "/dev/disk/by-uuid/00000000-0000-0000-0000-000000000000"; - fsType = "btrfs"; - }; - system.stateVersion = lib.version; - }) + fileSystems."/" = { + device = "/dev/disk/by-uuid/00000000-0000-0000-0000-000000000000"; + fsType = "btrfs"; + }; + system.stateVersion = config.system.nixos.release; + } + ) ]).config.system.build.toplevel diff --git a/tests/flake.lock b/tests/flake.lock index c0ee1775..4363c6d1 100644 --- a/tests/flake.lock +++ b/tests/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1736143030, - "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", + "lastModified": 1743550720, + "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", + "rev": "c621e8422220273271f52058f618c94e405bb0f5", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1736232973, - "narHash": "sha256-8YT/8TMwWRRYFiLWMS98wPW50YBwYeErX7nQ7EmSaVA=", + "lastModified": 1747083103, + "narHash": "sha256-dMx20S2molwqJxbmMB4pGjNfgp5H1IOHNa1Eby6xL+0=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "3713545aca79365cba20d7873b6e51044890b4e8", + "rev": "d1d68fe8b00248caaa5b3bbe4984c12b47e0867d", "type": "github" }, "original": { @@ -37,34 +37,36 @@ }, "nixos-stable": { "locked": { - "lastModified": 1735563628, - "narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798", - "type": "github" + "lastModified": 1751211869, + "narHash": "sha256-1Cu92i1KSPbhPCKxoiVG5qnoRiKTgR5CcGSRyLpOd7Y=", + "ref": "nixos-25.05", + "rev": "b43c397f6c213918d6cfe6e3550abfe79b5d1c51", + "shallow": true, + "type": "git", + "url": "https://github.com/NixOS/nixpkgs" }, "original": { - "owner": "NixOS", - "ref": "nixos-24.05", - "repo": "nixpkgs", - "type": "github" + "ref": "nixos-25.05", + "shallow": true, + "type": "git", + "url": "https://github.com/NixOS/nixpkgs" } }, "nixos-unstable-small": { "locked": { - "lastModified": 1736208088, - "narHash": "sha256-2030VBfWuPLPEUrONVY/uF79EuNCztKunuKLgKkQWqM=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "42de2bcb35ccf24626325bd6114ef9d812eaeb0d", - "type": "github" + "lastModified": 1747040834, + "narHash": "sha256-iKQKoNlZmxQq+O2WfImm/jn97g5GZBVW5EZEoCTXZ3I=", + "ref": "nixos-unstable-small", + "rev": "e4f52f3ea82ddd3754b467e3fdc0d709685c9a05", + "shallow": true, + "type": "git", + "url": "https://github.com/NixOS/nixpkgs" }, "original": { - "owner": "NixOS", "ref": "nixos-unstable-small", - "repo": "nixpkgs", - "type": "github" + "shallow": true, + "type": "git", + "url": "https://github.com/NixOS/nixpkgs" } }, "root": { @@ -72,7 +74,28 @@ "flake-parts": "flake-parts", "nixos-hardware": "nixos-hardware", "nixos-stable": "nixos-stable", - "nixos-unstable-small": "nixos-unstable-small" + "nixos-unstable-small": "nixos-unstable-small", + "treefmt-nix": "treefmt-nix" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixos-unstable-small" + ] + }, + "locked": { + "lastModified": 1750931469, + "narHash": "sha256-0IEdQB1nS+uViQw4k3VGUXntjkDp7aAlqcxdewb/hAc=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "ac8e6f32e11e9c7f153823abc3ab007f2a65d3e1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" } } }, diff --git a/tests/flake.nix b/tests/flake.nix index 2e65b843..443bfbd7 100644 --- a/tests/flake.nix +++ b/tests/flake.nix @@ -2,17 +2,22 @@ description = "Test flake for nixos-hardware"; inputs = { - nixos-unstable-small.url = "github:NixOS/nixpkgs/nixos-unstable-small"; - nixos-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; + nixos-unstable-small.url = "git+https://github.com/NixOS/nixpkgs?shallow=1&ref=nixos-unstable-small"; + nixos-stable.url = "git+https://github.com/NixOS/nixpkgs?shallow=1&ref=nixos-25.05"; # override in the test nixos-hardware.url = "github:NixOS/nixos-hardware"; flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.inputs.nixpkgs-lib.follows = "nixos-unstable-small"; + treefmt-nix.url = "github:numtide/treefmt-nix"; + treefmt-nix.inputs.nixpkgs.follows = "nixos-unstable-small"; }; outputs = inputs@{ flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + inputs.treefmt-nix.flakeModule + ]; systems = [ "aarch64-linux" "x86_64-linux" @@ -23,7 +28,6 @@ system, lib, pkgs, - inputs', ... }: let @@ -86,10 +90,36 @@ in { _module.args.pkgs = nixpkgsUnstable; - checks = checksForNixpkgs "nixos-unstable" nixpkgsUnstable // checksForNixpkgs "nixos-stable" nixpkgsStable; + + treefmt = { + flakeCheck = pkgs.hostPlatform.system != "riscv64-linux"; + projectRootFile = "COPYING"; + programs = { + deadnix = { + enable = true; + no-lambda-pattern-names = true; + }; + nixfmt = { + enable = true; + package = pkgs.nixfmt-rfc-style; + }; + }; + settings = { + on-unmatched = "info"; + }; + }; + + checks = + checksForNixpkgs "nixos-unstable" nixpkgsUnstable + // checksForNixpkgs "nixos-stable" nixpkgsStable; packages.run = pkgs.writeShellScriptBin "run.py" '' #!${pkgs.bash}/bin/bash - export PATH=${lib.makeBinPath [ pkgs.nix-eval-jobs pkgs.nix-eval-jobs.nix ]} + export PATH=${ + lib.makeBinPath [ + pkgs.nix-eval-jobs + pkgs.nix-eval-jobs.nix + ] + } exec ${pkgs.python3.interpreter} ${./.}/run.py --nixos-hardware "$@" ''; }; diff --git a/toshiba/swanky/default.nix b/toshiba/swanky/default.nix index 32e3b126..7557d0a9 100644 --- a/toshiba/swanky/default.nix +++ b/toshiba/swanky/default.nix @@ -17,11 +17,13 @@ in boot.kernelParams = [ "acpi_backlight=vendor" ]; # Sound requires a custom UCM config: - system.replaceRuntimeDependencies = [{ - original = pkgs.alsa-lib; + system.replaceRuntimeDependencies = [ + { + original = pkgs.alsa-lib; - replacement = pkgs.alsa-lib.overrideAttrs (_super: { - postFixup = "cp -r ${ucm}/chtmax98090 $out/share/alsa/ucm"; - }); - }]; + replacement = pkgs.alsa-lib.overrideAttrs (_super: { + postFixup = "cp -r ${ucm}/chtmax98090 $out/share/alsa/ucm"; + }); + } + ]; } diff --git a/tuxedo/infinitybook/default.nix b/tuxedo/infinitybook/default.nix new file mode 100644 index 00000000..a0f21a44 --- /dev/null +++ b/tuxedo/infinitybook/default.nix @@ -0,0 +1,16 @@ +{ lib, options, ... }: +{ + imports = [ + ../../common/pc/laptop + ../../common/pc/ssd + ]; + + hardware = + lib.mkDefault { + bluetooth.enable = true; + } + # Enable TUXEDO's kernel drivers if they are available + // lib.optionalAttrs (options.hardware ? tuxedo-drivers) { + tuxedo-drivers.enable = true; + }; +} diff --git a/tuxedo/infinitybook/gen9-intel/default.nix b/tuxedo/infinitybook/gen9-intel/default.nix new file mode 100644 index 00000000..3f0b97a2 --- /dev/null +++ b/tuxedo/infinitybook/gen9-intel/default.nix @@ -0,0 +1,11 @@ +{ + warnings = [ + '' + DEPRECATED: The module has been renamed to + + The gen9-intel module will be removed in a future release. + '' + ]; + + imports = [ ../pro14/gen9/intel ]; +} diff --git a/tuxedo/infinitybook/pro14/gen7/default.nix b/tuxedo/infinitybook/pro14/gen7/default.nix index 9971b7bc..271302b2 100644 --- a/tuxedo/infinitybook/pro14/gen7/default.nix +++ b/tuxedo/infinitybook/pro14/gen7/default.nix @@ -2,9 +2,8 @@ { imports = [ + ../../. ../../../../common/cpu/intel - ../../../../common/pc/laptop - ../../../../common/pc/ssd ]; # Cooling management diff --git a/tuxedo/infinitybook/pro14/gen9/amd/README.md b/tuxedo/infinitybook/pro14/gen9/amd/README.md new file mode 100644 index 00000000..9f8c4038 --- /dev/null +++ b/tuxedo/infinitybook/pro14/gen9/amd/README.md @@ -0,0 +1 @@ +# [TUXEDO InfinityBook Pro 14 - Gen9 - AMD](https://www.tuxedocomputers.com/en/TUXEDO-InfinityBook-Pro-14-Gen9-AMD) diff --git a/tuxedo/infinitybook/pro14/gen9/amd/default.nix b/tuxedo/infinitybook/pro14/gen9/amd/default.nix new file mode 100644 index 00000000..15452013 --- /dev/null +++ b/tuxedo/infinitybook/pro14/gen9/amd/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ../. + ../../../../../common/cpu/amd + ]; +} diff --git a/tuxedo/infinitybook/pro14/gen9/default.nix b/tuxedo/infinitybook/pro14/gen9/default.nix new file mode 100644 index 00000000..5dc50911 --- /dev/null +++ b/tuxedo/infinitybook/pro14/gen9/default.nix @@ -0,0 +1,11 @@ +{ lib, config, ... }: +{ + imports = [ + ../../. + ]; + + # Add Motorcomm YT6801 Driver if available + boot.extraModulePackages = + with config.boot; + lib.lists.optional (kernelPackages ? yt6801) kernelPackages.yt6801; +} diff --git a/tuxedo/infinitybook/pro14/gen9/intel/README.md b/tuxedo/infinitybook/pro14/gen9/intel/README.md new file mode 100644 index 00000000..d91a3e68 --- /dev/null +++ b/tuxedo/infinitybook/pro14/gen9/intel/README.md @@ -0,0 +1 @@ +# [TUXEDO InfinityBook Pro 14 - Gen9 - INTEL](https://www.tuxedocomputers.com/en/TUXEDO-InfinityBook-Pro-14-Gen9-INTEL) diff --git a/tuxedo/infinitybook/pro14/gen9/intel/default.nix b/tuxedo/infinitybook/pro14/gen9/intel/default.nix new file mode 100644 index 00000000..80d5c29c --- /dev/null +++ b/tuxedo/infinitybook/pro14/gen9/intel/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ../. + ../../../../../common/cpu/intel + ]; +} diff --git a/tuxedo/pulse/14/gen3/default.nix b/tuxedo/pulse/14/gen3/default.nix index 34cca9ab..5458ce9d 100644 --- a/tuxedo/pulse/14/gen3/default.nix +++ b/tuxedo/pulse/14/gen3/default.nix @@ -3,13 +3,14 @@ pkgs, config, ... -}: { +}: +{ imports = [ ../../../../common/cpu/amd ../../../../common/cpu/amd/pstate.nix ../../../../common/cpu/amd/raphael/igpu.nix ../../../../common/pc/laptop - ../../../../common/pc/laptop/ssd + ../../../../common/pc/ssd ]; # Fixing a power-issue with older kernels. @@ -17,8 +18,9 @@ # Kernel 6.6.35 apparently does not have this issue, # the exact version is still unknown which fixed this. boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.6.35") ( - if (config.boot.zfs.enabled) - then pkgs.zfs.latestCompatibleLinuxPackages - else pkgs.linuxPackages_latest + if (config.boot.zfs.enabled) then + pkgs.zfs.latestCompatibleLinuxPackages + else + pkgs.linuxPackages_latest ); } diff --git a/tuxedo/pulse/15/gen2/default.nix b/tuxedo/pulse/15/gen2/default.nix index 39ed0064..0afd6b3b 100644 --- a/tuxedo/pulse/15/gen2/default.nix +++ b/tuxedo/pulse/15/gen2/default.nix @@ -1,16 +1,22 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ imports = [ ../../../../common/cpu/amd ../../../../common/gpu/amd - ../../../../common/pc/laptop/ssd + ../../../../common/pc/ssd ]; services.udev.extraRules = builtins.concatStringsSep "\n" ( - ["# Properly suspend the system."] - ++ ( - map - (device: ''SUBSYSTEM=="pci", ACTION=="add", ATTR{vendor}=="0x144d", ATTR{device}=="${device}", RUN+="${pkgs.runtimeShell} -c 'echo 0 > /sys/bus/pci/devices/$kernel/d3cold_allowed'"'') - ["0xa80a" "0xa808"] + [ "# Properly suspend the system." ] + ++ (map + ( + device: + ''SUBSYSTEM=="pci", ACTION=="add", ATTR{vendor}=="0x144d", ATTR{device}=="${device}", RUN+="${pkgs.runtimeShell} -c 'echo 0 > /sys/bus/pci/devices/$kernel/d3cold_allowed'"'' + ) + [ + "0xa80a" + "0xa808" + ] ) ); } diff --git a/xiaomi/fix-boot-quirk.nix b/xiaomi/fix-boot-quirk.nix deleted file mode 100644 index 7f8446e3..00000000 --- a/xiaomi/fix-boot-quirk.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ lib, ... }: -{ - # Required fix to allow booting NixOS on certain Xiaomi laptops - # https://discourse.nixos.org/t/system-wont-boot-path-efi-stub/29212/12 - boot.kernelPatches = lib.singleton { - name = "Fix boot"; - patch = null; - extraStructuredConfig = with lib.kernel; { - ACPI_DEBUG = yes; - }; - }; -} diff --git a/xiaomi/redmibook/15-pro-2021/README.md b/xiaomi/redmibook/15-pro-2021/README.md new file mode 100644 index 00000000..d47c7546 --- /dev/null +++ b/xiaomi/redmibook/15-pro-2021/README.md @@ -0,0 +1,37 @@ +# Xiaomi Redmibook 15 Pro (2021) + +## Tested Hardware + +```shellsession +$ lspci -nn +00:00.0 Host bridge [0600]: Intel Corporation Tiger Lake-UP3/H35 4 cores Host Bridge/DRAM Registers [8086:9a14] (rev 01) +00:02.0 VGA compatible controller [0300]: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics] [8086:9a49] (rev 01) +00:04.0 Signal processing controller [1180]: Intel Corporation TigerLake-LP Dynamic Tuning Processor Participant [8086:9a03] (rev 01) +00:08.0 System peripheral [0880]: Intel Corporation GNA Scoring Accelerator module [8086:9a11] (rev 01) +00:0a.0 Signal processing controller [1180]: Intel Corporation Tigerlake Telemetry Aggregator Driver [8086:9a0d] (rev 01) +00:0d.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP Thunderbolt 4 USB Controller [8086:9a13] (rev 01) +00:14.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP USB 3.2 Gen 2x1 xHCI Host Controller [8086:a0ed] (rev 20) +00:14.2 RAM memory [0500]: Intel Corporation Tiger Lake-LP Shared SRAM [8086:a0ef] (rev 20) +00:14.3 Network controller [0280]: Intel Corporation Wi-Fi 6 AX201 [8086:a0f0] (rev 20) +00:15.0 Serial bus controller [0c80]: Intel Corporation Tiger Lake-LP Serial IO I2C Controller #0 [8086:a0e8] (rev 20) +00:15.1 Serial bus controller [0c80]: Intel Corporation Tiger Lake-LP Serial IO I2C Controller #1 [8086:a0e9] (rev 20) +00:15.2 Serial bus controller [0c80]: Intel Corporation Tiger Lake-LP Serial IO I2C Controller #2 [8086:a0ea] (rev 20) +00:15.3 Serial bus controller [0c80]: Intel Corporation Tiger Lake-LP Serial IO I2C Controller #3 [8086:a0eb] (rev 20) +00:16.0 Communication controller [0780]: Intel Corporation Tiger Lake-LP Management Engine Interface [8086:a0e0] (rev 20) +00:19.0 Serial bus controller [0c80]: Intel Corporation Tiger Lake-LP Serial IO I2C Controller #4 [8086:a0c5] (rev 20) +00:19.1 Serial bus controller [0c80]: Intel Corporation Tiger Lake-LP Serial IO I2C Controller #5 [8086:a0c6] (rev 20) +00:1d.0 PCI bridge [0604]: Intel Corporation Tiger Lake-LP PCI Express Root Port #9 [8086:a0b0] (rev 20) +00:1d.3 PCI bridge [0604]: Intel Corporation Tiger Lake-LP PCI Express Root Port #12 [8086:a0b3] (rev 20) +00:1f.0 ISA bridge [0601]: Intel Corporation Tiger Lake-LP LPC Controller [8086:a082] (rev 20) +00:1f.3 Multimedia audio controller [0401]: Intel Corporation Tiger Lake-LP Smart Sound Technology Audio Controller [8086:a0c8] (rev 20) +00:1f.4 SMBus [0c05]: Intel Corporation Tiger Lake-LP SMBus Controller [8086:a0a3] (rev 20) +00:1f.5 Serial bus controller [0c80]: Intel Corporation Tiger Lake-LP SPI Controller [8086:a0a4] (rev 20) +01:00.0 Non-Volatile memory controller [0108]: Shenzhen Longsys Electronics Co., Ltd. FORESEE XP1000 / Lexar Professional CFexpress Type B Gold series, NM620 PCIe NVME SSD (DRAM-less) [1d97:5216] (rev 01) +02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 15) +``` + +## Extra Configuration + +### Bluetooth + +To enable bluetooth support, set `hardware.bluetooth.enable = true;`. diff --git a/xiaomi/redmibook/15-pro-2021/default.nix b/xiaomi/redmibook/15-pro-2021/default.nix new file mode 100644 index 00000000..1c824b15 --- /dev/null +++ b/xiaomi/redmibook/15-pro-2021/default.nix @@ -0,0 +1,12 @@ +{ lib, ... }: +{ + imports = [ + ../../../common/cpu/intel + ../../../common/pc/laptop + ../../../common/pc/ssd + ]; + + hardware.enableRedistributableFirmware = lib.mkDefault true; + + services.thermald.enable = lib.mkDefault true; +} diff --git a/xiaomi/redmibook/16-pro-2024/README.md b/xiaomi/redmibook/16-pro-2024/README.md index 7fa95c05..d63bcfb6 100644 --- a/xiaomi/redmibook/16-pro-2024/README.md +++ b/xiaomi/redmibook/16-pro-2024/README.md @@ -1,8 +1,5 @@ # Xiaomi Redmibook 16 Pro (2024) -Note that the boot fix requires building the kernel. As such, you might run out -of space during nixos-rebuild if you mount tmpfs on `/tmp`. - ## Tested Hardware ```shellsession diff --git a/xiaomi/redmibook/16-pro-2024/default.nix b/xiaomi/redmibook/16-pro-2024/default.nix index ab76680a..1c824b15 100644 --- a/xiaomi/redmibook/16-pro-2024/default.nix +++ b/xiaomi/redmibook/16-pro-2024/default.nix @@ -1,10 +1,9 @@ { lib, ... }: { imports = [ - ../../fix-boot-quirk.nix ../../../common/cpu/intel ../../../common/pc/laptop - ../../../common/pc/laptop/ssd + ../../../common/pc/ssd ]; hardware.enableRedistributableFirmware = lib.mkDefault true;