about summary refs log tree commit diff
path: root/users/grfn/system/system/machines/yeren.nix
blob: 228631c8cc6f2e975e0e7a8013d17821201de01e (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
{ depot, modulesPath, config, lib, pkgs, ... }:

{
  imports = [
    (modulesPath + "/installer/scan/not-detected.nix")
    ../modules/common.nix
    ../modules/laptop.nix
    ../modules/xserver.nix
    ../modules/fonts.nix
    ../modules/sound.nix
    ../modules/tvl.nix
    ../modules/development.nix
    ../modules/work/kolide.nix
  ];

  networking.hostName = "yeren";

  system.stateVersion = "21.03";

  boot = {
    initrd = {
      availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
      kernelModules = [ ];

      luks.devices = {
        "cryptroot".device = "/dev/disk/by-uuid/dcfbc22d-e0d2-411b-8dd3-96704d3aae2e";
      };
    };

    kernelPackages = pkgs.linuxPackages_5_15;

    kernelModules = [ "kvm-intel" ];
    blacklistedKernelModules = [ "psmouse" ];
    extraModulePackages = [
      config.boot.kernelPackages.digimend
    ];
    kernelParams = [
      "i915.preliminary_hw_support=1"
      "pcie_aspm=force"
    ];

    # https://bbs.archlinux.org/viewtopic.php?pid=1933643#p1933643
    extraModprobeConfig = ''
      options snd-intel-dspcfg dsp_driver=1
    '';

    kernel.sysctl = {
      "kernel.perf_event_paranoid" = -1;
    };
  };

  fileSystems = {
    "/" = {
      device = "/dev/mapper/cryptroot";
      fsType = "btrfs";
    };

    "/boot" = {
      device = "/dev/disk/by-uuid/53A9-248B";
      fsType = "vfat";
    };
  };

  swapDevices = [{
    device = "/dev/disk/by-uuid/b627cb0e-0451-4f25-94d0-6497e01f0da4";
  }];

  services.earlyoom = {
    enable = true;
    freeMemThreshold = 5;
  };

  services.xserver = {
    exportConfiguration = true;
    extraConfig = ''
      Section "Device"
        Identifier  "Intel Graphics"
        Driver      "intel"
        Option      "TripleBuffer" "true"
        Option      "TearFree"     "true"
        Option      "DRI"          "true"
        Option      "AccelMethod"  "sna"
      EndSection
    '';
  };

  hardware.firmware = with pkgs; [
    alsa-firmware
    sof-firmware
  ];

  hardware.opengl.extraPackages = with pkgs; [
    vaapiIntel
    vaapiVdpau
    libvdpau-va-gl
    intel-media-driver
  ];

  # Disabled for now until libfprint-tod can get a version bump
  # services.fprintd = {
  #   enable = true;
  #   package = pkgs.fprintd-tod;
  # };

  systemd.services.fprintd.environment.FP_TOD_DRIVERS_DIR =
    "${pkgs.libfprint-2-tod1-goodix}/usr/lib/libfprint-2/tod-1";

  security.pam.loginLimits = [
    {
      domain = "grfn";
      type = "soft";
      item = "nofile";
      value = "65535";
    }
  ];

  security.pam.services = {
    login.fprintAuth = true;
    sudo.fprintAuth = true;
    i3lock.fprintAuth = false;
    i3lock-color.fprintAuth = false;
    lightdm.fprintAuth = true;
    lightdm-greeter.fprintAuth = true;
  };

  hardware.opengl.driSupport32Bit = true;

  hardware.pulseaudio.extraConfig = ''
    load-module module-remap-source source_name=KompleteAudio6_1 source_properties=device.description=KompleteAudio6Input1 master=alsa_input.usb-Native_Instruments_Komplete_Audio_6_458E0FFD-00.multichannel-input remix=no channels=1 master_channel_map=front-left channel_map=mono
    load-module module-remap-source source_name=KompleteAudio6_2 source_properties=device.description=KompleteAudio6Input2 master=alsa_input.usb-Native_Instruments_Komplete_Audio_6_458E0FFD-00.multichannel-input remix=no channels=1 master_channel_map=front-right channel_map=mono
    load-module module-remap-sink sink_name=KompleteAudio6_12 sink_properties=device.description=KompleteAudio6_12 remix=no master=alsa_output.usb-Native_Instruments_Komplete_Audio_6_458E0FFD-00.analog-surround-21 channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right
  '';

  services.fwupd.enable = true;

  services.tailscale.enable = true;
}