From 5a4384c71b09dea1eca4832122c898e7805ac8db Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Tue, 20 Feb 2024 08:43:19 -0500 Subject: [PATCH] enable kernel selection support --- .forgejo/workflows/build.yaml | 2 +- module.nix | 19 ++++++++++++++++- npins/sources.json | 14 ++++++++++++- packages/default.nix | 39 ++++++++++++++--------------------- 4 files changed, 47 insertions(+), 27 deletions(-) diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index 36a5066..17d39d9 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -16,7 +16,7 @@ jobs: - name: build all run: | - OUTPUT=$(nix build --print-out-paths .#x13s/linux .#x13s/alsa-ucm-conf .#pd-mapper .#x13s/extra-firmware) + OUTPUT=$(nix build --print-out-paths .#linux_jhovold .#linux_steev .#x13s/alsa-ucm-conf .#pd-mapper .#x13s/extra-firmware) echo $OUTPUT echo "$OUTPUT" > build.out diff --git a/module.nix b/module.nix index 09c92aa..c11c490 100644 --- a/module.nix +++ b/module.nix @@ -10,7 +10,14 @@ let x13sPackages = import ./packages/default.nix { inherit lib pkgs; }; dtbName = "sc8280xp-lenovo-thinkpad-x13s.dtb"; - linuxPackages_x13s = pkgs.linuxPackagesFor x13sPackages."x13s/linux"; + linuxPackages_x13s = pkgs.linuxPackagesFor ( + if cfg.kernel == "jhovold" then + x13sPackages.linux_jhovold + else if cfg.kernel == "steev" then + x13sPackages.linux_steev + else + pkgs.linuxPackages_latest + ); dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/${dtbName}"; alsa-ucm-conf-env.ALSA_CONFIG_UCM2 = "${x13sPackages."x13s/alsa-ucm-conf"}/share/alsa/ucm2"; @@ -23,6 +30,16 @@ in type = lib.types.str; description = "mac address to set on boot"; }; + + kernel = lib.mkOption { + type = lib.types.enum [ + "jhovold" + "mainline" + "steev" + ]; + description = "which patched kernel to use. jhovold is the latest RC, steev is the latest patched release, and mainline is nixos latest"; + default = "jhovold"; + }; }; config = lib.mkIf cfg.enable { diff --git a/npins/sources.json b/npins/sources.json index 36903a0..06355e7 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -14,7 +14,7 @@ "url": "https://api.github.com/repos/alsa-project/alsa-ucm-conf/tarball/v1.2.11", "hash": "1jcn0x6bbg69p1ygxnh1zn33sd9lpbll4bnhvkzw1fjpmw7igjkz" }, - "linux": { + "linux-jhovold": { "type": "Git", "repository": { "type": "GitHub", @@ -25,6 +25,18 @@ "revision": "00a0ee0018ac61ec4c93536f27916ff40cfe7a99", "url": "https://github.com/jhovold/linux/archive/00a0ee0018ac61ec4c93536f27916ff40cfe7a99.tar.gz", "hash": "115yra3w4a0f4aprjb8n5gpq4xc8j7h3kql18z755jii5gd49qfr" + }, + "linux-steev": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "steev", + "repo": "linux" + }, + "branch": "lenovo-x13s-linux-6.7.y", + "revision": "45411854bb931cb5c989e00ded127d4fc68dfa01", + "url": "https://github.com/steev/linux/archive/45411854bb931cb5c989e00ded127d4fc68dfa01.tar.gz", + "hash": "19wa6ihmjp748vj5qqzy1kqz4bhxy4k81v90kbca9y15l6waqm6q" } }, "version": 3 diff --git a/packages/default.nix b/packages/default.nix index ddc1478..31b55d6 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -3,39 +3,30 @@ let sources = import ../npins; linux_x13s_pkg = - { buildLinux, ... }@args: - let - version = "6.8.0-rc5"; - modDirVersion = "${version}"; - in + { version, buildLinux, ... }@args: buildLinux ( args // { - inherit version modDirVersion; + modDirVersion = version; - src = sources.linux; - - kernelPatches = (args.kernelPatches or [ ]) ++ [ - # { - # # fix resets when reading EFI vars - # name = "qcom-shm-bridge-tz"; - # patch = ( - # pkgs.fetchurl { - # url = "https://lore.kernel.org/lkml/20240205182810.58382-1-brgl@bgdev.pl/t.mbox.gz"; - # hash = "sha256-MeuDkVFSf/KqzcD92wR6U9yOJhOKmZkXsgGcOm/9l/k="; - # } - # ); - # extraStructuredConfig = { - # QCOM_TZMEM_MODE_SHMBRIDGE = lib.kernel.yes; - # }; - # } - ]; + kernelPatches = (args.kernelPatches or [ ]) ++ [ ]; extraMeta.branch = lib.versions.majorMinor version; } ); in rec { - "x13s/linux" = pkgs.callPackage linux_x13s_pkg { defconfig = "johan_defconfig"; }; + linux_jhovold = pkgs.callPackage linux_x13s_pkg { + src = sources.linux-jhovold; + version = "6.8.0-rc5"; + defconfig = "johan_defconfig"; + }; + + linux_steev = pkgs.callPackage linux_x13s_pkg { + src = sources.linux-steev; + version = "6.7.5"; + defconfig = "laptop_defconfig"; + }; + "x13s/alsa-ucm-conf" = pkgs.alsa-ucm-conf.overrideAttrs ( _: { version = sources.alsa-ucm-conf.version;