# Custom kernel for display output on Pinebook Pro

**URL:** https://discourse.nixos.org/t/custom-kernel-for-display-output-on-pinebook-pro/68061
**Category:** Help
**Created:** [August 16, 2025, 10:17pm UTC](https://discourse.nixos.org/t/custom-kernel-for-display-output-on-pinebook-pro/68061 "2025-08-16T22:17:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ElwoodSoup](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/e/ee7513/32.png) [@ElwoodSoup](https://discourse.nixos.org/u/ElwoodSoup)
#### Post date: [August 16, 2025, 10:17pm UTC](https://discourse.nixos.org/t/custom-kernel-for-display-output-on-pinebook-pro/68061/1 "2025-08-16T22:17:20Z")

</div>

I’m fairly new to NixOS, and I really don’t mess with custom kernels often, so forgive my ignorance here.

I just bought a Pinebook Pro, which is in the unfortunate situation of having it’s DisplayPort-over-USB-C support broken in the mainline kernel.

I have NixOS installed with KDE, and I’m trying to follow the directions on the nixos-hardware README about using Manjaro’s kernel.

[https://github.com/NixOS/nixos-hardware/blob/3dac8a872557e0ca8c083cdcfc2f218d18e113b0/pine64/pinebook-pro/README.md](https://github.com/NixOS/nixos-hardware/blob/master/pine64/pinebook-pro/README.md)

However, all it seems like the expression is doing is using a version of the kernel from 2022, presumably before the display support was regressed. I’d still be willing to give it a shot, but I can’t help but think running 2025’s KDE Plasma 6 on a 2022 kernel wouldn’t work.

Either way, I’m getting an error from nixos-rebuild about unstable-manjaro-kernel being an undefined variable. So I don’t think I’m configuring it correctly to begin with.

I’ve also seen people talk about using this kernel fork on the Pine64 forums, but I’m definitely not capable of building a kernel for NixOS, and the prebuilt binaries seem like they’re specifically for Manjaro.

[https://codeberg.org/megi/linux](https://codeberg.org/megi/linux)

Any ideas on where I can go from here would be appreciated.

---

<div class="post-metadata">

### Author: ![waffle8946](https://discourse.nixos.org/user_avatar/discourse.nixos.org/waffle8946/32/27221_2.png) [@waffle8946](https://discourse.nixos.org/u/waffle8946)
#### Post date: [August 17, 2025, 3:17pm UTC](https://discourse.nixos.org/t/custom-kernel-for-display-output-on-pinebook-pro/68061/2 "2025-08-17T15:17:42Z")

</div>

> [@ElwoodSoup](#):
>
> However, all it seems like the expression is doing is using a version of the kernel from 2022,

No, it’s introducing some patches.

> <https://github.com/NixOS/nixos-hardware/blob/6d1bd5bc2e8b9992a3f57e416ba50fbed5516db6/pine64/pinebook-pro/kernel/default.nix#L14-L35>

The kernel version is pinned so that the patches are guaranteed to apply, but you definitely don’t want to use an unmaintained kernel for security reasons.

Unfortunately the patches were removed, re-added with new names, and removed again: [https://gitlab.manjaro.org/manjaro-arm/packages/core/linux/-/commit/beef9ab3ef03248e12e78912679933579db720aa?page=12](https://gitlab.manjaro.org/manjaro-arm/packages/core/linux/-/commit/beef9ab3ef03248e12e78912679933579db720aa?page=12)

So you’re likely on your own in terms of figuring out how to get these patches to work with current kernels.

> [@ElwoodSoup](#):
>
> I’m getting an error from nixos-rebuild about unstable-manjaro-kernel being an undefined variable

The nixos-hardware code is wrong, not your fault. It should be using `manjaro-kernel` per _its own code_. But again - that code won’t work now because 5.16 has long been removed from nixpkgs, for security reasons.

The patches mentioned in [Add back DP alt mode patches for Pinebook Pro (c155cbef) · Commits · manjaro-arm / packages / core / linux · GitLab](https://gitlab.manjaro.org/manjaro-arm/packages/core/linux/-/commit/c155cbefdbc34b635e2e878c0742a75f18c669c7) should apply cleanly against the 6.1 LTS kernel (as that’s the minor version they were targeting), so you may get success with that.

It _may_ be as simple as

```nix
boot.kernelPackages = let ... in pkgs.linuxKernel.kernels.linux_6_1.override {
    argsOverride = rec {
      kernelPatches = map create-patch patches;
    };
  });

```

(of course including the `create-patch`, `patches`, and `manjaro-patches` bits in that `let` block, using `pkgs` instead of `pinnedNixpkgs`, adjusting the names/commits/hashes correctly)

but I can’t guarantee that as I don’t have such a system. (Not sure if `argsOverride` is even the current standard for kernel overrides.)

---

<div class="post-metadata">

### Author: ![ElwoodSoup](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/e/ee7513/32.png) [@ElwoodSoup](https://discourse.nixos.org/u/ElwoodSoup)
#### Post date: [August 17, 2025, 9:39pm UTC](https://discourse.nixos.org/t/custom-kernel-for-display-output-on-pinebook-pro/68061/3 "2025-08-17T21:39:37Z")

</div>

Thanks for the help! I think I’m tracking you, for the most part.

So the goal here would be to use the most recent kernel from Nix that I can, while applying the patches from the Manjaro kernel (the versions re-added later).

I’ll try and see if I can get away with using v6.6 instead of 6.1 like you suggested, since those patches seem to have been applied as late as 6.8. Let me know if I’m misunderstanding that.

I now have the following code in my configuration.nix

```auto
boot.kernelPackages = let

    patches = [
      "4001-arm64-dts-rk3399-pinebook-pro-Fix-USB-PD-charging.patch"
      "4002-arm64-dts-rk3399-pinebook-pro-Improve-Type-C-support-on-Pinebook-Pro.patch"
      "4003-arm64-dts-rk3399-pinebook-pro-Remove-redundant-pinctrl-properties-from-edp.patch"
      "4004-arm64-dts-rk3399-pinebook-pro-Remove-unused-features.patch"
      "4005-arm64-dts-rk3399-pinebook-pro-Dont-allow-usb2-phy-driver-to-update-USB-role.patch"
      "4006-arm64-dts-rockchip-rk3399-pinebook-pro-Support-both-Type-C-plug-orientations.patch"
      "4007-ASoC-codec-es8316-DAC-Soft-Ramp-Rate-is-just-a-2-bit-control.patch"
      "4008-arm64-dts-rk3399-pinebook-pro-Fix-codec-frequency-after-boot.patch"
    ];

    manjaro-patches = pkgs.fetchgit {
      url = "https://gitlab.manjaro.org/manjaro-arm/packages/core/linux.git";
      rev = "6bb0224e8603bd574458eb79f8030dc05e0d478f";
    };

    create-patch = p: {
      name = p;
      patch = "${manjaro-patches}/${p}";
    };

  in pkgs.linuxKernel.kernels.linux_6_6.override {
      argsOverride = rec {
        kernelPatches = map create-patch patches;
      };
  };

```

And I’m now getting the following error from nix-rebuild:

```auto
error:
       … while calling the 'head' builtin
         at /nix/store/vplppc314kw26jgf4abhxns52j4j2dxf-nixos/nixos/lib/attrsets.nix:1544:13:
         1543| if length values == 1 || pred here (elemAt values 1) (head values) then
         1544| head values
             | ^
         1545| else

       … while evaluating the attribute 'value'
         at /nix/store/vplppc314kw26jgf4abhxns52j4j2dxf-nixos/nixos/lib/modules.nix:1118:7:
         1117| // {
         1118| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             | ^
         1119| inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/store/vplppc314kw26jgf4abhxns52j4j2dxf-nixos/nixos/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `assertions':

       … while evaluating definitions from `/nix/store/vplppc314kw26jgf4abhxns52j4j2dxf-nixos/nixos/nixos/modules/system/boot/kernel.nix':

       … while evaluating the option `boot.kernelPackages':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: attribute 'extend' missing
       at /nix/store/vplppc314kw26jgf4abhxns52j4j2dxf-nixos/nixos/nixos/modules/system/boot/kernel.nix:65:9:
           64| kernelPackages:
           65| kernelPackages.extend (
             | ^
           66| self: super: {
Command 'nix-build '<nixpkgs/nixos>' --attr config.system.build.toplevel --no-out-link' returned non-zero exit status 1.

```

None of which is actually referring to my file, so I’m a little lost at this point lol.

I also happened to come across this page in my search, which mentions offhand that Mobile NixOS uses Megi’s kernel:

[https://github.com/sergei-mironov/mobile-nixos-cfg](https://github.com/sergei-mironov/mobile-nixos-cfg)

Ideally, wouldn’t it be better to just use the current release of Megi’s kernel fork instead of an old version of the mainline kernel with old Manjaro patches that Megi used to maintain?

Or am I underestimating how much of a project that would be to configure?
