From b006ec52fce23b1d57f6ab4a42d7400732e9a0a2 Mon Sep 17 00:00:00 2001 From: Ivor Wanders Date: Thu, 23 Nov 2023 18:12:14 -0500 Subject: [PATCH 01/41] Bump linux-surface to a6eafcad32dc789ae92f42636b11e9aae6e7c879. --- microsoft/surface/common/repos.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/microsoft/surface/common/repos.nix b/microsoft/surface/common/repos.nix index 99b660f..b1076d0 100644 --- a/microsoft/surface/common/repos.nix +++ b/microsoft/surface/common/repos.nix @@ -4,8 +4,8 @@ linux-surface = fetchFromGitHub { owner = "linux-surface"; repo = "linux-surface"; - rev = "b82e8acd3c015190423b114770b0e9fcc206dd2d"; - hash = "sha256-parp1F5fFzKkiM6ILK+ZolMdSwU1kLOOMvksSwE/zKA="; + rev = "a6eafcad32dc789ae92f42636b11e9aae6e7c879"; + hash = "sha256-GfxRzxFxDZoSZyEOzxr/Hz0IonbuwzkGaisKl3VYvlI="; }; # This is the owner and repo for the pre-patched kernel from the "linux-surface" project: From 4461209624a1fef22411c70b62b114c92218c172 Mon Sep 17 00:00:00 2001 From: Reed Riley Date: Thu, 16 Nov 2023 07:07:14 -0800 Subject: [PATCH 02/41] FW13 7040: workaround for SuspendThenHibernate bug --- framework/13-inch/common/amd.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/framework/13-inch/common/amd.nix b/framework/13-inch/common/amd.nix index 249f6f3..f5341b6 100644 --- a/framework/13-inch/common/amd.nix +++ b/framework/13-inch/common/amd.nix @@ -1,10 +1,13 @@ -{ lib, ... }: { +{ lib, config, ... }: { imports = [ ../../../common/cpu/amd ../../../common/cpu/amd/pstate.nix ../../../common/gpu/amd ]; + # 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"] ; + # 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; From b236a7817a95b42a4392327ee77f3262755e11e1 Mon Sep 17 00:00:00 2001 From: Ivor Wanders Date: Sun, 26 Nov 2023 15:44:14 -0500 Subject: [PATCH 03/41] Write iptsd configuration file. --- microsoft/surface/common/ipts/default.nix | 27 +++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/microsoft/surface/common/ipts/default.nix b/microsoft/surface/common/ipts/default.nix index 4d19aa0..ea13c9f 100644 --- a/microsoft/surface/common/ipts/default.nix +++ b/microsoft/surface/common/ipts/default.nix @@ -1,18 +1,39 @@ { config, lib, pkgs, ... }: let - inherit (lib) mkDefault mkEnableOption mkIf mkMerge; + inherit (lib) mkDefault mkEnableOption mkIf mkMerge mkOption types; cfg = config.microsoft-surface.ipts; -in { + iptsConfFile = pkgs.writeTextFile { + name = "iptsd.conf"; + text = lib.generators.toINI { } cfg.config; + }; + +in +{ options.microsoft-surface.ipts = { enable = mkEnableOption "Enable IPTSd for Microsoft Surface"; + + config = mkOption { + type = types.attrs; + default = { }; + description = '' + Values to wrote to iptsd.conf, first key is section, second key is property. + See the example config; https://github.com/linux-surface/iptsd/blob/v1.4.0/etc/iptsd.conf + ''; + example = '' + DFT = { + ButtonMinMag = 1000; + }; + ''; + }; }; config = mkMerge [ { microsoft-surface.ipts.enable = mkDefault false; + } (mkIf cfg.enable { @@ -22,6 +43,8 @@ in { script = "iptsd $(iptsd-find-hidraw)"; wantedBy = [ "multi-user.target" ]; }; + + environment.etc."iptsd/iptsd.conf".source = "${iptsConfFile}"; }) ]; } From 6c114d0ccf990b90c22590561e12a898276c617a Mon Sep 17 00:00:00 2001 From: Ivor Wanders Date: Sun, 26 Nov 2023 16:24:31 -0500 Subject: [PATCH 04/41] Change linux-surface rev to tag. --- microsoft/surface/common/repos.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft/surface/common/repos.nix b/microsoft/surface/common/repos.nix index b1076d0..15dc30d 100644 --- a/microsoft/surface/common/repos.nix +++ b/microsoft/surface/common/repos.nix @@ -4,7 +4,7 @@ linux-surface = fetchFromGitHub { owner = "linux-surface"; repo = "linux-surface"; - rev = "a6eafcad32dc789ae92f42636b11e9aae6e7c879"; + rev = "arch-6.6.1-1"; hash = "sha256-GfxRzxFxDZoSZyEOzxr/Hz0IonbuwzkGaisKl3VYvlI="; }; From 8772491ed75f150f02552c60694e1beff9f46013 Mon Sep 17 00:00:00 2001 From: Ivor Wanders Date: Sun, 26 Nov 2023 16:27:13 -0500 Subject: [PATCH 05/41] Minimize whitespace changes. --- microsoft/surface/common/ipts/default.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/microsoft/surface/common/ipts/default.nix b/microsoft/surface/common/ipts/default.nix index ea13c9f..8e1f475 100644 --- a/microsoft/surface/common/ipts/default.nix +++ b/microsoft/surface/common/ipts/default.nix @@ -33,7 +33,6 @@ in config = mkMerge [ { microsoft-surface.ipts.enable = mkDefault false; - } (mkIf cfg.enable { @@ -43,7 +42,6 @@ in script = "iptsd $(iptsd-find-hidraw)"; wantedBy = [ "multi-user.target" ]; }; - environment.etc."iptsd/iptsd.conf".source = "${iptsConfFile}"; }) ]; From eb4e5743609d36c673a979850af2d90d5e3e26fa Mon Sep 17 00:00:00 2001 From: Archit Gupta Date: Sat, 2 Dec 2023 17:38:39 -0800 Subject: [PATCH 06/41] framework intel: Disable cros-usbpd-charger --- framework/13-inch/common/intel.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/framework/13-inch/common/intel.nix b/framework/13-inch/common/intel.nix index d5c68ef..fb5c4ce 100644 --- a/framework/13-inch/common/intel.nix +++ b/framework/13-inch/common/intel.nix @@ -15,6 +15,9 @@ # 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); + # Module is not used for Framework EC but causes boot time error log. + boot.blacklistedKernelModules = [ "cros-usbpd-charger" ]; + # Custom udev rules services.udev.extraRules = '' # Fix headphone noise when on powersave From a89745edd5f657e2e5be5ed1bea86725ca78d92e Mon Sep 17 00:00:00 2001 From: Astrid Yu Date: Sat, 2 Dec 2023 17:50:43 -0800 Subject: [PATCH 07/41] surface: Allow specifying major versions for kernel --- .../surface/common/kernel/linux-6.1.x/default.nix | 11 ++++++----- .../surface/common/kernel/linux-6.5.x/default.nix | 9 +++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/microsoft/surface/common/kernel/linux-6.1.x/default.nix b/microsoft/surface/common/kernel/linux-6.1.x/default.nix index 05ec4cf..dbb61d7 100644 --- a/microsoft/surface/common/kernel/linux-6.1.x/default.nix +++ b/microsoft/surface/common/kernel/linux-6.1.x/default.nix @@ -9,15 +9,16 @@ let cfg = config.microsoft-surface; version = "6.1.62"; - extraMeta.branch = "6.1"; - patchDir = repos.linux-surface + "/patches/${extraMeta.branch}"; + majorVersion = "6.1"; + patchDir = repos.linux-surface + "/patches/${majorVersion}"; kernelPatches = pkgs.callPackage ./patches.nix { inherit (lib) kernel; inherit version patchDir; }; kernelPackages = linuxPackage { - inherit version extraMeta kernelPatches; + inherit version kernelPatches; + extraMeta.branch = majorVersion; src = fetchurl { url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz"; sha256 = "sha256-uf1hb6zWvs/O74i5vnGNDxZiXKs/6B0ROEgCpwkehew="; @@ -27,10 +28,10 @@ let in { options.microsoft-surface.kernelVersion = mkOption { - type = types.enum [ version ]; + type = types.enum [ version majorVersion ]; }; - config = mkIf (cfg.kernelVersion == version ) { + config = mkIf (cfg.kernelVersion == version || cfg.kernelVersion == majorVersion) { boot = { inherit kernelPackages; }; diff --git a/microsoft/surface/common/kernel/linux-6.5.x/default.nix b/microsoft/surface/common/kernel/linux-6.5.x/default.nix index b26b466..ba3c2a0 100644 --- a/microsoft/surface/common/kernel/linux-6.5.x/default.nix +++ b/microsoft/surface/common/kernel/linux-6.5.x/default.nix @@ -9,15 +9,16 @@ let cfg = config.microsoft-surface; version = "6.5.11"; - extraMeta.branch = "6.5"; - patchDir = repos.linux-surface + "/patches/${extraMeta.branch}"; + majorVersion = "6.5"; + patchDir = repos.linux-surface + "/patches/${majorVersion}"; kernelPatches = pkgs.callPackage ./patches.nix { inherit (lib) kernel; inherit version patchDir; }; kernelPackages = linuxPackage { - inherit version extraMeta kernelPatches; + inherit version kernelPatches; + extraMeta.branch = majorVersion; src = fetchurl { url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz"; sha256 = "sha256-LuJK+SgrgJI7LaVrcKrX3y6O5OPwdkUuBbpmviBZtRk="; @@ -30,7 +31,7 @@ in { type = types.enum [ version ]; }; - config = mkIf (cfg.kernelVersion == version) { + config = mkIf (cfg.kernelVersion == version || cfg.kernelVersion == majorVersion) { boot = { inherit kernelPackages; }; From fa194fc484fd7270ab324bb985593f71102e84d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 02:11:42 +0000 Subject: [PATCH 08/41] build(deps): bump cachix/install-nix-action from 23 to 24 Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 23 to 24. - [Release notes](https://github.com/cachix/install-nix-action/releases) - [Commits](https://github.com/cachix/install-nix-action/compare/v23...v24) --- updated-dependencies: - dependency-name: cachix/install-nix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 37e2af7..782cde3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v23 + - uses: cachix/install-nix-action@v24 with: nix_path: nixpkgs=channel:nixos-unstable - name: Show nixpkgs version From c78145fc512a703af114aec176658dee872e4e90 Mon Sep 17 00:00:00 2001 From: waltz <79410846+Wa1t5@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:04:01 -0300 Subject: [PATCH 09/41] lenovo: add config for ideapad s145-15api --- lenovo/ideapad/s145-15api/default.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lenovo/ideapad/s145-15api/default.nix diff --git a/lenovo/ideapad/s145-15api/default.nix b/lenovo/ideapad/s145-15api/default.nix new file mode 100644 index 0000000..08b11c7 --- /dev/null +++ b/lenovo/ideapad/s145-15api/default.nix @@ -0,0 +1,18 @@ +{ lib, ... }: + +{ + imports = [ + ../../../common/cpu/amd + ../../../common/gpu/amd + ../../../common/gpu/amd/southern-islands + ]; + + # Blacklist ideapad-laptop because it keeps resetting rfkill devices + boot.blacklistedKernelModules = [ "ideapad-laptop" ]; + + # For some reason we have to specify manually which model we want snd-hda-intel to use + # without it external microphone won't work + boot.extraModprobeConfig = '' + options snd-hda-intel model=alc255-acer,dell-headset-multi + ''; +} From b32113560acaadb92251efcd6bef67419797839b Mon Sep 17 00:00:00 2001 From: waltz <79410846+Wa1t5@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:10:05 -0300 Subject: [PATCH 10/41] lenovo: reference ideapad s145-15api on flake.nix --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index 051974e..c431bf9 100644 --- a/flake.nix +++ b/flake.nix @@ -86,6 +86,7 @@ lenovo-ideapad-15arh05 = import ./lenovo/ideapad/15arh05; 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-15arh05h = import ./lenovo/legion/15arh05h; lenovo-legion-16ach6h = import ./lenovo/legion/16ach6h; From 030edbb68e69f2b97231479f98a9597024650df2 Mon Sep 17 00:00:00 2001 From: waltz <79410846+Wa1t5@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:13:45 -0300 Subject: [PATCH 11/41] lenovo: add ideapad s145-15api to readme.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 70ba060..5b05c36 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,7 @@ See code for all available configurations. | [Lenovo IdeaPad Gaming 3 15arh05](lenovo/ideapad/15arh05) | `` | | [Lenovo IdeaPad Z510](lenovo/ideapad/z510) | `` | | [Lenovo IdeaPad Slim 5](lenovo/ideapad/slim-5) | `` | +| [Lenovo IdeaPad S145 15api](lenovo/ideapad/s145-15api) | `` | | [Lenovo Legion 5 15arh05h](lenovo/legion/15arh05h) | `` | | [Lenovo Legion 7 Slim 15ach6](lenovo/legion/15ach6) | `` | | [Lenovo Legion 5 Pro 16ach6h](lenovo/legion/16ach6h) | `` | From fef05bf9c8e818f4ca1425ef4c18e6680becd072 Mon Sep 17 00:00:00 2001 From: Stig Palmquist Date: Mon, 11 Dec 2023 03:48:13 +0100 Subject: [PATCH 12/41] surface: linux 6.5.11 -> 6.6.6 - linux-surface: arch-6.6.1-1 -> arch-6.6.4-1 - update config for 6.6 --- microsoft/surface/common/default.nix | 2 +- microsoft/surface/common/kernel/default.nix | 2 +- .../common/kernel/{linux-6.5.x => linux-6.6.x}/default.nix | 6 +++--- .../common/kernel/{linux-6.5.x => linux-6.6.x}/patches.nix | 2 +- microsoft/surface/common/repos.nix | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) rename microsoft/surface/common/kernel/{linux-6.5.x => linux-6.6.x}/default.nix (87%) rename microsoft/surface/common/kernel/{linux-6.5.x => linux-6.6.x}/patches.nix (99%) diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index b6b00ee..3f4d86a 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -10,7 +10,7 @@ in { ./surface-control ]; - microsoft-surface.kernelVersion = mkDefault "6.5.11"; + microsoft-surface.kernelVersion = mkDefault "6.6.6"; # Seems to be required to properly enable S0ix "Modern Standby": boot.kernelParams = mkDefault [ "mem_sleep_default=deep" ]; diff --git a/microsoft/surface/common/kernel/default.nix b/microsoft/surface/common/kernel/default.nix index a0637a3..992ec9b 100644 --- a/microsoft/surface/common/kernel/default.nix +++ b/microsoft/surface/common/kernel/default.nix @@ -6,7 +6,7 @@ let in { imports = [ ./linux-6.1.x - ./linux-6.5.x + ./linux-6.6.x ]; options.microsoft-surface.kernelVersion = mkOption { diff --git a/microsoft/surface/common/kernel/linux-6.5.x/default.nix b/microsoft/surface/common/kernel/linux-6.6.x/default.nix similarity index 87% rename from microsoft/surface/common/kernel/linux-6.5.x/default.nix rename to microsoft/surface/common/kernel/linux-6.6.x/default.nix index ba3c2a0..6573522 100644 --- a/microsoft/surface/common/kernel/linux-6.5.x/default.nix +++ b/microsoft/surface/common/kernel/linux-6.6.x/default.nix @@ -8,8 +8,8 @@ let cfg = config.microsoft-surface; - version = "6.5.11"; - majorVersion = "6.5"; + version = "6.6.6"; + majorVersion = "6.6"; patchDir = repos.linux-surface + "/patches/${majorVersion}"; kernelPatches = pkgs.callPackage ./patches.nix { inherit (lib) kernel; @@ -21,7 +21,7 @@ let extraMeta.branch = majorVersion; src = fetchurl { url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz"; - sha256 = "sha256-LuJK+SgrgJI7LaVrcKrX3y6O5OPwdkUuBbpmviBZtRk="; + sha256 = "sha256-6/cKkXk0sTFp4b5blcO2wv6lvBTm3BRPHvuKABayJMg="; }; }; diff --git a/microsoft/surface/common/kernel/linux-6.5.x/patches.nix b/microsoft/surface/common/kernel/linux-6.6.x/patches.nix similarity index 99% rename from microsoft/surface/common/kernel/linux-6.5.x/patches.nix rename to microsoft/surface/common/kernel/linux-6.6.x/patches.nix index d7b9289..40264ad 100644 --- a/microsoft/surface/common/kernel/linux-6.5.x/patches.nix +++ b/microsoft/surface/common/kernel/linux-6.6.x/patches.nix @@ -55,7 +55,7 @@ VIDEO_DW9719 = module; VIDEO_IPU3_IMGU = module; VIDEO_IPU3_CIO2 = module; - CIO2_BRIDGE = yes; + IPU_BRIDGE = module; INTEL_SKL_INT3472 = module; REGULATOR_TPS68470 = module; COMMON_CLK_TPS68470 = module; diff --git a/microsoft/surface/common/repos.nix b/microsoft/surface/common/repos.nix index 15dc30d..cfaf9e0 100644 --- a/microsoft/surface/common/repos.nix +++ b/microsoft/surface/common/repos.nix @@ -4,8 +4,8 @@ linux-surface = fetchFromGitHub { owner = "linux-surface"; repo = "linux-surface"; - rev = "arch-6.6.1-1"; - hash = "sha256-GfxRzxFxDZoSZyEOzxr/Hz0IonbuwzkGaisKl3VYvlI="; + rev = "arch-6.6.4-1"; + hash = "sha256-uVNXwclBH72XeAgPWQr0I7lkhP+uGVlkT5N2xcBzbW4="; }; # This is the owner and repo for the pre-patched kernel from the "linux-surface" project: From 7763c6fd1f299cb9361ff2abf755ed9619ef01d6 Mon Sep 17 00:00:00 2001 From: Alojzy Leszcz Date: Wed, 13 Dec 2023 08:40:08 +0100 Subject: [PATCH 13/41] Lenovo Legion 16achg6 support (#796) --- README.md | 2 ++ flake.nix | 2 ++ lenovo/legion/16achg6/README.md | 21 +++++++++++++++++++ lenovo/legion/16achg6/hybrid/default.nix | 26 ++++++++++++++++++++++++ lenovo/legion/16achg6/nvidia/default.nix | 13 ++++++++++++ 5 files changed, 64 insertions(+) create mode 100644 lenovo/legion/16achg6/README.md create mode 100644 lenovo/legion/16achg6/hybrid/default.nix create mode 100644 lenovo/legion/16achg6/nvidia/default.nix diff --git a/README.md b/README.md index 5b05c36..ffb1111 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,8 @@ See code for all available configurations. | [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 Y530 15ICH](lenovo/legion/15ich) | `` | | [Lenovo ThinkPad E14 (AMD)](lenovo/thinkpad/e14/amd) | `` | diff --git a/flake.nix b/flake.nix index c431bf9..6cd67a4 100644 --- a/flake.nix +++ b/flake.nix @@ -92,6 +92,8 @@ 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-16ithg6 = import ./lenovo/legion/16ithg6; lenovo-legion-16irx8h = import ./lenovo/legion/16irx8h; lenovo-legion-y530-15ich = import ./lenovo/legion/15ich; diff --git a/lenovo/legion/16achg6/README.md b/lenovo/legion/16achg6/README.md new file mode 100644 index 0000000..8cb43c9 --- /dev/null +++ b/lenovo/legion/16achg6/README.md @@ -0,0 +1,21 @@ +I personally use my laptop with an external display attached. In `hybrid` config it works nice only with Wayland, while X11 can't detect the external monitor. Everything works as expected in `nvidia` mode, but battery life is reduced then. + +## Setup at the time of testing +``` +$ nix-info -m + - system: `"x86_64-linux"` + - host os: `Linux 6.1.62, NixOS, 23.05 (Stoat), 23.05.20231116.9fb1225` + - multi-user?: `yes` + - sandbox: `yes` + - version: `nix-env (Nix) 2.13.6` + - channels(beko): `"home-manager-23.05.tar.gz"` + - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos` + ``` + ``` + $ lspci +... +01:00.0 VGA compatible controller: NVIDIA Corporation GA104M [GeForce RTX 3070 Mobile / Max-Q] (rev a1) +... +05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] (rev c5) +... +``` \ No newline at end of file diff --git a/lenovo/legion/16achg6/hybrid/default.nix b/lenovo/legion/16achg6/hybrid/default.nix new file mode 100644 index 0000000..da27a83 --- /dev/null +++ b/lenovo/legion/16achg6/hybrid/default.nix @@ -0,0 +1,26 @@ +{ lib, config, ... }: + +{ + imports = [ + ../../../../common/cpu/amd + ../../../../common/cpu/amd/pstate.nix + ../../../../common/gpu/amd + ../../../../common/gpu/nvidia/prime.nix + ../../../../common/pc/laptop + ../../../../common/pc/laptop/ssd + ]; + + services.xserver.videoDrivers = [ "nvidia" "amdgpu" ]; + + hardware = { + nvidia = { + modesetting.enable = lib.mkDefault true; + powerManagement.enable = lib.mkDefault true; + + prime = { + amdgpuBusId = "PCI:5:0:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + }; + }; +} \ No newline at end of file diff --git a/lenovo/legion/16achg6/nvidia/default.nix b/lenovo/legion/16achg6/nvidia/default.nix new file mode 100644 index 0000000..af0f2d6 --- /dev/null +++ b/lenovo/legion/16achg6/nvidia/default.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + imports = [ ../hybrid ]; + services.xserver.videoDrivers = [ "nvidia" ]; + hardware = { + nvidia.prime.offload.enable = false; + amdgpu = { + amdvlk = false; + opencl = false; + }; + }; +} \ No newline at end of file From e4ded1ec8e9c152910c2b077443e1d87cd81ad4a Mon Sep 17 00:00:00 2001 From: Cryolitia Date: Mon, 25 Dec 2023 09:04:38 +0800 Subject: [PATCH 14/41] gpd-win-max-2-2023: init --- README.md | 1 + flake.nix | 1 + gpd/win-max-2/2023/default.nix | 18 +++++++++ gpd/win-max-2/default.nix | 67 ++++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 gpd/win-max-2/2023/default.nix create mode 100644 gpd/win-max-2/default.nix diff --git a/README.md b/README.md index ffb1111..37a7577 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,7 @@ See code for all available configurations. | [GPD P2 Max](gpd/p2-max) | `` | | [GPD Pocket 3](gpd/pocket-3) | `` | | [GPD WIN 2](gpd/win-2) | `` | +| [GPD WIN Max 2 2023](gpd/win-max-2/2023) | `` | | [Google Pixelbook](google/pixelbook) | `` | | [HP Elitebook 2560p](hp/elitebook/2560p) | `` | | [HP Elitebook 845g7](hp/elitebook/845/g7) | `` | diff --git a/flake.nix b/flake.nix index 6cd67a4..3b63232 100644 --- a/flake.nix +++ b/flake.nix @@ -78,6 +78,7 @@ gpd-p2-max = import ./gpd/p2-max; gpd-pocket-3 = import ./gpd/pocket-3; gpd-win-2 = import ./gpd/win-2; + gpd-win-max-2-2023 = import ./gpd/win-max-2/2023; hp-elitebook-2560p = import ./hp/elitebook/2560p; hp-elitebook-845g7 = import ./hp/elitebook/845/g7; hp-elitebook-845g9 = import ./hp/elitebook/845/g9; diff --git a/gpd/win-max-2/2023/default.nix b/gpd/win-max-2/2023/default.nix new file mode 100644 index 0000000..6894004 --- /dev/null +++ b/gpd/win-max-2/2023/default.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ...}: +with lib; +let + cfg = config.hardware.gpd.ppt; +in +{ + imports = [ + ./.. + ../../../common/cpu/amd + ../../../common/cpu/amd/pstate.nix + ../../../common/gpu/amd + ]; + + # fix suspend problem: https://www.reddit.com/r/gpdwin/comments/16veksm/win_max_2_2023_linux_experience_suspend_problems/ + services.udev.extraRules = '' + ACTION=="add" SUBSYSTEM=="pci" ATTR{vendor}=="0x1022" ATTR{device}=="0x14ee" ATTR{power/wakeup}="disabled" + ''; +} diff --git a/gpd/win-max-2/default.nix b/gpd/win-max-2/default.nix new file mode 100644 index 0000000..ae821a3 --- /dev/null +++ b/gpd/win-max-2/default.nix @@ -0,0 +1,67 @@ +{ config, lib, pkgs, ... }: +with lib; +let + cfg = config.hardware.gpd.ppt; +in +{ + imports = [ + ../../common/pc/laptop + ../../common/pc/ssd + ../../common/hidpi.nix + ]; + + # Linux default PPT is 24-22-22, BIOS default PPT is 35-32-28. It can be controlled by ryzenadj. + + # NOTICE: Whenever you can limit PPT to 15W by pressing Fn + Shift to enter quiet mode. + + options.hardware.gpd.ppt = { + enable = mkEnableOption (mdDoc "Enable PPT control for device by ryzenadj.") // { + # Default increase PPT to the BIOS default when power adapter plugin to increase performance. + default = true; + }; + + adapter = { + fast-limit = mkOption { + description = "Fast PTT Limit(milliwatt) when power adapter plugin."; + default = 35000; + type = types.ints.unsigned; + }; + slow-limit = mkOption { + description = "Slow PTT Limit(milliwatt) when power adapter plugin."; + default = 32000; + type = types.ints.unsigned; + }; + stapm-limit = mkOption { + description = "Stapm PTT Limit(milliwatt) when power adapter plugin."; + default = 28000; + type = types.ints.unsigned; + }; + }; + + battery = { + fast-limit = mkOption { + description = "Fast PTT Limit(milliwatt) when using battery."; + default = 24000; + type = types.ints.unsigned; + }; + slow-limit = mkOption { + description = "Slow PTT Limit(milliwatt) when using battery."; + default = 22000; + type = types.ints.unsigned; + }; + stapm-limit = mkOption { + description = "Stapm PTT Limit(milliwatt) when using battery."; + default = 22000; + type = types.ints.unsigned; + }; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [ pkgs.ryzenadj ]; + services.udev.extraRules = '' + SUBSYSTEM=="power_supply", KERNEL=="ADP1", ATTR{online}=="1", RUN+="${pkgs.ryzenadj}/bin/ryzenadj --stapm-limit ${toString cfg.adapter.stapm-limit} --fast-limit ${toString cfg.adapter.fast-limit} --slow-limit ${toString cfg.adapter.slow-limit}" + SUBSYSTEM=="power_supply", KERNEL=="ADP1", ATTR{online}=="0", RUN+="${pkgs.ryzenadj}/bin/ryzenadj --stapm-limit ${toString cfg.battery.stapm-limit} --fast-limit ${toString cfg.battery.fast-limit} --slow-limit ${toString cfg.battery.slow-limit}" + ''; + }; +} From 51c532cc50e7960629c6e09ff7277441a01c236b Mon Sep 17 00:00:00 2001 From: Alojzy Leszcz Date: Mon, 25 Dec 2023 20:59:25 +0100 Subject: [PATCH 15/41] Lenovo Legion 16achg6: Fix gpu configuration to work with both x11/wayland (#802) Co-authored-by: Alojzy Leszcz --- lenovo/legion/16achg6/README.md | 4 +++- lenovo/legion/16achg6/hybrid/default.nix | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lenovo/legion/16achg6/README.md b/lenovo/legion/16achg6/README.md index 8cb43c9..16f86be 100644 --- a/lenovo/legion/16achg6/README.md +++ b/lenovo/legion/16achg6/README.md @@ -1,4 +1,6 @@ -I personally use my laptop with an external display attached. In `hybrid` config it works nice only with Wayland, while X11 can't detect the external monitor. Everything works as expected in `nvidia` mode, but battery life is reduced then. +I personally use my laptop with an external display attached and haven't observed any issues so far. + +From my experience, it's better to use gdm, as sddm seems to have a problem detecting the external monitor (more details available [here](https://github.com/sddm/sddm/issues/1558)). Of course it's not a blocker, as it is still possible to log in using sddm. I personally find it annoying that my main display remains idle. ## Setup at the time of testing ``` diff --git a/lenovo/legion/16achg6/hybrid/default.nix b/lenovo/legion/16achg6/hybrid/default.nix index da27a83..fce43f6 100644 --- a/lenovo/legion/16achg6/hybrid/default.nix +++ b/lenovo/legion/16achg6/hybrid/default.nix @@ -10,12 +10,14 @@ ../../../../common/pc/laptop/ssd ]; - services.xserver.videoDrivers = [ "nvidia" "amdgpu" ]; + services.xserver.videoDrivers = [ "nvidia" ]; + boot.initrd.kernelModules = [ "amdgpu" ]; hardware = { nvidia = { modesetting.enable = lib.mkDefault true; powerManagement.enable = lib.mkDefault true; + open = lib.mkDefault false; prime = { amdgpuBusId = "PCI:5:0:0"; From 249a94e715a3d6cc0217b37b0172dea1edd4afd2 Mon Sep 17 00:00:00 2001 From: Stig Palmquist Date: Tue, 19 Dec 2023 04:08:41 +0100 Subject: [PATCH 16/41] surface: linux 6.6.6 -> 6.6.8 - linux-surface: arch-6.6.4-1 -> arch-6.6.6-1 --- microsoft/surface/common/default.nix | 2 +- microsoft/surface/common/kernel/linux-6.6.x/default.nix | 4 ++-- microsoft/surface/common/repos.nix | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index 3f4d86a..485c0e2 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -10,7 +10,7 @@ in { ./surface-control ]; - microsoft-surface.kernelVersion = mkDefault "6.6.6"; + microsoft-surface.kernelVersion = mkDefault "6.6.8"; # Seems to be required to properly enable S0ix "Modern Standby": boot.kernelParams = mkDefault [ "mem_sleep_default=deep" ]; diff --git a/microsoft/surface/common/kernel/linux-6.6.x/default.nix b/microsoft/surface/common/kernel/linux-6.6.x/default.nix index 6573522..645c4cf 100644 --- a/microsoft/surface/common/kernel/linux-6.6.x/default.nix +++ b/microsoft/surface/common/kernel/linux-6.6.x/default.nix @@ -8,7 +8,7 @@ let cfg = config.microsoft-surface; - version = "6.6.6"; + version = "6.6.8"; majorVersion = "6.6"; patchDir = repos.linux-surface + "/patches/${majorVersion}"; kernelPatches = pkgs.callPackage ./patches.nix { @@ -21,7 +21,7 @@ let extraMeta.branch = majorVersion; src = fetchurl { url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz"; - sha256 = "sha256-6/cKkXk0sTFp4b5blcO2wv6lvBTm3BRPHvuKABayJMg="; + sha256 = "sha256-UDbENOEeSzbY2j9ImFH3+CnPeF+n94h0aFN6nqRXJBY="; }; }; diff --git a/microsoft/surface/common/repos.nix b/microsoft/surface/common/repos.nix index cfaf9e0..69e3122 100644 --- a/microsoft/surface/common/repos.nix +++ b/microsoft/surface/common/repos.nix @@ -4,8 +4,8 @@ linux-surface = fetchFromGitHub { owner = "linux-surface"; repo = "linux-surface"; - rev = "arch-6.6.4-1"; - hash = "sha256-uVNXwclBH72XeAgPWQr0I7lkhP+uGVlkT5N2xcBzbW4="; + rev = "arch-6.6.6-1"; + hash = "sha256-0pP/A0XllR/iheIBEBwEApaXpyFYzsnGZ+wdm4w5Jjg="; }; # This is the owner and repo for the pre-patched kernel from the "linux-surface" project: From b7747f0f60bbdc50f840a49ab77d480d1d018cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 25 Dec 2023 21:14:17 +0100 Subject: [PATCH 17/41] remove unused variables with deadnix --- apple/macbook-air/6/default.nix | 2 +- common/gpu/nvidia/prime.nix | 2 +- dell/precision/3541/intel/default.nix | 2 -- dell/xps/13-9333/default.nix | 2 +- friendlyarm/nanopi-r5s/default.nix | 1 - gpd/win-2/default.nix | 2 +- gpd/win-max-2/2023/default.nix | 5 +---- hardkernel/odroid-h3/default.nix | 2 -- hp/elitebook/845/g7/default.nix | 2 +- hp/elitebook/845/g9/default.nix | 2 +- lenovo/ideapad/s145-15api/default.nix | 2 -- lenovo/ideapad/slim-5/default.nix | 2 -- lenovo/legion/15ach6/default.nix | 4 +--- lenovo/legion/16achg6/hybrid/default.nix | 2 +- lenovo/legion/16irx8h/default.nix | 1 - lenovo/thinkpad/t440p/default.nix | 2 -- microchip/icicle-kit/default.nix | 2 -- morefine/m600/default.nix | 2 +- olimex/teres_i/default.nix | 2 +- onenetbook/4/default.nix | 2 +- pine64/rockpro64/default.nix | 2 +- pine64/star64/firmware.nix | 2 +- pine64/star64/sd-image.nix | 2 +- purism/librem/5r4/initrd.nix | 2 +- purism/librem/5r4/u-boot/default.nix | 2 +- purism/librem/5r4/wifi.nix | 2 +- starfive/visionfive/v2/firmware.nix | 2 +- starfive/visionfive/v2/sd-image.nix | 2 +- 28 files changed, 20 insertions(+), 39 deletions(-) diff --git a/apple/macbook-air/6/default.nix b/apple/macbook-air/6/default.nix index c892026..182511f 100644 --- a/apple/macbook-air/6/default.nix +++ b/apple/macbook-air/6/default.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ lib, ... }: { imports = [ ../. ]; diff --git a/common/gpu/nvidia/prime.nix b/common/gpu/nvidia/prime.nix index 371e9eb..e54f942 100644 --- a/common/gpu/nvidia/prime.nix +++ b/common/gpu/nvidia/prime.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, config, ... }: +{ lib, config, ... }: { imports = [ ./. ]; diff --git a/dell/precision/3541/intel/default.nix b/dell/precision/3541/intel/default.nix index 78a839d..a650e57 100644 --- a/dell/precision/3541/intel/default.nix +++ b/dell/precision/3541/intel/default.nix @@ -1,5 +1,3 @@ -{ lib, pkgs, ... }: - { imports = [ ../../../../common/cpu/intel diff --git a/dell/xps/13-9333/default.nix b/dell/xps/13-9333/default.nix index 3aa0bf6..a17c094 100644 --- a/dell/xps/13-9333/default.nix +++ b/dell/xps/13-9333/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: { +{ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop diff --git a/friendlyarm/nanopi-r5s/default.nix b/friendlyarm/nanopi-r5s/default.nix index 019b5b8..b7ecb91 100644 --- a/friendlyarm/nanopi-r5s/default.nix +++ b/friendlyarm/nanopi-r5s/default.nix @@ -1,5 +1,4 @@ { lib -, pkgs , ... }: diff --git a/gpd/win-2/default.nix b/gpd/win-2/default.nix index 522b62f..aaaba37 100644 --- a/gpd/win-2/default.nix +++ b/gpd/win-2/default.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ...}: +{ config, lib, ...}: { imports = [ ../../common/cpu/intel diff --git a/gpd/win-max-2/2023/default.nix b/gpd/win-max-2/2023/default.nix index 6894004..1f1745f 100644 --- a/gpd/win-max-2/2023/default.nix +++ b/gpd/win-max-2/2023/default.nix @@ -1,8 +1,5 @@ -{ config, lib, pkgs, ...}: +{ config, lib, ...}: with lib; -let - cfg = config.hardware.gpd.ppt; -in { imports = [ ./.. diff --git a/hardkernel/odroid-h3/default.nix b/hardkernel/odroid-h3/default.nix index 435ef89..e52d3a0 100644 --- a/hardkernel/odroid-h3/default.nix +++ b/hardkernel/odroid-h3/default.nix @@ -1,5 +1,3 @@ -{ config, lib, ... }: - { imports = [ ../../common/cpu/intel/jasper-lake diff --git a/hp/elitebook/845/g7/default.nix b/hp/elitebook/845/g7/default.nix index 6c0cb49..60afe6a 100644 --- a/hp/elitebook/845/g7/default.nix +++ b/hp/elitebook/845/g7/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ pkgs, lib, ... }: { imports = diff --git a/hp/elitebook/845/g9/default.nix b/hp/elitebook/845/g9/default.nix index 6c0cb49..60afe6a 100644 --- a/hp/elitebook/845/g9/default.nix +++ b/hp/elitebook/845/g9/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ pkgs, lib, ... }: { imports = diff --git a/lenovo/ideapad/s145-15api/default.nix b/lenovo/ideapad/s145-15api/default.nix index 08b11c7..802e0be 100644 --- a/lenovo/ideapad/s145-15api/default.nix +++ b/lenovo/ideapad/s145-15api/default.nix @@ -1,5 +1,3 @@ -{ lib, ... }: - { imports = [ ../../../common/cpu/amd diff --git a/lenovo/ideapad/slim-5/default.nix b/lenovo/ideapad/slim-5/default.nix index a830c0b..c71052d 100644 --- a/lenovo/ideapad/slim-5/default.nix +++ b/lenovo/ideapad/slim-5/default.nix @@ -1,5 +1,3 @@ -{ lib, ... }: - { imports = [ ../../../common/cpu/amd diff --git a/lenovo/legion/15ach6/default.nix b/lenovo/legion/15ach6/default.nix index 4844f79..a3c00fd 100644 --- a/lenovo/legion/15ach6/default.nix +++ b/lenovo/legion/15ach6/default.nix @@ -1,7 +1,5 @@ { lib, config, ... }: -let - inherit (config.boot) kernelPackages; -in { +{ imports = [ ../../../common/cpu/amd ../../../common/gpu/amd diff --git a/lenovo/legion/16achg6/hybrid/default.nix b/lenovo/legion/16achg6/hybrid/default.nix index fce43f6..fa69491 100644 --- a/lenovo/legion/16achg6/hybrid/default.nix +++ b/lenovo/legion/16achg6/hybrid/default.nix @@ -1,4 +1,4 @@ -{ lib, config, ... }: +{ lib, ... }: { imports = [ diff --git a/lenovo/legion/16irx8h/default.nix b/lenovo/legion/16irx8h/default.nix index 7249c1d..cfbcb8a 100644 --- a/lenovo/legion/16irx8h/default.nix +++ b/lenovo/legion/16irx8h/default.nix @@ -1,7 +1,6 @@ { lib, config, - pkgs, ... }: { imports = [ diff --git a/lenovo/thinkpad/t440p/default.nix b/lenovo/thinkpad/t440p/default.nix index 144b7d0..241fc09 100644 --- a/lenovo/thinkpad/t440p/default.nix +++ b/lenovo/thinkpad/t440p/default.nix @@ -1,5 +1,3 @@ -{ lib, ... }: - { imports = [ ../. diff --git a/microchip/icicle-kit/default.nix b/microchip/icicle-kit/default.nix index 19fb228..db57816 100644 --- a/microchip/icicle-kit/default.nix +++ b/microchip/icicle-kit/default.nix @@ -1,5 +1,3 @@ -{ pkgs, lib, ... }: - { nixpkgs.overlays = [ (import ./overlay.nix) diff --git a/morefine/m600/default.nix b/morefine/m600/default.nix index db4ed24..4879076 100644 --- a/morefine/m600/default.nix +++ b/morefine/m600/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ...}: { +{ lib, ...}: { imports = [ ../../common/cpu/amd ../../common/cpu/amd/pstate.nix diff --git a/olimex/teres_i/default.nix b/olimex/teres_i/default.nix index 34bec53..f72cb1d 100644 --- a/olimex/teres_i/default.nix +++ b/olimex/teres_i/default.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ...}: +{ lib, pkgs, ...}: { hardware.deviceTree = { diff --git a/onenetbook/4/default.nix b/onenetbook/4/default.nix index 9ac16b5..6b108b4 100644 --- a/onenetbook/4/default.nix +++ b/onenetbook/4/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ config, ... }: { imports = [ diff --git a/pine64/rockpro64/default.nix b/pine64/rockpro64/default.nix index a4d3136..9ac08e8 100644 --- a/pine64/rockpro64/default.nix +++ b/pine64/rockpro64/default.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ lib, ... }: { boot.initrd.kernelModules = [ # PCIe/NVMe diff --git a/pine64/star64/firmware.nix b/pine64/star64/firmware.nix index c300de4..e0173a6 100644 --- a/pine64/star64/firmware.nix +++ b/pine64/star64/firmware.nix @@ -1,4 +1,4 @@ -{ callPackage, pkgsBuildHost, runCommand, writeText, writeShellApplication +{ callPackage, pkgsBuildHost, writeText, writeShellApplication , stdenv, dtc, mtdutils, coreutils }: let uboot = callPackage ./uboot.nix { }; diff --git a/pine64/star64/sd-image.nix b/pine64/star64/sd-image.nix index 03d5508..07d00ae 100644 --- a/pine64/star64/sd-image.nix +++ b/pine64/star64/sd-image.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, modulesPath, ... }: +{ config, pkgs, modulesPath, ... }: let firmware = pkgs.callPackage ./firmware.nix { }; in { diff --git a/purism/librem/5r4/initrd.nix b/purism/librem/5r4/initrd.nix index 7ffe609..e82d5cf 100644 --- a/purism/librem/5r4/initrd.nix +++ b/purism/librem/5r4/initrd.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ config, lib, ... }: lib.mkIf config.hardware.librem5.customInitrdModules { boot.initrd = { kernelModules = [ diff --git a/purism/librem/5r4/u-boot/default.nix b/purism/librem/5r4/u-boot/default.nix index 78e6066..26c217c 100644 --- a/purism/librem/5r4/u-boot/default.nix +++ b/purism/librem/5r4/u-boot/default.nix @@ -1,4 +1,4 @@ -{ stdenv, gcc11Stdenv, buildUBoot, fetchurl, fetchFromGitLab, lib, flex, bison }: +{ stdenv, gcc11Stdenv, buildUBoot, fetchurl, fetchFromGitLab, lib, bison }: let firmware-imx = stdenv.mkDerivation (fa: { pname = "firmware-imx"; diff --git a/purism/librem/5r4/wifi.nix b/purism/librem/5r4/wifi.nix index f469a4f..5313aee 100644 --- a/purism/librem/5r4/wifi.nix +++ b/purism/librem/5r4/wifi.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ config, lib, ... }: lib.mkIf (config.hardware.librem5.wifiCard == "redpine") { # Disable mainline rsi module boot.blacklistedKernelModules = [ diff --git a/starfive/visionfive/v2/firmware.nix b/starfive/visionfive/v2/firmware.nix index f2e6861..03c7707 100644 --- a/starfive/visionfive/v2/firmware.nix +++ b/starfive/visionfive/v2/firmware.nix @@ -1,4 +1,4 @@ -{ callPackage, pkgsBuildHost, runCommand, writeText, writeShellApplication +{ callPackage, pkgsBuildHost, writeText, writeShellApplication , stdenv, dtc, mtdutils, coreutils }: let uboot = callPackage ./uboot.nix { }; diff --git a/starfive/visionfive/v2/sd-image.nix b/starfive/visionfive/v2/sd-image.nix index 6ee39e3..79bb6f3 100644 --- a/starfive/visionfive/v2/sd-image.nix +++ b/starfive/visionfive/v2/sd-image.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, modulesPath, ... }: +{ config, pkgs, modulesPath, ... }: let firmware = pkgs.callPackage ./firmware.nix { }; in { From 3e3571c832d41227ac27867784f609099e2a1e16 Mon Sep 17 00:00:00 2001 From: MayNiklas Date: Wed, 20 Dec 2023 16:30:36 +0100 Subject: [PATCH 18/41] add lenovo/thinkpad/x13/yoga/3th-gen --- README.md | 391 ++++++++++--------- flake.nix | 1 + lenovo/thinkpad/x13/yoga/3th-gen/default.nix | 8 + 3 files changed, 205 insertions(+), 195 deletions(-) create mode 100644 lenovo/thinkpad/x13/yoga/3th-gen/default.nix diff --git a/README.md b/README.md index 37a7577..80602f1 100644 --- a/README.md +++ b/README.md @@ -69,198 +69,199 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md). See code for all available configurations. -| Model | Path | -| ------------------------------------------------------------------- | -------------------------------------------------- | -| [Acer Aspire 4810T](acer/aspire/4810t) | `` | -| [Airis N990](airis/n990) | `` | -| [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 Pro 10,1](apple/macbook-pro/10-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 Macs with a T2 Chip](apple/t2) | `` | -| [Asus ROG Ally RC71L (2023)](asus/ally/rc71l) | `` | -| [Asus ROG Strix G513IM](asus/rog-strix/g513im) | `` | -| [Asus ROG Strix G733QS](asus/rog-strix/g733qs) | `` | -| [Asus ROG Zephyrus G14 GA401](asus/zephyrus/ga401) | `` | -| [Asus ROG Zephyrus G14 GA402](asus/zephyrus/ga402) | `` | -| [Asus ROG Zephyrus G15 GA502](asus/zephyrus/ga502) | `` | -| [Asus ROG Zephyrus G15 GA503](asus/zephyrus/ga503) | `` | -| [Asus ROG Zephyrus M16 GU603H](asus/zephyrus/gu603h) | `` | -| [Asus TUF FX504GD](asus/fx504gd) | `` | -| [BeagleBoard PocketBeagle](beagleboard/pocketbeagle) | `` | -| [Deciso DEC series](deciso/dec) | `` | -| [Dell G3 3779](dell/g3/3779) | `` | -| [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 Latitude 3340](dell/latitude/3340) | `` | -| [Dell Latitude 3480](dell/latitude/3480) | `` | -| [Dell Latitude 5520](dell/latitude/5520) | `` | -| [Dell Latitude 7430](dell/latitude/7430) | `` | -| [Dell Latitude 7490](dell/latitude/7490) | `` | -| [Dell Poweredge R7515](dell/poweredge/r7515) | `` | -| [Dell Precision 3541](dell/precision/3541) | `` | -| [Dell Precision 5530](dell/precision/5530) | `` | -| [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 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 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 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 13 AMD Ryzen 7040 Series](framework/13-inch/7040-amd) | `` | -| [FriendlyARM NanoPC-T4](friendlyarm/nanopc-t4) | `` | -| [FriendlyARM NanoPi R5s](friendlyarm/nanopi-r5s) | `` | -| [Focus M2 Gen 1](focus/m2/gen1) | `` | -| [GPD MicroPC](gpd/micropc) | `` | -| [GPD P2 Max](gpd/p2-max) | `` | -| [GPD Pocket 3](gpd/pocket-3) | `` | -| [GPD WIN 2](gpd/win-2) | `` | -| [GPD WIN Max 2 2023](gpd/win-max-2/2023) | `` | -| [Google Pixelbook](google/pixelbook) | `` | -| [HP Elitebook 2560p](hp/elitebook/2560p) | `` | -| [HP Elitebook 845g7](hp/elitebook/845/g7) | `` | -| [HP Elitebook 845g9](hp/elitebook/845/g9) | `` | -| [HP Notebook 14-df0023](hp/notebook/14-df0023) | `` | -| [i.MX8QuadMax Multisensory Enablement Kit](nxp/imx8qm-mek/) | `` | -| [Intel NUC 8i7BEH](intel/nuc/8i7beh/) | `` | -| [Lenovo IdeaPad Gaming 3 15arh05](lenovo/ideapad/15arh05) | `` | -| [Lenovo IdeaPad Z510](lenovo/ideapad/z510) | `` | -| [Lenovo IdeaPad Slim 5](lenovo/ideapad/slim-5) | `` | -| [Lenovo IdeaPad S145 15api](lenovo/ideapad/s145-15api) | `` | -| [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 Y530 15ICH](lenovo/legion/15ich) | `` | -| [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 P1 Gen 3](lenovo/thinkpad/p1/3th-gen) | `` | -| [Lenovo ThinkPad P14s AMD Gen 2](lenovo/thinkpad/p14s/amd/gen2) | `` | -| [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](lenovo/thinkpad/t14) | `` | -| [Lenovo ThinkPad T14s AMD Gen 1](lenovo/thinkpad/t14s/amd/gen1) | `` | -| [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 T495](lenovo/thinkpad/t495) | `` | -| [Lenovo ThinkPad T520](lenovo/thinkpad/t520) | `` | -| [Lenovo ThinkPad T550](lenovo/thinkpad/t550) | `` | -| [Lenovo ThinkPad T590](lenovo/thinkpad/t590) | `` | -| [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 Extreme Gen 2](lenovo/thinkpad/x1-extreme/gen2) | `` | -| [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](lenovo/thinkpad/x13) | `` | -| [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](lenovo/thinkpad/z/z13) | `` | -| [LENOVO Yoga 6 13ALC6 82ND](lenovo/yoga/6/13ALC6) | `` | -| [MSI GS60 2QE](msi/gs60) | `` | -| [MSI GL62/CX62](msi/gl62) | `` | -| [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) | `` | -| [Morefine M600](morefine/m600) | `` | -| [Hardkernel Odroid HC4](hardkernel/odroid-hc4/default.nix) | `` | -| [Hardkernel Odroid H3](hardkernel/odroid-h3/default.nix) | `` | -| [Omen 15-en0010ca](omen/15-en0010ca) | `` | -| [Omen 16-n0005ne](omen/16-n0005ne) | `` | -| [Omen 15-en1007sa](omen/15-en1007sa) | `` | -| [Omen en00015p](omen/en00015p) | `` | -| [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/) | `` | -| [Purism Librem 13v3](purism/librem/13v3) | `` | -| [Purism Librem 15v3](purism/librem/13v3) | `` | -| [Purism Librem 5r4](purism/librem/5r4) | `` | -| [Raspberry Pi 2](raspberry-pi/2) | `` | -| [Raspberry Pi 4](raspberry-pi/4) | `` | -| [Samsung Series 9 NP900X3C](samsung/np900x3c) | `` | -| [StarFive VisionFive v1](starfive/visionfive/v1) | `` | -| [StarFive VisionFive 2](starfive/visionfive/v2) | `` | -| [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) | `` | -| [Toshiba Chromebook 2 `swanky`](toshiba/swanky) | `` | -| [Tuxedo InfinityBook v4](tuxedo/infinitybook/v4) | `` | -| [TUXEDO Pulse 15 - Gen2](tuxedo/pulse/15/gen2) | `` | +| Model | Path | +| ---------------------------------------------------------------------- | ------------------------------------------------------- | +| [Acer Aspire 4810T](acer/aspire/4810t) | `` | +| [Airis N990](airis/n990) | `` | +| [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 Pro 10,1](apple/macbook-pro/10-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 Macs with a T2 Chip](apple/t2) | `` | +| [Asus ROG Ally RC71L (2023)](asus/ally/rc71l) | `` | +| [Asus ROG Strix G513IM](asus/rog-strix/g513im) | `` | +| [Asus ROG Strix G733QS](asus/rog-strix/g733qs) | `` | +| [Asus ROG Zephyrus G14 GA401](asus/zephyrus/ga401) | `` | +| [Asus ROG Zephyrus G14 GA402](asus/zephyrus/ga402) | `` | +| [Asus ROG Zephyrus G15 GA502](asus/zephyrus/ga502) | `` | +| [Asus ROG Zephyrus G15 GA503](asus/zephyrus/ga503) | `` | +| [Asus ROG Zephyrus M16 GU603H](asus/zephyrus/gu603h) | `` | +| [Asus TUF FX504GD](asus/fx504gd) | `` | +| [BeagleBoard PocketBeagle](beagleboard/pocketbeagle) | `` | +| [Deciso DEC series](deciso/dec) | `` | +| [Dell G3 3779](dell/g3/3779) | `` | +| [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 Latitude 3340](dell/latitude/3340) | `` | +| [Dell Latitude 3480](dell/latitude/3480) | `` | +| [Dell Latitude 5520](dell/latitude/5520) | `` | +| [Dell Latitude 7430](dell/latitude/7430) | `` | +| [Dell Latitude 7490](dell/latitude/7490) | `` | +| [Dell Poweredge R7515](dell/poweredge/r7515) | `` | +| [Dell Precision 3541](dell/precision/3541) | `` | +| [Dell Precision 5530](dell/precision/5530) | `` | +| [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 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 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 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 13 AMD Ryzen 7040 Series](framework/13-inch/7040-amd) | `` | +| [FriendlyARM NanoPC-T4](friendlyarm/nanopc-t4) | `` | +| [FriendlyARM NanoPi R5s](friendlyarm/nanopi-r5s) | `` | +| [Focus M2 Gen 1](focus/m2/gen1) | `` | +| [GPD MicroPC](gpd/micropc) | `` | +| [GPD P2 Max](gpd/p2-max) | `` | +| [GPD Pocket 3](gpd/pocket-3) | `` | +| [GPD WIN 2](gpd/win-2) | `` | +| [GPD WIN Max 2 2023](gpd/win-max-2/2023) | `` | +| [Google Pixelbook](google/pixelbook) | `` | +| [HP Elitebook 2560p](hp/elitebook/2560p) | `` | +| [HP Elitebook 845g7](hp/elitebook/845/g7) | `` | +| [HP Elitebook 845g9](hp/elitebook/845/g9) | `` | +| [HP Notebook 14-df0023](hp/notebook/14-df0023) | `` | +| [i.MX8QuadMax Multisensory Enablement Kit](nxp/imx8qm-mek/) | `` | +| [Intel NUC 8i7BEH](intel/nuc/8i7beh/) | `` | +| [Lenovo IdeaPad Gaming 3 15arh05](lenovo/ideapad/15arh05) | `` | +| [Lenovo IdeaPad Z510](lenovo/ideapad/z510) | `` | +| [Lenovo IdeaPad Slim 5](lenovo/ideapad/slim-5) | `` | +| [Lenovo IdeaPad S145 15api](lenovo/ideapad/s145-15api) | `` | +| [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 Y530 15ICH](lenovo/legion/15ich) | `` | +| [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 P1 Gen 3](lenovo/thinkpad/p1/3th-gen) | `` | +| [Lenovo ThinkPad P14s AMD Gen 2](lenovo/thinkpad/p14s/amd/gen2) | `` | +| [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](lenovo/thinkpad/t14) | `` | +| [Lenovo ThinkPad T14s AMD Gen 1](lenovo/thinkpad/t14s/amd/gen1) | `` | +| [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 T495](lenovo/thinkpad/t495) | `` | +| [Lenovo ThinkPad T520](lenovo/thinkpad/t520) | `` | +| [Lenovo ThinkPad T550](lenovo/thinkpad/t550) | `` | +| [Lenovo ThinkPad T590](lenovo/thinkpad/t590) | `` | +| [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 Extreme Gen 2](lenovo/thinkpad/x1-extreme/gen2) | `` | +| [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](lenovo/thinkpad/x13) | `` | +| [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](lenovo/thinkpad/z/z13) | `` | +| [LENOVO Yoga 6 13ALC6 82ND](lenovo/yoga/6/13ALC6) | `` | +| [MSI GS60 2QE](msi/gs60) | `` | +| [MSI GL62/CX62](msi/gl62) | `` | +| [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) | `` | +| [Morefine M600](morefine/m600) | `` | +| [Hardkernel Odroid HC4](hardkernel/odroid-hc4/default.nix) | `` | +| [Hardkernel Odroid H3](hardkernel/odroid-h3/default.nix) | `` | +| [Omen 15-en0010ca](omen/15-en0010ca) | `` | +| [Omen 16-n0005ne](omen/16-n0005ne) | `` | +| [Omen 15-en1007sa](omen/15-en1007sa) | `` | +| [Omen en00015p](omen/en00015p) | `` | +| [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/) | `` | +| [Purism Librem 13v3](purism/librem/13v3) | `` | +| [Purism Librem 15v3](purism/librem/13v3) | `` | +| [Purism Librem 5r4](purism/librem/5r4) | `` | +| [Raspberry Pi 2](raspberry-pi/2) | `` | +| [Raspberry Pi 4](raspberry-pi/4) | `` | +| [Samsung Series 9 NP900X3C](samsung/np900x3c) | `` | +| [StarFive VisionFive v1](starfive/visionfive/v1) | `` | +| [StarFive VisionFive 2](starfive/visionfive/v2) | `` | +| [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) | `` | +| [Toshiba Chromebook 2 `swanky`](toshiba/swanky) | `` | +| [Tuxedo InfinityBook v4](tuxedo/infinitybook/v4) | `` | +| [TUXEDO Pulse 15 - Gen2](tuxedo/pulse/15/gen2) | `` | diff --git a/flake.nix b/flake.nix index 3b63232..18988af 100644 --- a/flake.nix +++ b/flake.nix @@ -153,6 +153,7 @@ lenovo-thinkpad-x1-nano-gen1 = import ./lenovo/thinkpad/x1-nano/gen1; lenovo-thinkpad-x13 = import ./lenovo/thinkpad/x13; 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; diff --git a/lenovo/thinkpad/x13/yoga/3th-gen/default.nix b/lenovo/thinkpad/x13/yoga/3th-gen/default.nix new file mode 100644 index 0000000..1b02f61 --- /dev/null +++ b/lenovo/thinkpad/x13/yoga/3th-gen/default.nix @@ -0,0 +1,8 @@ +{ lib, ... }: { + imports = [ + ../. + ]; + + # without throttled, our CPU (i5-1235u) did not boost beyond 1300MHz + services.throttled.enable = lib.mkDefault true; +} From 453896efd821ef562793681568ac64caed3a3c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 25 Dec 2023 21:21:26 +0100 Subject: [PATCH 19/41] tests/run.py: reformat with ruff --- tests/run.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/run.py b/tests/run.py index 8cc92f9..af02515 100755 --- a/tests/run.py +++ b/tests/run.py @@ -40,7 +40,8 @@ def build_profile( cmd = [ "nix", "build", - "--extra-experimental-features", "nix-command", + "--extra-experimental-features", + "nix-command", "-f", "build-profile.nix", "-I", @@ -59,7 +60,11 @@ def build_profile( if verbose: print(f"$ {' '.join(cmd)}") res = subprocess.run( - cmd, cwd=TEST_ROOT, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, + cmd, + cwd=TEST_ROOT, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True, ) return (profile, res) @@ -74,7 +79,9 @@ def parse_args() -> argparse.Namespace: "If set to 1 it disable multi processing (suitable for debugging)", ) parser.add_argument( - "--verbose", action="store_true", help="Print evaluation commands executed", + "--verbose", + action="store_true", + help="Print evaluation commands executed", ) parser.add_argument("profiles", nargs="*") return parser.parse_args() From e91914c6cc8bfb3fb2a9bf6a95a0c62299672d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 25 Dec 2023 21:27:11 +0100 Subject: [PATCH 20/41] apply ruff lints --- tests/run.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/run.py b/tests/run.py index af02515..3971e7a 100755 --- a/tests/run.py +++ b/tests/run.py @@ -8,7 +8,6 @@ import subprocess import sys from functools import partial from pathlib import Path -from typing import List, Tuple TEST_ROOT = Path(__file__).resolve().parent ROOT = TEST_ROOT.parent @@ -18,9 +17,9 @@ RED = "\033[91m" RESET = "\033[0m" -def parse_readme() -> List[str]: +def parse_readme() -> list[str]: profiles = set() - with open(ROOT.joinpath("README.md")) as f: + with ROOT.joinpath("README.md").open() as f: for line in f: results = re.findall(r"]+>", line) profiles.update(results) @@ -29,7 +28,7 @@ def parse_readme() -> List[str]: def build_profile( profile: str, verbose: bool -) -> Tuple[str, subprocess.CompletedProcess]: +) -> tuple[str, subprocess.CompletedProcess]: # Hard-code this for now until we have enough other architectures to care about this. system = "x86_64-linux" if "raspberry-pi/2" in profile: @@ -62,9 +61,9 @@ def build_profile( res = subprocess.run( cmd, cwd=TEST_ROOT, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, text=True, + check=False, ) return (profile, res) @@ -89,14 +88,11 @@ def parse_args() -> argparse.Namespace: def main() -> None: args = parse_args() - if len(args.profiles) == 0: - profiles = parse_readme() - else: - profiles = args.profiles + profiles = parse_readme() if len(args.profiles) == 0 else args.profiles failed_profiles = [] - def eval_finished(args: Tuple[str, subprocess.CompletedProcess]) -> None: + def eval_finished(args: tuple[str, subprocess.CompletedProcess]) -> None: profile, res = args if res.returncode == 0: print(f"{GREEN}OK {profile}{RESET}") From 05fc10e09377a5e28c54b723da8691daaf44b0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 25 Dec 2023 21:27:43 +0100 Subject: [PATCH 21/41] add pyproject.toml for ruff lints --- tests/pyproject.toml | 64 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/pyproject.toml diff --git a/tests/pyproject.toml b/tests/pyproject.toml new file mode 100644 index 0000000..ede24cb --- /dev/null +++ b/tests/pyproject.toml @@ -0,0 +1,64 @@ +[tool.ruff] +line-length = 88 +target-version = "py311" + +select = ["ALL"] +ignore = [ + # pydocstyle + "D", + # todo comments + "TD", + # fixmes + "FIX", + + # Unused function argument + "ARG001", + + # Shebang should contain `python` + "EXE003", + # Shebang should be at the beginning of the file + "EXE005", + + # Missing type annotation for `self` in method + "ANN101", + # Dynamically typed expressions (typing.Any) + "ANN401", + # Trailing comma missing + "COM812", + # Unnecessary `dict` call (rewrite as a literal) + "C408", + # Boolean-typed positional argument in function definition + "FBT001", + # Logging statement uses f-string + "G004", + # disabled on ruff's recommendation as causes problems with the formatter + "ISC001", + # Use of `assert` detected + "S101", + # `subprocess` call: check for execution of untrusted input + "S603", + # Starting a process with a partial executable path + "S607", + # Boolean default positional argument in function definition + "FBT002", + + # Too many statements + "PLR0915", + # Too many arguments in function definition + "PLR0913", + "PLR0912", # Too many branches + # $X is too complex + "C901", + + "E501", # line too long + "T201", # `print` found + "PLR2004", # Magic value used in comparison +] + +[tool.mypy] +python_version = "3.11" +warn_redundant_casts = true +disallow_untyped_calls = true +disallow_untyped_defs = true +no_implicit_optional = true +pretty = true From 65753f5d1144e3bf468a6bfe464011b12c840792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 25 Dec 2023 22:45:38 +0100 Subject: [PATCH 22/41] speed up ci using nix-eval-jobs --- tests/build-profile.nix | 21 +++--- tests/run.py | 152 +++++++++++++++++++++++----------------- 2 files changed, 95 insertions(+), 78 deletions(-) diff --git a/tests/build-profile.nix b/tests/build-profile.nix index bdde5df..e4e1cdb 100644 --- a/tests/build-profile.nix +++ b/tests/build-profile.nix @@ -1,7 +1,9 @@ -{ profile }: +{ profile, pkgs }: -let - shim = { config, lib, pkgs, ... }: { +(pkgs.nixos [ + profile + ({ config, lib, ... }: { + nixpkgs.pkgs = pkgs; boot.loader.systemd-boot.enable = !config.boot.loader.generic-extlinux-compatible.enable && !config.boot.loader.raspberryPi.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; @@ -14,13 +16,6 @@ let device = "/dev/disk/by-uuid/00000000-0000-0000-0000-000000000000"; fsType = "btrfs"; }; - - nixpkgs.config = { - allowBroken = true; - allowUnfree = true; - nvidia.acceptLicense = true; - }; - }; -in (import { - configuration.imports = [ profile shim ]; -}).system + system.stateVersion = lib.version; + }) +]).config.system.build.toplevel diff --git a/tests/run.py b/tests/run.py index 3971e7a..8ad6025 100755 --- a/tests/run.py +++ b/tests/run.py @@ -1,13 +1,16 @@ #!/usr/bin/env nix-shell -#!nix-shell --quiet -p nix -p python3 -i python +#!nix-shell --quiet -p nix-eval-jobs -p nix -p python3 -i python import argparse +import json import multiprocessing import re import subprocess import sys -from functools import partial +import textwrap from pathlib import Path +from tempfile import TemporaryDirectory +from typing import IO TEST_ROOT = Path(__file__).resolve().parent ROOT = TEST_ROOT.parent @@ -16,58 +19,18 @@ GREEN = "\033[92m" RED = "\033[91m" RESET = "\033[0m" +re_nixos_hardware = re.compile(r"]+)>") + def parse_readme() -> list[str]: profiles = set() with ROOT.joinpath("README.md").open() as f: for line in f: - results = re.findall(r"]+>", line) - profiles.update(results) + if (m := re_nixos_hardware.search(line)) is not None: + profiles.add(m.group(1).strip()) return list(profiles) -def build_profile( - profile: str, verbose: bool -) -> tuple[str, subprocess.CompletedProcess]: - # Hard-code this for now until we have enough other architectures to care about this. - system = "x86_64-linux" - if "raspberry-pi/2" in profile: - system = "armv7l-linux" - if "raspberry-pi/4" in profile: - system = "aarch64-linux" - - cmd = [ - "nix", - "build", - "--extra-experimental-features", - "nix-command", - "-f", - "build-profile.nix", - "-I", - f"nixos-hardware={ROOT}", - "--show-trace", - "--system", - system, - "--arg", - "profile", - profile, - ] - - # uses import from derivation - if profile != "": - cmd += ["--dry-run"] - if verbose: - print(f"$ {' '.join(cmd)}") - res = subprocess.run( - cmd, - cwd=TEST_ROOT, - capture_output=True, - text=True, - check=False, - ) - return (profile, res) - - def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser(description="Run hardware tests") parser.add_argument( @@ -86,31 +49,90 @@ def parse_args() -> argparse.Namespace: return parser.parse_args() +def write_eval_test(f: IO[str], profiles: list[str]) -> None: + build_profile = TEST_ROOT.joinpath("build-profile.nix") + f.write( + textwrap.dedent( + f""" + let + purePkgs = system: import {{ + config = {{ + allowBroken = true; + allowUnfree = true; + nvidia.acceptLicense = true; + }}; + overlays = []; + inherit system; + }}; + pkgs.x86_64-linux = purePkgs "x86_64-linux"; + pkgs.aarch64-linux = purePkgs "aarch64-linux"; + buildProfile = import {build_profile}; + in + """ + ) + ) + f.write("{\n") + for profile in profiles: + # does import-from-derivation + if profile == "toshiba/swanky": + continue + # uses custom nixpkgs config + if profile == "raspberry-pi/2": + continue + + system = "x86_64-linux" + if "raspberry-pi/4" == profile: + system = "aarch64-linux" + + f.write( + f' "{profile}" = buildProfile {{ profile = import {ROOT}/{profile}; pkgs = pkgs.{system}; }};\n' + ) + f.write("}\n") + + +def run_eval_test(eval_test: Path, gcroot_dir: Path, jobs: int) -> list[str]: + failed_profiles = [] + cmd = [ + "nix-eval-jobs", + "--gc-roots-dir", + gcroot_dir, + "--max-memory-size", + "2048", + "--workers", + str(jobs), + str(eval_test), + ] + proc = subprocess.Popen( + cmd, + stdout=subprocess.PIPE, + text=True, + ) + with proc as p: + assert p.stdout is not None + for line in p.stdout: + data = json.loads(line) + attr = data.get("attr") + if "error" in data: + failed_profiles.append(attr) + print(f"{RED}FAIL {attr}:{RESET}", file=sys.stderr) + print(f"{RED}{data['error']}{RESET}", file=sys.stderr) + else: + print(f"{GREEN}OK {attr}{RESET}") + return failed_profiles + + def main() -> None: args = parse_args() profiles = parse_readme() if len(args.profiles) == 0 else args.profiles failed_profiles = [] + with TemporaryDirectory() as tmpdir: + eval_test = Path(tmpdir) / "eval-test.nix" + gcroot_dir = Path(tmpdir) / "gcroot" + with eval_test.open("w") as f: + write_eval_test(f, profiles) + failed_profiles = run_eval_test(eval_test, gcroot_dir, args.jobs) - def eval_finished(args: tuple[str, subprocess.CompletedProcess]) -> None: - profile, res = args - if res.returncode == 0: - print(f"{GREEN}OK {profile}{RESET}") - else: - print(f"{RED}FAIL {profile}:{RESET}", file=sys.stderr) - if res.stdout != "": - print(f"{RED}{res.stdout.rstrip()}{RESET}", file=sys.stderr) - print(f"{RED}{res.stderr.rstrip()}{RESET}", file=sys.stderr) - failed_profiles.append(profile) - - build = partial(build_profile, verbose=args.verbose) - if len(profiles) == 0 or args.jobs == 1: - for profile in profiles: - eval_finished(build(profile)) - else: - pool = multiprocessing.Pool(processes=args.jobs) - for r in pool.imap(build, profiles): - eval_finished(r) if len(failed_profiles) > 0: print(f"\n{RED}The following {len(failed_profiles)} test(s) failed:{RESET}") for profile in failed_profiles: From a15b6e525f5737a47b4ce28445c836996fb2ea8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 25 Dec 2023 22:57:09 +0100 Subject: [PATCH 23/41] apple-t2: avoid import-from-derivation --- apple/t2/default.nix | 15 +++++++++------ apple/t2/pkgs/linux-t2.nix | 23 +++++++++++++++-------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/apple/t2/default.nix b/apple/t2/default.nix index 359748a..33658d6 100644 --- a/apple/t2/default.nix +++ b/apple/t2/default.nix @@ -8,6 +8,12 @@ let hash = "sha256-x7K0qa++P1e1vuCGxnsFxL1d9+nwMtZUJ6Kd9e27TFs="; }; + 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" ]; @@ -18,7 +24,7 @@ let pipewirePackage = overrideAudioFiles pkgs.pipewire "spa/plugins/"; - apple-set-os-loader-installer = pkgs.stdenv.mkDerivation rec { + apple-set-os-loader-installer = pkgs.stdenv.mkDerivation { name = "apple-set-os-loader-installer-1.0"; src = pkgs.fetchFromGitHub { owner = "Redecorating"; @@ -51,15 +57,12 @@ in config = { # For keyboard and touchbar - boot.kernelPackages = with pkgs; recurseIntoAttrs (linuxPackagesFor (callPackage ./pkgs/linux-t2.nix { })); + boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./pkgs/linux-t2.nix { }); boot.initrd.kernelModules = [ "apple-bce" ]; # For audio boot.kernelParams = [ "pcie_ports=compat" "intel_iommu=on" "iommu=pt" ]; - services.udev.extraRules = builtins.readFile (pkgs.substitute { - src = "${audioFiles}/files/91-audio-custom.rules"; - replacements = [ "--replace" "/usr/bin/sed" "${pkgs.gnused}/bin/sed" ]; - }); + services.udev.packages = [ audioFilesUdevRules ]; hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/"; diff --git a/apple/t2/pkgs/linux-t2.nix b/apple/t2/pkgs/linux-t2.nix index b9f0109..40371fe 100644 --- a/apple/t2/pkgs/linux-t2.nix +++ b/apple/t2/pkgs/linux-t2.nix @@ -1,4 +1,5 @@ -{ lib, buildLinux, fetchFromGitHub, fetchurl, ... } @ args: +{ lib, buildLinux, fetchFromGitHub, fetchzip, runCommand +, ... } @ args: let patchRepo = fetchFromGitHub { @@ -18,10 +19,18 @@ buildLinux (args // { # Snippet from nixpkgs modDirVersion = with lib; "${concatStringsSep "." (take 3 (splitVersion "${version}.0"))}"; - src = fetchurl { - url = "mirror://kernel/linux/kernel/v${majorVersion}.x/linux-${version}.tar.xz"; - hash = "sha256-eldLvCCALqdrUsp/rwcmf3IEXoYbGJFcUnKpjCer+IQ="; - }; + src = runCommand "patched-source" {} '' + cp -r ${fetchzip { + url = "mirror://kernel/linux/kernel/v${majorVersion}.x/linux-${version}.tar.xz"; + hash = "sha256-qJmVSju69WcvDIbgrbtMyCi+OXUNTzNX2G+/0zwsPR4="; + }} $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; @@ -40,7 +49,5 @@ buildLinux (args // { STAGING = yes; }; - kernelPatches = lib.attrsets.mapAttrsToList (file: type: { name = file; patch = "${patchRepo}/${file}"; }) - (lib.attrsets.filterAttrs (file: type: type == "regular" && lib.strings.hasSuffix ".patch" file) - (builtins.readDir patchRepo)); + kernelPatches = []; } // (args.argsOverride or {})) From 8ae5b3ff81d4c1e57f76e3237efeb0438f9d4f71 Mon Sep 17 00:00:00 2001 From: Sophie Tauchert Date: Wed, 27 Dec 2023 15:58:20 +0100 Subject: [PATCH 24/41] purism librem5r4: linuxPackages_librem5: 6.5.6-librem5 -> 6.6.6-librem5 --- purism/librem/5r4/kernel/kernel.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/purism/librem/5r4/kernel/kernel.nix b/purism/librem/5r4/kernel/kernel.nix index 73c7323..28f5958 100644 --- a/purism/librem/5r4/kernel/kernel.nix +++ b/purism/librem/5r4/kernel/kernel.nix @@ -6,14 +6,14 @@ buildLinux (args // rec { defconfig = "librem5_defconfig"; - version = "6.5.6-librem5"; + version = "6.6.6-librem5"; modDirVersion = version; src = fetchFromGitLab { domain = "source.puri.sm"; owner = "Librem5"; repo = "linux"; - rev = "pureos/6.5.6pureos1"; - hash = "sha256-hOv0oy31mbC+43sI1n1oqKl7TtT/Ivj6UhiW4maumCg="; + rev = "pureos/6.6.6pureos1"; + hash = "sha256-LJfY45yNYgFYLCGxb+WRMYBUHnY4HCI2rkflPeaeFe0="; }; kernelPatches = [ ]; structuredExtraConfig = with lib.kernel; { From 1bace8cedd4fa4ea9efb5ea17a06b9d92af86206 Mon Sep 17 00:00:00 2001 From: Dominic Egginton Date: Wed, 27 Dec 2023 14:16:44 +0000 Subject: [PATCH 25/41] feat: add dell latitude 7390 module --- README.md | 1 + dell/latitude/7390/default.nix | 8 ++++++++ flake.nix | 1 + 3 files changed, 10 insertions(+) create mode 100644 dell/latitude/7390/default.nix diff --git a/README.md b/README.md index 80602f1..3aa5334 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ See code for all available configurations. | [Dell Latitude 3340](dell/latitude/3340) | `` | | [Dell Latitude 3480](dell/latitude/3480) | `` | | [Dell Latitude 5520](dell/latitude/5520) | `` | +| [Dell Latitude 7390](dell/latitude/7390) | `` | | [Dell Latitude 7430](dell/latitude/7430) | `` | | [Dell Latitude 7490](dell/latitude/7490) | `` | | [Dell Poweredge R7515](dell/poweredge/r7515) | `` | diff --git a/dell/latitude/7390/default.nix b/dell/latitude/7390/default.nix new file mode 100644 index 0000000..6ce667d --- /dev/null +++ b/dell/latitude/7390/default.nix @@ -0,0 +1,8 @@ +{ lib, ... }: + +{ + imports = [ + ../../../common/cpu/intel + ../../../common/pc/laptop + ]; +} diff --git a/flake.nix b/flake.nix index 18988af..b91b249 100644 --- a/flake.nix +++ b/flake.nix @@ -35,6 +35,7 @@ dell-latitude-3340 = import ./dell/latitude/3340; dell-latitude-3480 = import ./dell/latitude/3480; dell-latitude-5520 = import ./dell/latitude/5520; + dell-latitude-7390 = import ./dell/latitude/7390; dell-latitude-7430 = import ./dell/latitude/7430; dell-latitude-7490 = import ./dell/latitude/7490; dell-poweredge-r7515 = import ./dell/poweredge/r7515; From 9c3a41257898f632792a6f948d43a6123ae9a5f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 29 Dec 2023 14:07:10 +0100 Subject: [PATCH 26/41] framework/13-inch/13th: document on how to get the fingerprint sensor to work --- framework/13-inch/13th-gen-intel/README.md | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/framework/13-inch/13th-gen-intel/README.md b/framework/13-inch/13th-gen-intel/README.md index 8f3b7a4..89e2694 100644 --- a/framework/13-inch/13th-gen-intel/README.md +++ b/framework/13-inch/13th-gen-intel/README.md @@ -13,3 +13,43 @@ Then run ```sh $ fwupdmgr update ``` + +## Getting the fingerprint sensor to work + +The firmware on the fingerprint sensor needs a downgrade to make it work on Linux. +The process is documented [here](https://knowledgebase.frame.work/en_us/updating-fingerprint-reader-firmware-on-linux-for-13th-gen-and-amd-ryzen-7040-series-laptops-HJrvxv_za). + +However on recent NixOS versions also fwupd can no longer update the firmware. +Using the following snippet allows to temporarly downgrade fwupd to an old-enough version: + +```nix +{ + services.fwupd.enable = true; + # we need fwupd 1.9.7 to downgrade the fingerprint sensor firmware + services.fwupd.package = (import (builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/bb2009ca185d97813e75736c2b8d1d8bb81bde05.tar.gz"; + sha256 = "sha256:003qcrsq5g5lggfrpq31gcvj82lb065xvr7bpfa8ddsw8x4dnysk"; + }) { + inherit (pkgs) system; + }).fwupd; +} +``` + +Afterwards the downgraded driver can be downloaded and installed like this: + +``` +wget https://github.com/FrameworkComputer/linux-docs/raw/main/goodix-moc-609c-v01000330.cab +sudo fwupdtool install --allow-reinstall --allow-older goodix-moc-609c-v01000330.cab +Loading… [ - ]/nix/store/1n2l5law9g3b77hcfyp50vrhhssbrj5g-glibc-2.37-8/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/f55npw04a2s6xmrbx4jw12xq16b3avb8-gvfs-1.52.1/lib/gio/modules/libgvfsdbus.so) +Failed to load module: /nix/store/f55npw04a2s6xmrbx4jw12xq16b3avb8-gvfs-1.52.1/lib/gio/modules/libgvfsdbus.so +Loading… [ ]12:16:46.348 FuHistory schema version 9 is unknown +Writing… [************************************* ]12:16:57.055 FuEngine failed to update-cleanup after failed update: failed to get device before update cleanup: failed to wait for detach replug: device d432baa2162a32c1554ef24bd8281953b9d07c11 did not come back + +failed to write: failed to reply: transfer timed out +``` + +The error message above is harmless. After a reboot, I was able to enroll my fingerprint like this: + +``` +sudo fprintd-enroll $USER +``` From 72fea2077cbd6febb1fa83b697d1ae4950bfc75d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kl=C3=A4hn?= <39526136+Septias@users.noreply.github.com> Date: Fri, 29 Dec 2023 19:58:24 +0100 Subject: [PATCH 27/41] Update config for xps-13-9010 Add configuration for finger print --- dell/xps/13-9310/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index 8f8fabb..495cff1 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -16,6 +16,12 @@ # Without this we get errors in dmesg on boot and hangs when shutting down. boot.blacklistedKernelModules = [ "psmouse" ]; + # enable finger print sensor. + # this has to be configured with `sudo fprintd-enroll septias` + services.fprintd.enable = true; + services.fprintd.tod.enable = true; + services.fprintd.tod.driver = pkgs.libfprint-2-tod1-goodix; + # Allows for updating firmware via `fwupdmgr`. services.fwupd.enable = true; } From 22ae59fec26591ef72ce4ccb5538c42c5f090fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kl=C3=A4hn?= <39526136+Septias@users.noreply.github.com> Date: Fri, 29 Dec 2023 19:59:57 +0100 Subject: [PATCH 28/41] Update dell/xps/13-9310/default.nix --- dell/xps/13-9310/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index 495cff1..d5fcdc6 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -17,7 +17,7 @@ boot.blacklistedKernelModules = [ "psmouse" ]; # enable finger print sensor. - # this has to be configured with `sudo fprintd-enroll septias` + # this has to be configured with `sudo fprintd-enroll `. services.fprintd.enable = true; services.fprintd.tod.enable = true; services.fprintd.tod.driver = pkgs.libfprint-2-tod1-goodix; From 062e4810d8bee4954d32cf78145602e5b66c8704 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Sun, 31 Dec 2023 11:59:33 -0500 Subject: [PATCH 29/41] starfive visionfive2: update u-boot to SDK version v5.10.3 --- starfive/visionfive/v2/uboot.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/starfive/visionfive/v2/uboot.nix b/starfive/visionfive/v2/uboot.nix index 9666175..a149f8b 100644 --- a/starfive/visionfive/v2/uboot.nix +++ b/starfive/visionfive/v2/uboot.nix @@ -1,13 +1,13 @@ { fetchFromGitHub, buildUBoot }: buildUBoot rec { - version = "3.8.2"; + version = "5.10.3"; src = fetchFromGitHub { owner = "starfive-tech"; repo = "u-boot"; - rev = "refs/tags/VF2_v${version}"; - hash = "sha256-M/ndil++spcJCYnpYLb+fuxqCi4H3BunXdHbl529ovM="; + rev = "refs/tags/JH7110_VF2_6.1_v${version}"; + hash = "sha256-4E/AxPCFCluwJBEf6xGuxAi1hPZK5ZxEs5WlBVVfvYE="; }; defconfig = "starfive_visionfive2_defconfig"; From 316bc98323fe3a7e7f72dbbbe68dce0cce3d4984 Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Sat, 30 Dec 2023 11:49:17 +0100 Subject: [PATCH 30/41] Add TUXEDO InfinityBook Pro 14 - Gen7 config --- README.md | 1 + flake.nix | 1 + tuxedo/infinitybook/pro14/gen7/README.md | 1 + tuxedo/infinitybook/pro14/gen7/default.nix | 12 ++++++++++++ 4 files changed, 15 insertions(+) create mode 100644 tuxedo/infinitybook/pro14/gen7/README.md create mode 100644 tuxedo/infinitybook/pro14/gen7/default.nix diff --git a/README.md b/README.md index 3aa5334..d8aae45 100644 --- a/README.md +++ b/README.md @@ -265,4 +265,5 @@ See code for all available configurations. | [System76 Darter Pro 6](system76/darp6) | `` | | [Toshiba Chromebook 2 `swanky`](toshiba/swanky) | `` | | [Tuxedo InfinityBook v4](tuxedo/infinitybook/v4) | `` | +| [TUXEDO InfinityBook Pro 14 - Gen7](tuxedo/infinitybook/pro14/gen7) | `` | | [TUXEDO Pulse 15 - Gen2](tuxedo/pulse/15/gen2) | `` | diff --git a/flake.nix b/flake.nix index b91b249..f29c9a7 100644 --- a/flake.nix +++ b/flake.nix @@ -208,6 +208,7 @@ system76-darp6 = import ./system76/darp6; toshiba-swanky = import ./toshiba/swanky; tuxedo-infinitybook-v4 = import ./tuxedo/infinitybook/v4; + tuxedo-infinitybook-pro14-gen7 = import ./tuxedo/infinitybook/pro14/gen7; tuxedo-pulse-15-gen2 = import ./tuxedo/pulse/15/gen2; common-cpu-amd = import ./common/cpu/amd; diff --git a/tuxedo/infinitybook/pro14/gen7/README.md b/tuxedo/infinitybook/pro14/gen7/README.md new file mode 100644 index 0000000..674bbd4 --- /dev/null +++ b/tuxedo/infinitybook/pro14/gen7/README.md @@ -0,0 +1 @@ +# [TUXEDO InfinityBook Pro 14 - Gen7](https://www.tuxedocomputers.com/de/TUXEDO-InfinityBook-Pro-14-Gen7.tuxedo) diff --git a/tuxedo/infinitybook/pro14/gen7/default.nix b/tuxedo/infinitybook/pro14/gen7/default.nix new file mode 100644 index 0000000..9971b7b --- /dev/null +++ b/tuxedo/infinitybook/pro14/gen7/default.nix @@ -0,0 +1,12 @@ +{ lib, ... }: + +{ + imports = [ + ../../../../common/cpu/intel + ../../../../common/pc/laptop + ../../../../common/pc/ssd + ]; + + # Cooling management + services.thermald.enable = lib.mkDefault true; +} From f752581d6723a10da7dfe843e917a3b5e4d8115a Mon Sep 17 00:00:00 2001 From: Keanu Kerr Date: Mon, 1 Jan 2024 13:19:05 +0100 Subject: [PATCH 31/41] Added file for HP EliteBook 845 G8 and updated flake and README --- README.md | 1 + flake.nix | 1 + hp/elitebook/845/g8/default.nix | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 hp/elitebook/845/g8/default.nix diff --git a/README.md b/README.md index d8aae45..b8e45bb 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,7 @@ See code for all available configurations. | [Google Pixelbook](google/pixelbook) | `` | | [HP Elitebook 2560p](hp/elitebook/2560p) | `` | | [HP Elitebook 845g7](hp/elitebook/845/g7) | `` | +| [HP Elitebook 845g8](hp/elitebook/845/g8) | `` | | [HP Elitebook 845g9](hp/elitebook/845/g9) | `` | | [HP Notebook 14-df0023](hp/notebook/14-df0023) | `` | | [i.MX8QuadMax Multisensory Enablement Kit](nxp/imx8qm-mek/) | `` | diff --git a/flake.nix b/flake.nix index f29c9a7..4d44aa2 100644 --- a/flake.nix +++ b/flake.nix @@ -82,6 +82,7 @@ gpd-win-max-2-2023 = import ./gpd/win-max-2/2023; hp-elitebook-2560p = import ./hp/elitebook/2560p; 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-notebook-14-df0023 = import ./hp/notebook/14-df0023; intel-nuc-8i7beh = import ./intel/nuc/8i7beh; diff --git a/hp/elitebook/845/g8/default.nix b/hp/elitebook/845/g8/default.nix new file mode 100644 index 0000000..60afe6a --- /dev/null +++ b/hp/elitebook/845/g8/default.nix @@ -0,0 +1,25 @@ +{ pkgs, lib, ... }: + +{ + imports = + [ + ../../../../common/cpu/amd + ../../../../common/cpu/amd/pstate.nix + ../../../../common/gpu/amd + ../../../../common/pc/laptop + ../../../../common/pc/laptop/acpi_call.nix + ../../../../common/pc/laptop/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); + + # disable Scatter/Gather APU recently enabled by default, + # which results in white screen after display reconfiguration + boot.kernelParams = [ "amdgpu.sg_display=0" ]; + + services.xserver = { + videoDrivers = [ "amdgpu" ]; + }; +} From c2f991b91ec4d0da53d04317914eacad354ad0a6 Mon Sep 17 00:00:00 2001 From: Will Lucas Date: Thu, 28 Dec 2023 10:41:41 -0600 Subject: [PATCH 32/41] Added support for Lenovo Legion Slim 5 (16APH8) Added PPD after researching the Framework laptops with AMD 7000 series --- common/cpu/amd/raphael/igpu.nix | 4 ++-- flake.nix | 1 + lenovo/legion/16aph8/README.md | 38 ++++++++++++++++++++++++++++++++ lenovo/legion/16aph8/default.nix | 36 ++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 lenovo/legion/16aph8/README.md create mode 100644 lenovo/legion/16aph8/default.nix diff --git a/common/cpu/amd/raphael/igpu.nix b/common/cpu/amd/raphael/igpu.nix index 82514c2..6faffd0 100644 --- a/common/cpu/amd/raphael/igpu.nix +++ b/common/cpu/amd/raphael/igpu.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ lib, pkgs, ... }: { # Sets the kernel version to the latest kernel to make the usage of the iGPU possible if your kernel version is too old @@ -10,7 +10,7 @@ boot = lib.mkMerge [ (lib.mkIf (lib.versionOlder pkgs.linux.version "6.1") { kernelPackages = pkgs.linuxPackages_latest; - kernelParams = ["amdgpu.sg_display=0"]; + kernelParams = ["amdgpu.sg_display=0"]; }) (lib.mkIf (lib.versionAtLeast pkgs.linux.version "6.2") { diff --git a/flake.nix b/flake.nix index 4d44aa2..c3db404 100644 --- a/flake.nix +++ b/flake.nix @@ -97,6 +97,7 @@ 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-16ithg6 = import ./lenovo/legion/16ithg6; lenovo-legion-16irx8h = import ./lenovo/legion/16irx8h; lenovo-legion-y530-15ich = import ./lenovo/legion/15ich; diff --git a/lenovo/legion/16aph8/README.md b/lenovo/legion/16aph8/README.md new file mode 100644 index 0000000..c9bbe7c --- /dev/null +++ b/lenovo/legion/16aph8/README.md @@ -0,0 +1,38 @@ +I was unable to get the hybrid settings working well with lightdm or sddm, but Optimus Sync +mode seems to work the best for me. + +I am running the Linux 6.6 LTS kernel with KDE + SDDM, and it seems to be working well. + +## hardware-configuration.nix + +I have the following customizations added for my nvidia drivers. + +``` +hardware.nvidia = { + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; +}; +``` + +## Setup at the time of testing + +### nix-info +``` +$ nix-info -m + - system: `"x86_64-linux"` + - host os: `Linux 6.1.68, NixOS, 23.11 (Tapir), 23.11.20231220.d65bcea` + - multi-user?: `yes` + - sandbox: `yes` + - version: `nix-env (Nix) 2.18.1` + - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos` +``` + +### lspci +``` +$ lspci +... +01:00.0 VGA compatible controller: NVIDIA Corporation AD107M [GeForce RTX 4060 Max-Q / Mobile] (rev a1) +... +05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Phoenix1 (rev c2) +... +``` diff --git a/lenovo/legion/16aph8/default.nix b/lenovo/legion/16aph8/default.nix new file mode 100644 index 0000000..b693cca --- /dev/null +++ b/lenovo/legion/16aph8/default.nix @@ -0,0 +1,36 @@ +{ lib, pkgs, ... }: + +{ + imports = [ + ../../../common/cpu/amd + ../../../common/cpu/amd/pstate.nix + ../../../common/gpu/amd + ../../../common/gpu/nvidia + ../../../common/pc/laptop + ../../../common/pc/laptop/ssd + ]; + + # Use latest LTS kernel for more Raphael fixes + boot = lib.mkMerge [ + (lib.mkIf (lib.versionOlder pkgs.linux.version "6.6") { + kernelPackages = pkgs.linuxPackages_6_6; + 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"; + }; + }; + + # 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; +} From 158afdeaf85065c481d888d70c4f2975cce61b2b Mon Sep 17 00:00:00 2001 From: Will Lucas Date: Mon, 1 Jan 2024 22:49:05 -0600 Subject: [PATCH 33/41] Corrected nix-info from an earlier build --- lenovo/legion/16aph8/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lenovo/legion/16aph8/README.md b/lenovo/legion/16aph8/README.md index c9bbe7c..a18718d 100644 --- a/lenovo/legion/16aph8/README.md +++ b/lenovo/legion/16aph8/README.md @@ -20,7 +20,7 @@ hardware.nvidia = { ``` $ nix-info -m - system: `"x86_64-linux"` - - host os: `Linux 6.1.68, NixOS, 23.11 (Tapir), 23.11.20231220.d65bcea` + - host os: `Linux 6.6.8, NixOS, 23.11 (Tapir), 23.11.20231231.32f6357` - multi-user?: `yes` - sandbox: `yes` - version: `nix-env (Nix) 2.18.1` From d10b79582330966723efc10df3bc4167cf22fdfe Mon Sep 17 00:00:00 2001 From: Will Lucas Date: Mon, 1 Jan 2024 22:58:40 -0600 Subject: [PATCH 34/41] Disable modesetting --- lenovo/legion/16aph8/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lenovo/legion/16aph8/default.nix b/lenovo/legion/16aph8/default.nix index b693cca..68159db 100644 --- a/lenovo/legion/16aph8/default.nix +++ b/lenovo/legion/16aph8/default.nix @@ -19,7 +19,7 @@ ]; hardware.nvidia = { - modesetting.enable = lib.mkDefault true; + modesetting.enable = lib.mkDefault false; powerManagement.enable = lib.mkDefault false; powerManagement.finegrained = lib.mkDefault false; open = lib.mkDefault false; From 0f29eb0b0f2edaae76e1f83f50b9593e57b9ebeb Mon Sep 17 00:00:00 2001 From: Will Lucas Date: Mon, 1 Jan 2024 23:03:33 -0600 Subject: [PATCH 35/41] Force to only "nvidia" for xserver.videoDrivers to avoid blank screen issues --- lenovo/legion/16aph8/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lenovo/legion/16aph8/default.nix b/lenovo/legion/16aph8/default.nix index 68159db..5610154 100644 --- a/lenovo/legion/16aph8/default.nix +++ b/lenovo/legion/16aph8/default.nix @@ -18,8 +18,10 @@ }) ]; + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia = { - modesetting.enable = lib.mkDefault false; + modesetting.enable = lib.mkDefault true; powerManagement.enable = lib.mkDefault false; powerManagement.finegrained = lib.mkDefault false; open = lib.mkDefault false; From a5028e96cc8cabb78ab58edc251e122e9ac7c7b2 Mon Sep 17 00:00:00 2001 From: Will Lucas Date: Mon, 1 Jan 2024 23:06:07 -0600 Subject: [PATCH 36/41] Small cleanup --- lenovo/legion/16aph8/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lenovo/legion/16aph8/default.nix b/lenovo/legion/16aph8/default.nix index 5610154..4f82d68 100644 --- a/lenovo/legion/16aph8/default.nix +++ b/lenovo/legion/16aph8/default.nix @@ -18,8 +18,6 @@ }) ]; - services.xserver.videoDrivers = [ "nvidia" ]; - hardware.nvidia = { modesetting.enable = lib.mkDefault true; powerManagement.enable = lib.mkDefault false; @@ -32,6 +30,9 @@ }; }; + # Avoid issues with modesetting causing blank screen + services.xserver.videoDrivers = [ "nvidia" ]; + # 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; From 5bf829d72ccdc05be3343afd81bd922d5748ef4e Mon Sep 17 00:00:00 2001 From: mevatron Date: Tue, 2 Jan 2024 09:19:49 -0600 Subject: [PATCH 37/41] Update lenovo/legion/16aph8/default.nix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks for the tip! Co-authored-by: Jörg Thalheim --- lenovo/legion/16aph8/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lenovo/legion/16aph8/default.nix b/lenovo/legion/16aph8/default.nix index 4f82d68..4718cd3 100644 --- a/lenovo/legion/16aph8/default.nix +++ b/lenovo/legion/16aph8/default.nix @@ -13,7 +13,7 @@ # Use latest LTS kernel for more Raphael fixes boot = lib.mkMerge [ (lib.mkIf (lib.versionOlder pkgs.linux.version "6.6") { - kernelPackages = pkgs.linuxPackages_6_6; + kernelPackages = pkgs.linuxPackages_latest; kernelParams = ["amdgpu.sg_display=0"]; }) ]; From db4589c6aa99135e320429e203e1b45de2f98d3e Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Sun, 31 Dec 2023 22:43:10 -0500 Subject: [PATCH 38/41] starfive visionfive2: adjust opensbi build params to match u-boot doc --- starfive/visionfive/v2/opensbi.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/starfive/visionfive/v2/opensbi.nix b/starfive/visionfive/v2/opensbi.nix index 5b46fec..f551234 100644 --- a/starfive/visionfive/v2/opensbi.nix +++ b/starfive/visionfive/v2/opensbi.nix @@ -1,14 +1,13 @@ -{ opensbi, withPayload, withFDT }: +{ opensbi }: -(opensbi.override { - inherit withPayload withFDT; -}).overrideAttrs (attrs: { +opensbi.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 + # Also matches u-boot documentation: https://docs.u-boot.org/en/latest/board/starfive/visionfive2.html "FW_TEXT_START=0x40000000" + "FW_OPTIONS=0" ]; }) - From 637fba094214ce2e3ea71c1c2e73d1a2ba95bfd1 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Sun, 31 Dec 2023 22:43:55 -0500 Subject: [PATCH 39/41] starfive visionfive2: use upstream u-boot v2024.01-rc5 --- starfive/visionfive/v2/uboot.nix | 34 +++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/starfive/visionfive/v2/uboot.nix b/starfive/visionfive/v2/uboot.nix index a149f8b..c9fde3d 100644 --- a/starfive/visionfive/v2/uboot.nix +++ b/starfive/visionfive/v2/uboot.nix @@ -1,20 +1,36 @@ -{ fetchFromGitHub, buildUBoot }: +{ lib +, fetchFromGitHub +, buildUBoot +, buildPackages +, opensbi +}: buildUBoot rec { - version = "5.10.3"; + version = "2024.01-rc5"; src = fetchFromGitHub { - owner = "starfive-tech"; + owner = "u-boot"; repo = "u-boot"; - rev = "refs/tags/JH7110_VF2_6.1_v${version}"; - hash = "sha256-4E/AxPCFCluwJBEf6xGuxAi1hPZK5ZxEs5WlBVVfvYE="; + rev = "refs/tags/v${version}"; + hash = "sha256-QlwgvnSaXh39z9AM7HNF731lRiUkPbN3oQyioQNTYFA="; }; + # workaround for https://github.com/NixOS/nixpkgs/pull/146634 + # uboot: only apply raspberry pi patches to raspberry pi builds + patches = [ ]; + + extraMakeFlags = [ + # workaround for https://github.com/NixOS/nixpkgs/pull/277997 + # buildUBoot: specify absolute path of dtc, fix building u-boot 2023.10+ + "DTC=${lib.getExe buildPackages.dtc}" + + "OPENSBI=${opensbi}/share/opensbi/lp64/generic/firmware/fw_dynamic.bin" + ]; + defconfig = "starfive_visionfive2_defconfig"; + filesToInstall = [ - "u-boot.bin" - "arch/riscv/dts/starfive_visionfive2.dtb" - "spl/u-boot-spl.bin" - "tools/mkimage" + "spl/u-boot-spl.bin.normal.out" + "u-boot.itb" ]; } From dd78777e1275a646a214e66f9b9157d304250030 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Sun, 31 Dec 2023 22:50:15 -0500 Subject: [PATCH 40/41] starfive visionfive2: rework firmware build/update scripts --- starfive/visionfive/v2/firmware.nix | 76 +++++------------------------ starfive/visionfive/v2/sd-image.nix | 4 +- 2 files changed, 14 insertions(+), 66 deletions(-) diff --git a/starfive/visionfive/v2/firmware.nix b/starfive/visionfive/v2/firmware.nix index 03c7707..710576d 100644 --- a/starfive/visionfive/v2/firmware.nix +++ b/starfive/visionfive/v2/firmware.nix @@ -1,78 +1,26 @@ -{ callPackage, pkgsBuildHost, writeText, writeShellApplication -, stdenv, dtc, mtdutils, coreutils }: -let - uboot = callPackage ./uboot.nix { }; - opensbi = callPackage ./opensbi.nix { - withPayload = "${uboot}/u-boot.bin"; - withFDT = "${uboot}/starfive_visionfive2.dtb"; - }; - spl-tool = pkgsBuildHost.callPackage ./spl-tool.nix { }; - its-file = writeText "visionfive2-uboot-fit-image.its" '' - /dts-v1/; +{ callPackage +, writeShellApplication +, stdenv +, mtdutils +}: - / { - description = "U-boot-spl FIT image for JH7110 VisionFive2"; - #address-cells = <2>; - - images { - firmware { - description = "u-boot"; - data = /incbin/("${opensbi}/share/opensbi/lp64/generic/firmware/fw_payload.bin"); - type = "firmware"; - arch = "riscv"; - os = "u-boot"; - load = <0x0 0x40000000>; - entry = <0x0 0x40000000>; - compression = "none"; - }; - }; - - configurations { - default = "config-1"; - - config-1 { - description = "U-boot-spl FIT config for JH7110 VisionFive2"; - firmware = "firmware"; - }; - }; - }; - ''; -in rec { - inherit opensbi uboot; - spl = stdenv.mkDerivation { - name = "starfive-visionfive2-spl"; - depsBuildBuild = [ spl-tool ]; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/share/starfive-visionfive2/ - ln -s ${uboot}/u-boot-spl.bin . - spl_tool -c -f ./u-boot-spl.bin - cp u-boot-spl.bin.normal.out $out/share/starfive-visionfive2/spl.bin - ''; - }; - uboot-fit-image = stdenv.mkDerivation { - name = "starfive-visionfive2-uboot-fit-image"; - nativeBuildInputs = [ dtc ]; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/share/starfive-visionfive2/ - ${uboot}/mkimage -f ${its-file} -A riscv -O u-boot -T firmware $out/share/starfive-visionfive2/visionfive2_fw_payload.img - ''; - }; +rec { + opensbi = callPackage ./opensbi.nix { }; + uboot = callPackage ./uboot.nix { inherit opensbi; }; updater-flash = writeShellApplication { name = "visionfive2-firmware-update-flash"; runtimeInputs = [ mtdutils ]; text = '' - flashcp -v ${spl}/share/starfive-visionfive2/spl.bin /dev/mtd0 - flashcp -v ${uboot-fit-image}/share/starfive-visionfive2/visionfive2_fw_payload.img /dev/mtd1 + flashcp -v ${uboot}/u-boot-spl.bin.normal.out /dev/mtd0 + flashcp -v ${uboot}/u-boot.itb /dev/mtd1 ''; }; updater-sd = writeShellApplication { name = "visionfive2-firmware-update-sd"; runtimeInputs = [ ]; text = '' - dd if=${spl}/share/starfive-visionfive2/spl.bin of=/dev/mmcblk0p1 conv=fsync - dd if=${uboot-fit-image}/share/starfive-visionfive2/visionfive2_fw_payload.img of=/dev/mmcblk0p2 conv=fsync + dd if=${uboot}/u-boot-spl.bin.normal.out of=/dev/mmcblk0p1 conv=fsync + dd if=${uboot}/u-boot.itb of=/dev/mmcblk0p2 conv=fsync ''; }; } diff --git a/starfive/visionfive/v2/sd-image.nix b/starfive/visionfive/v2/sd-image.nix index 79bb6f3..7c30f9c 100644 --- a/starfive/visionfive/v2/sd-image.nix +++ b/starfive/visionfive/v2/sd-image.nix @@ -36,10 +36,10 @@ in { EOF eval $(partx $img -o START,SECTORS --nr 1 --pairs) - dd conv=notrunc if=${firmware.spl}/share/starfive-visionfive2/spl.bin of=$img seek=$START count=$SECTORS + dd conv=notrunc if=${firmware.uboot}/u-boot-spl.bin.normal.out of=$img seek=$START count=$SECTORS eval $(partx $img -o START,SECTORS --nr 2 --pairs) - dd conv=notrunc if=${firmware.uboot-fit-image}/share/starfive-visionfive2/visionfive2_fw_payload.img of=$img seek=$START count=$SECTORS + dd conv=notrunc if=${firmware.uboot}/u-boot.itb of=$img seek=$START count=$SECTORS ''; populateRootCommands = '' From 8e34f33464d77bea2d5cf7dc1066647b1ad2b324 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Mon, 1 Jan 2024 13:15:08 -0500 Subject: [PATCH 41/41] starfive visionfive2: write u-boot.itb to mtd2 --- starfive/visionfive/v2/firmware.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starfive/visionfive/v2/firmware.nix b/starfive/visionfive/v2/firmware.nix index 710576d..eabeb6c 100644 --- a/starfive/visionfive/v2/firmware.nix +++ b/starfive/visionfive/v2/firmware.nix @@ -12,7 +12,7 @@ rec { runtimeInputs = [ mtdutils ]; text = '' flashcp -v ${uboot}/u-boot-spl.bin.normal.out /dev/mtd0 - flashcp -v ${uboot}/u-boot.itb /dev/mtd1 + flashcp -v ${uboot}/u-boot.itb /dev/mtd2 ''; }; updater-sd = writeShellApplication {