Merge branch 'master' into patch-1

This commit is contained in:
Tom Vincent 2023-11-14 10:11:06 +00:00 committed by GitHub
commit a437c98a90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 190 additions and 136 deletions

View File

@ -131,9 +131,9 @@ See code for all available configurations.
| [Dell XPS 17 9700, nvidia](dell/xps/17-9700/nvidia) | `<nixos-hardware/dell/xps/17-9700/nvidia>` |
| [Dell XPS 17 9710, intel only](dell/xps/17-9710/intel) | `<nixos-hardware/dell/xps/17-9710/intel>` |
| [Dell XPS E7240](dell/e7240) | `<nixos-hardware/dell/e7240>` |
| [Framework 11th Gen Intel Core](framework) | `<nixos-hardware/framework>` |
| [Framework 12th Gen Intel Core](framework/12th-gen-intel) | `<nixos-hardware/framework/12th-gen-intel>` |
| [Framework 13th Gen Intel Core](framework/13th-gen-intel) | `<nixos-hardware/framework/13th-gen-intel>` |
| [Framework 11th Gen Intel Core](framework/13-inch/11th-gen-intel) | `<nixos-hardware/framework/13-inch/11th-gen-intel>`|
| [Framework 12th Gen Intel Core](framework/13-inch/12th-gen-intel) | `<nixos-hardware/framework/13-inch/12th-gen-intel>`|
| [Framework 13th Gen Intel Core](framework/13-inch/13th-gen-intel) | `<nixos-hardware/framework/13-inch/13th-gen-intel>`|
| [Framework 13 AMD Ryzen 7040 Series](framework/13-inch/7040-amd) | `<nixos-hardware/framework/13-inch/7040-amd>` |
| [FriendlyARM NanoPC-T4](friendlyarm/nanopc-t4) | `<nixos-hardware/friendlyarm/nanopc-t4>` |
| [FriendlyARM NanoPi R5s](friendlyarm/nanopi-r5s) | `<nixos-hardware/friendlyarm/nanopi-r5s>` |

View File

@ -66,8 +66,9 @@
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-12th-gen-intel = import ./framework/12th-gen-intel;
framework-13th-gen-intel = import ./framework/13th-gen-intel;
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-13-7040-amd = import ./framework/13-inch/7040-amd;
friendlyarm-nanopc-t4 = import ./friendlyarm/nanopc-t4;
friendlyarm-nanopi-r5s = import ./friendlyarm/nanopi-r5s;

View File

@ -0,0 +1,17 @@
# [Framework Laptop 13](https://frame.work/)
## 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.Laptop.TGL.BIOS.firmware)

View File

@ -0,0 +1,10 @@
{ lib, pkgs, ...}: {
imports = [
../common
../common/intel.nix
];
# 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);
}

View File

