about summary refs log tree commit diff
path: root/nixos/modules/apple-silicon-support/modules/kernel/edge.nix
blob: 9137e3bb9673813cd8d2557b3c35c0ee952bb085 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# the Asahi Linux edge config and options that must go along with it

{ config, pkgs, lib, ... }:
{
  config = lib.mkIf config.hardware.asahi.addEdgeKernelConfig {
    boot.kernelPatches = [
      {
        name = "edge-config";
        patch = null;
        # derived from
        # https://github.com/AsahiLinux/PKGBUILDs/blob/stable/linux-asahi/config.edge
        extraConfig = ''
          DRM_SIMPLEDRM_BACKLIGHT n
          BACKLIGHT_GPIO n
          DRM_APPLE m
          APPLE_SMC m
          APPLE_SMC_RTKIT m
          APPLE_RTKIT m
          APPLE_MAILBOX m
          GPIO_MACSMC m
          DRM_VGEM n
          DRM_SCHED y
          DRM_GEM_SHMEM_HELPER y
          DRM_ASAHI m
          SUSPEND y
        '';
      }
    ];

    # required for proper DRM setup even without GPU driver
    services.xserver.config = ''
      Section "OutputClass"
          Identifier "appledrm"
          MatchDriver "apple"
          Driver "modesetting"
          Option "PrimaryGPU" "true"
      EndSection
    '';

    # required for edge drivers
    hardware.asahi.withRust = true;
  };

  options.hardware.asahi.addEdgeKernelConfig = lib.mkOption {
    type = lib.types.bool;
    default = false;
    description = ''
      Build the Asahi Linux kernel with additional experimental "edge"
      configuration options.
    '';
  };
}