about summary refs log tree commit diff
path: root/users/aspen/system/system/machines/lusca.nix
blob: 4a9202187dd0668bf2cf7b1722f88b715220b0bf (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
138
139
140
141
142
143
{ 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/prometheus-exporter.nix
  ];

  networking.hostName = "lusca";

  system.stateVersion = "24.05";

  time.timeZone = "America/New_York";

  services.avahi = {
    enable = true;
    nssmdns4 = true;
  };

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

      luks.devices."cryptroot".device =
        "/dev/disk/by-uuid/9e525746-5bca-4451-8710-a6f0e09b751c";
    };

    kernelModules = [ "kvm-amd" ];

    kernelParams = [
      "resume=LABEL=SWAP"
      "resume_offset=795904" # sudo btrfs inspect-internal map-swapfile -r /swap/swapfile
    ];

    resumeDevice = "/dev/disk/by-uuid/4c099cee-8d42-49c1-916c-62a0b5effbd2";

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

  hardware.cpu.amd.updateMicrocode =
    lib.mkDefault config.hardware.enableRedistributableFirmware;

  fileSystems = {
    "/" = {
      device = "/dev/disk/by-uuid/4c099cee-8d42-49c1-916c-62a0b5effbd2";
      fsType = "btrfs";
      options = [ "subvol=root" ];
    };

    "/home" = {
      device = "/dev/disk/by-uuid/4c099cee-8d42-49c1-916c-62a0b5effbd2";
      fsType = "btrfs";
      options = [ "subvol=home" ];
    };

    "/nix" = {
      device = "/dev/disk/by-uuid/4c099cee-8d42-49c1-916c-62a0b5effbd2";
      fsType = "btrfs";
      options = [ "subvol=nix" ];
    };

    "/swap" = {
      device = "/dev/disk/by-uuid/4c099cee-8d42-49c1-916c-62a0b5effbd2";
      fsType = "btrfs";
      options = [ "subvol=swap" ];
    };

    "/boot" = {
      device = "/dev/disk/by-uuid/0E7D-3C3F";
      fsType = "vfat";
    };
  };

  swapDevices = [{ device = "/swap/swapfile"; }];

  systemd.sleep.extraConfig = ''
    HibernateDelaySec=30m
    SuspendState=mem
  '';

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

  services.tailscale.enable = true;

  services.fwupd = {
    enable = true;
    extraRemotes = [ "lvfs-testing" ];
  };

  services.tlp.enable = lib.mkForce false;
  services.power-profiles-daemon.enable = true;

  services.thermald.enable = true;

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

  security.polkit.extraConfig = ''
    polkit.addRule(function(action, subject) {
      if (action.id.indexOf("net.reactivated.fprint.") == 0 || action.id.indexOf("net.reactivated.Fprint.") == 0) {
          polkit.log("action=" + action);
          polkit.log("subject=" + subject);
          return polkit.Result.YES;
      }
    });
  '';

  services.udev.extraRules = ''
    # Ethernet expansion card support
    ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8156", ATTR{power/autosuspend}="20"
  '';

  hardware.sensor.iio.enable = true;

  hardware.graphics.enable32Bit = true;

  # TPM
  security.tpm2 = {
    enable = true;
    pkcs11.enable = true;
    tctiEnvironment.enable = true;
  };
  users.users.aspen.extraGroups = [ "tss" ];
}