summaryrefslogtreecommitdiff
path: root/hosts/kansai/hardware-configuration.nix
blob: 58c86c4dfd22a536c2a1c6e00f110a6e5b4ffcae (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
{
  config,
  lib,
  modulesPath,
  self,
  ...
}:
let
  nixosDevice = "/dev/disk/by-uuid/59148bdd-ecb1-49a0-beec-89d0adf909ae";

  commonOptions = [
    "noatime"
  ];

  commonBtrfsOptions = [
    "compress-force=zstd:1"
    "discard=async"
    "space_cache=v2"
    "ssd"
  ] ++ commonOptions;
in
{
  imports = [
    (modulesPath + "/installer/scan/not-detected.nix")
    (import "${self}/hosts/shared/hardware-configuration.nix")
  ];

  config = {
    boot = {
      initrd = {
        availableKernelModules = [
          "nvme"
          "xhci_pci"
          "ahci"
          "usb_storage"
          "usbhid"
          "sd_mod"
        ];

        kernelModules = [ ];
      };

      kernelModules = [ "kvm-amd" ];
      extraModulePackages = [ ];
    };

    fileSystems = {
      "/" = {
        device = nixosDevice;
        fsType = "btrfs";
        options = commonBtrfsOptions ++ [ "subvol=@" ];
      };

      "/home" = {
        device = nixosDevice;
        fsType = "btrfs";
        options = commonBtrfsOptions ++ [ "subvol=@home" ];
      };

      "/var" = {
        device = nixosDevice;
        fsType = "btrfs";
        options = commonBtrfsOptions ++ [ "subvol=@var" ];
      };

      "/nix" = {
        device = nixosDevice;
        fsType = "btrfs";
        options = commonBtrfsOptions ++ [ "subvol=@nix" ];
      };

      "/boot" = {
        device = "/dev/disk/by-uuid/C675-43E1";
        fsType = "vfat";

        options = [
          "fmask=0022"
          "dmask=0022"
        ];
      };
    };

    modules.mounts.plex = {
      enable = true;
      extraOptions = commonOptions;
    };

    networking = {
      useDHCP = lib.mkDefault true;

      interfaces = {
        enp42s0.wakeOnLan.enable = true;
        wlan0.wakeOnLan.enable = true;
      };
    };

    swapDevices = [ ];
    nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
    hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
  };
}