summaryrefslogtreecommitdiff
path: root/os/cez/hardware-configuration.nix
blob: 0cb3b73ac41363b4ffd8f35e3d6c0023dcb1a90d (plain) (blame)
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
{ modulesPath, nixos-hardware, lib, ... }:

{
  imports = [
    nixos-hardware.nixosModules.lenovo-ideapad-16ach6
    (modulesPath + "/installer/scan/not-detected.nix")
  ];

  # override nixos-hardware values
  hardware.nvidia.prime.offload.enable = false;
  hardware.amdgpu.initrd.enable = false;
  services.xserver.videoDrivers = [ "modesetting" ];

  specialisation.nvidia.configuration = {
    environment.variables = {
      DRI_PRIME = 1;
      __NV_PRIME_RENDER_OFFLOAD = 1;
      __VK_LAYER_NV_optimus = "NVIDIA_only";
      __GLX_VENDOR_LIBRARY_NAME = "nvidia";
    };

    hardware.nvidia = {
      open = true;
      nvidiaSettings = false;
      prime.sync.enable = true;
    };

    services = {
      xserver.videoDrivers = [ "nvidia" ];
      tlp.settings.PLATFORM_PROFILE_ON_AC = lib.mkForce "performance";
    };
    nixpkgs.config.allowUnfreePredicate =
      pkg: builtins.elem (lib.getName pkg) [ "nvidia-x11" ];
  };

  boot = {
    loader.systemd-boot.enable = true;

    initrd = {
      systemd.enable = true;
      luks.devices."crypt".device =
        "/dev/disk/by-uuid/84acd784-caad-41a1-a2e4-39468d01fefd";
    };
  };

  fileSystems = {
    "/boot" = {
      device = "/dev/disk/by-uuid/E37E-F611";
      fsType = "vfat";
    };
    "/" = {
      device = "/dev/disk/by-uuid/e063c9ad-b48f-4b6c-b94e-4c21d2238bce";
      fsType = "ext4";
    };
  };
}