@ -11,7 +11,7 @@ services.fwupd.enable = true;
Then run
```sh
$ sudo fwupdmgr update
$ fwupdmgr update
```
- [Latest Update](https://fwupd.org/lvfs/devices/work.frame.Laptop.ADL.BIOS.firmware)

View File

@ -1,17 +1,13 @@
{ lib, pkgs, ... }: {
imports = [
../../common/cpu/intel
../../common/pc/laptop
../../common/pc/laptop/ssd
../common
../common/intel.nix
];
boot.kernelParams = [
# For Power consumption
# https://kvark.github.io/linux/framework/2021/10/17/framework-nixos.html
"mem_sleep_default=deep"
# For Power consumption
# https://community.frame.work/t/linux-battery-life-tuning/6665/156
"nvme.noacpi=1"
# Workaround iGPU hangs
# https://discourse.nixos.org/t/intel-12th-gen-igpu-freezes/21768/4
"i915.enable_psr=1"
@ -48,34 +44,4 @@
# https://www.tomshardware.com/news/intel-thread-director-coming-to-linux-5-18
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.18") (lib.mkDefault pkgs.linuxPackages_latest);
# Fix TRRS headphones missing a mic
# https://community.frame.work/t/headset-microphone-on-linux/12387/3
boot.extraModprobeConfig = ''
options snd-hda-intel model=dell-headset-multi
'';
# For fingerprint support
services.fprintd.enable = lib.mkDefault true;
# Custom udev rules
services.udev.extraRules = ''
# Fix headphone noise when on powersave
# https://community.frame.work/t/headphone-jack-intermittent-noise/5246/55
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0xa0e0", ATTR{power/control}="on"
# Ethernet expansion card support
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8156", ATTR{power/autosuspend}="20"
'';
# Mis-detected by nixos-generate-config
# https://github.com/NixOS/nixpkgs/issues/171093
# https://wiki.archlinux.org/title/Framework_Laptop#Changing_the_brightness_of_the_monitor_does_not_work
hardware.acpilight.enable = lib.mkDefault true;
# Fix font sizes in X
# services.xserver.dpi = 200;
# This adds a patched ectool, to interact with the Embedded Controller
# Can be used to interact with leds from userspace, etc.
# Not part of a nixos release yet, so package only gets added if it exists.
environment.systemPackages = lib.optional (pkgs ? "fw-ectool") pkgs.fw-ectool;
}

View File

@ -11,5 +11,5 @@ services.fwupd.enable = true;
Then run
```sh
$ sudo fwupdmgr update
$ fwupdmgr update
```

View File

@ -1,4 +1,4 @@
{ lib, pkgs, ... }: {
{
imports = [
# Same config as 12th Gen. The chipsets and mainboard are similar enough
# that no separate configuration is needed.

View File

@ -1,10 +1,7 @@
{ lib, pkgs, ... }: {
imports = [
../../../common/cpu/amd
../../../common/cpu/amd/pstate.nix
../../../common/gpu/amd
../../../common/pc/laptop
../../../common/pc/laptop/ssd
../common
../common/amd.nix
];
# Newer kernel is better for amdgpu driver updates
@ -12,31 +9,10 @@
# https://wireless.wiki.kernel.org/en/users/drivers/mediatek
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.1") (lib.mkDefault pkgs.linuxPackages_latest);
# AMD has better battery life with PPD over TLP:
# https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13
services.power-profiles-daemon.enable = lib.mkDefault true;
# Fix TRRS headphones missing a mic
# https://community.frame.work/t/headset-microphone-on-linux/12387/3
#
# Temporary until a kernel patch is merged to fix this
boot.extraModprobeConfig = ''
options snd-hda-intel model=dell-headset-multi
'';
# For fingerprint support
services.fprintd.enable = lib.mkDefault true;
# Custom udev rules
services.udev.extraRules = ''
# Ethernet expansion card support
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8156", ATTR{power/autosuspend}="20"
# 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"
'';
# Needed for desktop environments to detect/manage display brightness
hardware.sensor.iio.enable = lib.mkDefault true;
}

View File

@ -0,0 +1,11 @@
{ lib, ... }: {
imports = [
../../../common/cpu/amd
../../../common/cpu/amd/pstate.nix
../../../common/gpu/amd
];
# AMD has better battery life with PPD over TLP:
# https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13
services.power-profiles-daemon.enable = lib.mkDefault true;
}

View File

@ -0,0 +1,29 @@
{ lib, ... }: {
imports = [
../../../common/pc/laptop
../../../common/pc/laptop/ssd
];
# Fix TRRS headphones missing a mic
# https://community.frame.work/t/headset-microphone-on-linux/12387/3
#
# This is temporary until a kernel patch is submitted
boot.extraModprobeConfig = ''
options snd-hda-intel model=dell-headset-multi
'';
# For fingerprint support
services.fprintd.enable = lib.mkDefault true;
# Custom udev rules
services.udev.extraRules = ''
# Ethernet expansion card support
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8156", ATTR{power/autosuspend}="20"
'';
# Fix font sizes in X
# services.xserver.dpi = 200;
# Needed for desktop environments to detect/manage display brightness
hardware.sensor.iio.enable = lib.mkDefault true;
}

View File

@ -0,0 +1,35 @@
{ lib, pkgs, ... }: {
imports = [
../../../common/cpu/intel
];
boot.kernelParams = [
# Fixes a regression in s2idle, making it more power efficient than deep sleep
"acpi_osi=\"!Windows 2020\""
# For Power consumption
# https://community.frame.work/t/linux-battery-life-tuning/6665/156
"nvme.noacpi=1"
];
# 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);
# Custom udev rules
services.udev.extraRules = ''
# Fix headphone noise when on powersave
# https://community.frame.work/t/headphone-jack-intermittent-noise/5246/55
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0xa0e0", ATTR{power/control}="on"
'';
# Mis-detected by nixos-generate-config
# https://github.com/NixOS/nixpkgs/issues/171093
# https://wiki.archlinux.org/title/Framework_Laptop#Changing_the_brightness_of_the_monitor_does_not_work
hardware.acpilight.enable = lib.mkDefault true;
# This adds a patched ectool, to interact with the Embedded Controller
# Can be used to interact with leds from userspace, etc.
# Not part of a nixos release yet, so package only gets added if it exists.
environment.systemPackages = lib.optional (pkgs ? "fw-ectool") pkgs.fw-ectool;
}

View File

@ -0,0 +1,36 @@
# Changes to the framework top-level
## Overview
When the framework profile was created, there weren't other models of laptop available by the
company. Now there are multiple generations of the Framework 13, and the Framework 16 shipping by
the end of 2023.
## How to update
By preference, there will already be a specialised module for your model's configuration. If you
have an 11th gen Intel Framework 13 and were importing the `framework` profile, you would need to
update to use the `framework-11th-gen-intel` profile instead.
If not and you have a 13-inch model, the common module under `framework/13-inch/common/default.nix`
can be imported directly, and the options provided can be used in your own system's configuration.
Alternatively, you can create a new specialisation for your model under `framework` configured for
that model.
## Changes
### 13-inch profile
All of the existing modules have been reconfigured to be under the `framework/13-inch` folder.
The 12th and 13th gen Intel Framework 13's had their own specialisation modules separately available
already. To mirror those modules, the 11th gen Intel Framework 13 configuration has been moved to
`framework/13-inch/11th-gen-intel/default.nix`.
### "Common" modules
Tools / services that are shared among several models are now extracted to their own module under
`13-inch/common/` and imported by `13-inch/common/default.nix`. There were several tweaks for
11th gen/12th gen that were duplicated and are now a part of common modules.

View File

@ -1,4 +1,9 @@
# [Framework Laptop 13](https://frame.work/)
# NOTE: Structure changes from 2023-11-11
Please read the [Deprecated Behaviour README](./OLD-BEHAVIOUR-DEPRECATION.md) to understand how some structural changes to
the code might affect you!
# [Framework Laptops](https://frame.work/)
## Updating Firmware
@ -11,7 +16,20 @@ services.fwupd.enable = true;
Then run
```sh
$ sudo fwupdmgr update
$ fwupdmgr update
```
[Latest Update](https://fwupd.org/lvfs/devices/work.frame.Laptop.TGL.BIOS.firmware)
## Common Modules
For the Framework 13 laptops, there are common configuration modules available under the `13-inch/common/` directory,
including some modules specific to AMD- or Intel-based laptops. By preference, there will already be a specialised
module for your model's configuration. Otherwise, it can be added alongside the existing modules.
## Support Tools
### fw-ectool
There is a `fw-ectool` package available in nixpkgs-unstable that provides some system configuration options via the EC.
This ectool only works with the Intel-based Framework laptops at present, as the Framework EC for AMD-based mainboards
is based on the Zephyr port of the ChromeOS EC, which involves a slightly changed communication interface.

View File

@ -1,53 +1,8 @@
{ lib, pkgs, ... }: {
imports = [
../common/cpu/intel
../common/pc/laptop
../common/pc/laptop/ssd
{
assertions = [
{
assertion = false;
message = "Importing framework/ (default.nix) directly is deprecated! See https://github.com/NixOS/nixos-hardware/blob/master/framework/OLD-BEHAVIOUR-DEPRECATED.md for more details.";
}
];
boot.kernelParams = [
# Fixes a regression in s2idle, making it more power efficient than deep sleep
"acpi_osi=\"!Windows 2020\""
# For Power consumption
# https://community.frame.work/t/linux-battery-life-tuning/6665/156
"nvme.noacpi=1"
];
# 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);
# Fix TRRS headphones missing a mic
# https://community.frame.work/t/headset-microphone-on-linux/12387/3
boot.extraModprobeConfig = ''
options snd-hda-intel model=dell-headset-multi
'';
# For fingerprint support
services.fprintd.enable = lib.mkDefault true;
# Custom udev rules
services.udev.extraRules = ''
# Fix headphone noise when on powersave
# https://community.frame.work/t/headphone-jack-intermittent-noise/5246/55
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0xa0e0", ATTR{power/control}="on"
# Ethernet expansion card support
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8156", ATTR{power/autosuspend}="20"
'';
# Mis-detected by nixos-generate-config
# https://github.com/NixOS/nixpkgs/issues/171093
# https://wiki.archlinux.org/title/Framework_Laptop#Changing_the_brightness_of_the_monitor_does_not_work
hardware.acpilight.enable = lib.mkDefault true;
# Needed for desktop environments to detect/manage display brightness
hardware.sensor.iio.enable = lib.mkDefault true;
# Fix font sizes in X
# services.xserver.dpi = 200;
# This adds a patched ectool, to interact with the Embedded Controller
# Can be used to interact with leds from userspace, etc.
# Not part of a nixos release yet, so package only gets added if it exists.
environment.systemPackages = lib.optional (pkgs ? "fw-ectool") pkgs.fw-ectool;
}

View File

@ -10,7 +10,7 @@ in {
./surface-control
];
microsoft-surface.kernelVersion = mkDefault "6.5.5";
microsoft-surface.kernelVersion = mkDefault "6.5.11";
# Seems to be required to properly enable S0ix "Modern Standby":
boot.kernelParams = mkDefault [ "mem_sleep_default=deep" ];

View File

@ -5,8 +5,8 @@ let
in {
imports = [
./linux-6.1.55
./linux-6.5.5
./linux-6.1.x
./linux-6.5.x
];
options.microsoft-surface.kernelVersion = mkOption {

View File

@ -8,7 +8,7 @@ let
cfg = config.microsoft-surface;
version = "6.1.55";
version = "6.1.62";
extraMeta.branch = "6.1";
patchDir = repos.linux-surface + "/patches/${extraMeta.branch}";
kernelPatches = pkgs.callPackage ./patches.nix {
@ -20,17 +20,17 @@ let
inherit version extraMeta kernelPatches;
src = fetchurl {
url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz";
sha256 = "1h0mzx52q9pvdv7rhnvb8g68i7bnlc9rf8gy9qn4alsxq4g28zm8";
sha256 = "sha256-uf1hb6zWvs/O74i5vnGNDxZiXKs/6B0ROEgCpwkehew=";
};
};
in {
options.microsoft-surface.kernelVersion = mkOption {
type = types.enum [ "6.1.55" ];
type = types.enum [ version ];
};
config = mkIf (cfg.kernelVersion == "6.1.55") {
config = mkIf (cfg.kernelVersion == version ) {
boot = {
inherit kernelPackages;
};

View File

@ -8,7 +8,7 @@ let
cfg = config.microsoft-surface;
version = "6.5.5";
version = "6.5.11";
extraMeta.branch = "6.5";
patchDir = repos.linux-surface + "/patches/${extraMeta.branch}";
kernelPatches = pkgs.callPackage ./patches.nix {
@ -20,17 +20,17 @@ let
inherit version extraMeta kernelPatches;
src = fetchurl {
url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz";
sha256 = "15gg8sb6cfgk1afwj7fl7mj4nkj14w43vzwvw0qsg3nzyxwh7wcc";
sha256 = "sha256-LuJK+SgrgJI7LaVrcKrX3y6O5OPwdkUuBbpmviBZtRk=";
};
};
in {
options.microsoft-surface.kernelVersion = mkOption {
type = types.enum [ "6.5.5" ];
type = types.enum [ version ];
};
config = mkIf (cfg.kernelVersion == "6.5.5") {
config = mkIf (cfg.kernelVersion == version) {
boot = {
inherit kernelPackages;
};

View File

@ -17,7 +17,7 @@ in {
../../../common/cpu/intel/kaby-lake
];
microsoft-surface.kernelVersion = "6.1.55";
microsoft-surface.kernelVersion = "6.1.62";
boot.kernelParams = [
"i915.enable_rc6=1"