summaryrefslogtreecommitdiff
path: root/modules/sys/core/drivers.nix
blob: f12f6aba50a44abeb655899ea454ae7ddd1c4988 (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
53
54
55
56
{ config, lib, pkgs, ... }:
{
  options.szpont.drivers = {
    enable = lib.mkEnableOption "enables hardware drivers";

    amd.enable = lib.mkEnableOption "AMD specific drivers and microcode";

    stability = lib.mkOption {
      type = lib.types.enum [ "stable" "unstable" ];
      default = "stable";
    };
  };

  config = lib.mkMerge [
    {
      services.smartd.enable = true;
      hardware = {
        sensor.iio.enable = true;

        enableRedistributableFirmware = true;
        graphics = {
          enable = true;
          enable32Bit = true;
        };
      };
    }

    (lib.mkIf config.szpont.drivers.amd.enable (lib.mkMerge [
      {
        services.xserver.videoDrivers = [ "amdgpu" ];
        hardware = {
          cpu.amd.updateMicrocode = true;
          amdgpu = {
            initrd.enable = true;
            overdrive.enable = true;
          };
        };
      }

      (lib.mkIf (config.szpont.drivers.stability == "unstable") {
        services.lact.enable = true;

        boot.kernelPackages = pkgs.linuxPackages_cachyos-lto-znver4;
        chaotic.mesa-git = {
          enable = true;
          fallbackSpecialisation = false;
          extraPackages = [ pkgs.mesa_git.opencl ];
        };
      })

      (lib.mkIf (config.szpont.drivers.stability == "stable") {
        boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
      })
    ]))
  ];
}