summaryrefslogtreecommitdiff
path: root/hosts/akashi/hardware-configuration.nix
blob: f06ef10c33c1d209afb9a99f1ad1fe23905ba982 (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
{
  config,
  lib,
  modulesPath,
  ...
}:
let
  nixosDevice = "/dev/disk/by-uuid/78655110-4037-4b06-9407-f155c595c3a3";

  commonBtrfsOptions = [
    "compress-force=zstd:1"
    "noatime"
    "discard=async"
    "space_cache=v2"
  ];
in
{
  imports = [
    (modulesPath + "/installer/scan/not-detected.nix")
  ];

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

  boot = {
    kernelModules = [ "kvm-amd" ];
    extraModulePackages = [ ];

    initrd = {
      kernelModules = [ ];

      availableKernelModules = [
        "nvme"
        "xhci_pci"
        "ahci"
        "usb_storage"
        "sd_mod"
        "rtsx_usb_sdmmc"
      ];
    };
  };

  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/5B1D-BD89";
      fsType = "vfat";

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