summaryrefslogtreecommitdiff
path: root/hosts/sif/hw.nix
blob: a2991def3a8fb526a2d3091950e19a7844f12d13 (plain)
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
{ config, lib, pkgs, utils, ... }:

{
  fileSystems = {
    "/boot" =
      { label = "boot";
        fsType = "vfat";
        options = [ "fmask=0033" "dmask=0022" ];
      };
    # "/.bcachefs" =
    #   { device = "/dev/mapper/sif-nvm0:/dev/mapper/sif-nvm1";
    #     fsType = "bcachefs";
    #     neededForBoot = true;
    #   };
    "/nix" =
      { device = "/.bcachefs/nix";
        fsType = "none";
        options = [ "bind" "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" ];
      };
    "/root" =
      { device = "/.bcachefs/root";
        fsType = "none";
        options = [ "bind" ];
      };
    "/var/log" =
      { device = "/.bcachefs/var/log";
        fsType = "none";
        options = [ "bind" "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" ];
      };
    "/var/lib/sops-nix" =
      { device = "/.bcachefs/var/lib/sops-nix";
        fsType = "none";
        options = [ "bind" "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" ];
        neededForBoot = true;
      };
    "/var/lib/nixos" =
      { device = "/.bcachefs/var/lib/nixos";
        fsType = "none";
        options = [ "bind" "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" ];
      };
    "/var/lib/chrony" =
      { device = "/.bcachefs/var/lib/chrony";
        fsType = "none";
        options = [ "bind" ];
      };
    "/var/lib/fprint" =
      { device = "/.bcachefs/var/lib/fprint";
        fsType = "none";
        options = [ "bind" ];
      };
    "/var/lib/systemd" =
      { device = "/.bcachefs/var/lib/systemd";
        fsType = "none";
        options = [ "bind" "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" ];
        neededForBoot = true;
      };
    "/home" =
      { device = "/.bcachefs/home";
        fsType = "none";
        options = [ "bind" ];
      };
    "/etc/NetworkManager/system-connections" =
      { device = "/.bcachefs/etc/NetworkManager/system-connections";
        fsType = "none";
        options = [ "bind" ];
      };
  };

  boot.initrd.supportedFilesystems.bcachefs = true;
  boot.initrd.systemd.units."dev-sif-nvm0:-dev-sif-nvm1.device".enable = false;
  systemd.units."dev-sif-nvm0:-dev-sif-nvm1.device".enable = false;
  boot.initrd.systemd.services."bcachefs" = {
    before = [ "initrd-fs.target" ];
    after = [ "local-fs-pre.target"  "dev-sif-nvm0.device" "dev-sif-nvm1.device" ];
    requires = [ "dev-sif-nvm0.device" "dev-sif-nvm1.device"  ];
    wantedBy = [ "initrd-fs.target" ];
    unitConfig = {
      DefaultDependencies = false;
      StopPropagatedFrom = [ "dev-sif-nvm0.device" "dev-sif-nvm1.device"  ];
    };
    serviceConfig = {
      Type = "oneshot";
      ExecStart = "/bin/mount -o X-mount.mkdir -t bcachefs /dev/sif/nvm0:/dev/sif/nvm1 /sysroot/.bcachefs";
      RemainAfterExit = true;
    };
  };

  swapDevices = [
    { label = "swap"; }
  ];

  nix.settings.max-jobs = 12;
  # High-DPI console
  console.font = "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";

  hardware.cpu.intel.updateMicrocode = true;

  hardware.enableRedistributableFirmware = true;
}