]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/courge/hardware.nix
+user/perf(zswap): use zswap instead zramSwap
[julm/julm-nix.git] / hosts / courge / hardware.nix
1 {
2 pkgs,
3 lib,
4 config,
5 hostName,
6 ...
7 }:
8 with lib;
9 {
10 imports = [
11 ../../nixos/profiles/hardware/T480.nix
12 ../../nixos/profiles/zfs.nix
13 #hardware/nvidia.nix
14 ];
15
16 # Setting the machine-id avoids to reencrypt all credentials
17 # when reinstalling NixOS on a new drive.
18 # Manually generated with : uuidgen | tr -d -
19 environment.etc.machine-id.source = ./machine-id.clear;
20
21 # The 32-bit host id of the host, formatted as 8 hexadecimal characters.
22 # You should try to make this id unique among your hosts.
23 # Manually generated with : uuidgen | head -c8
24 networking.hostId = "e6eba6c4";
25
26 boot.kernelParams = [
27 #"boot.trace"
28 "boot.shell_on_fail"
29 #"boot.debug1"
30 ];
31 # Deprecated in nixos-24.11
32 #boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
33 boot.loader = {
34 efi = {
35 canTouchEfiVariables = true;
36 efiSysMountPoint = "/boot1";
37 };
38 systemd-boot = {
39 enable = true;
40 #editor = false;
41 # Roughly 25MiB (initrd) + 9MiB (kernel) per configuration
42 configurationLimit = 6;
43 memtest86.enable = true;
44 /*
45 extraInstallCommands = ''
46 rm -rf /efiboot/efi2
47 cp -r /efiboot/efi1 /efiboot/efi2
48 '';
49 */
50 # FIXME: needs https://github.com/NixOS/nixpkgs/pull/246897
51 #mirroredBoots = [ ];
52 };
53 };
54 boot.zfs.requestEncryptionCredentials = [ "${hostName}/root" ];
55
56 hardware.enableRedistributableFirmware = true;
57 # Disable IR camera
58 services.udev.extraRules = ''
59 ACTION=="add", ATTRS{idVendor}=="5986", ATTRS{idProduct}=="1141", RUN="${pkgs.runtimeShell} -c 'echo 1 >/sys$devpath/remove'"
60 '';
61
62 fileSystems."/boot1" = {
63 device = "/dev/disk/by-partlabel/${hostName}_ssd1_boot";
64 fsType = "vfat";
65 options = [
66 "rw"
67 "noexec"
68 "nodev"
69 "nofail"
70 "X-mount.mkdir"
71 "iocharset=iso8859-1"
72 ];
73 };
74 swapDevices = [
75 {
76 device = "/dev/disk/by-partlabel/${hostName}_ssd1_swap";
77 randomEncryption = {
78 enable = true;
79 cipher = "aes-xts-plain64";
80 source = "/dev/urandom";
81 };
82 }
83 ];
84
85 boot.supportedFilesystems = [
86 "ntfs"
87 "vfat"
88 ];
89
90 fileSystems."/" = {
91 device = "${hostName}/root";
92 fsType = "zfs";
93 options = [ "zfsutil" ];
94 };
95 fileSystems."/nix" = {
96 device = "${hostName}/root/nix";
97 fsType = "zfs";
98 options = [
99 "X-mount.mkdir"
100 "zfsutil"
101 ];
102 };
103 fileSystems."/var" = {
104 device = "${hostName}/root/var";
105 fsType = "zfs";
106 options = [
107 "X-mount.mkdir"
108 "zfsutil"
109 ];
110 };
111
112 services.pipewire.jack.enable = true;
113
114 }