Files
nixos-blueprint/hosts/eldrid/hardware-conf.nix
2025-03-03 18:50:51 +02:00

203 lines
5.4 KiB
Nix
Executable File

{
config,
lib,
pkgs,
# modulesPath,
...
}: let
cb-ucm-conf = pkgs.alsa-ucm-conf.overrideAttrs {
wttsrc = pkgs.fetchFromGitHub {
owner = "WeirdTreeThing";
repo = "chromebook-ucm-conf";
rev = "b6ce2a7";
hash = "sha256-QRUKHd3RQmg1tnZU8KCW0AmDtfw/daOJ/H3XU5qWTCc=";
};
postInstall = ''
cp -R $wttsrc/common/* $out/share/alsa/ucm2/common
cp -R $wttsrc/codecs/* $out/share/alsa/ucm2/codecs
cp -R $wttsrc/platforms/* $out/share/alsa/ucm2/platforms
cp -R $wttsrc/sof-rt5682 $out/share/alsa/ucm2/conf.d
cp -R $wttsrc/sof-cs42l42 $out/share/alsa/ucm2/conf.d
'';
};
in {
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" "xe" "i915"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];
fileSystems."/" = {
device = "/dev/disk/by-uuid/fc3d843d-54c6-4b2f-ac56-77f81600745e";
fsType = "btrfs";
options = ["subvol=@nixos,compress=zstd"];
};
boot.initrd.luks.devices."luks".device = "/dev/disk/by-uuid/cbd7d98e-745b-4828-b868-42881bad353d";
fileSystems."/home" = {
device = "/dev/disk/by-uuid/fc3d843d-54c6-4b2f-ac56-77f81600745e";
fsType = "btrfs";
options = ["subvol=@home,compress=zstd"];
};
fileSystems."/var/lib/flatpak" = {
device = "/dev/disk/by-uuid/fc3d843d-54c6-4b2f-ac56-77f81600745e";
fsType = "btrfs";
options = ["subvol=@flatpak,compress=zstd"];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/D38C-AA51";
fsType = "vfat";
options = ["fmask=0077" "dmask=0077"];
};
fileSystems."/swap" = {
device = "/dev/disk/by-uuid/fc3d843d-54c6-4b2f-ac56-77f81600745e";
fsType = "btrfs";
options = ["subvol=@swap,compress=zstd"];
};
swapDevices = [
{
device = "/swap/swapfile";
size = 8 * 1024; # eight gigs
}
];
wireless = {
wifi.enable = true;
bluetooth.enable = true;
};
networking.useDHCP = lib.mkDefault true;
# intel ax201 wifi card firmware
hardware.enableRedistributableFirmware = true;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
# physically broken touchscreen
services.udev.extraRules = "ACTION==\"add|change\", KERNELS==\"input[0-9]*\", SUBSYSTEMS==\"input\", ATTRS{id/vendor}==\"27c6\", ATTRS{id/product}==\"0e84\", ENV{LIBINPUT_IGNORE_DEVICE}=\"1\"";
services.keyd = {
enable = true;
keyboards.internal = {
ids = [
"k:0001:0001"
"k:18d1:5044"
"k:18d1:5052"
"k:0000:0000"
"k:18d1:5050"
"k:18d1:504c"
"k:18d1:503c"
"k:18d1:5030"
"k:18d1:503d"
"k:18d1:505b"
"k:18d1:5057"
"k:18d1:502b"
"k:18d1:5061"
];
settings = {
main = {
f1 = "back";
f2 = "forward";
f3 = "refresh";
f4 = "f11";
f5 = "scale";
f6 = "brightnessdown";
f7 = "brightnessup";
f8 = "mute";
f9 = "volumedown";
f10 = "volumeup";
f13 = "printscreen";
back = "back";
forward = "forward";
refresh = "refresh";
zoom = "f11";
scale = "scale";
brightnessdown = "brightnessdown";
brightnessup = "brightnessup";
mute = "mute";
volumedown = "volumedown";
volumeup = "volumeup";
sleep = "coffee";
a = "lettermod(alt, a, 200, 150)";
s = "lettermod(meta, s, 200, 150)";
d = "lettermod(control, d, 200, 150)";
f = "lettermod(shift, f, 200, 150)";
j = "lettermod(shift, j, 200, 150)";
k = "lettermod(control, k, 200, 150)";
l = "lettermod(meta, l, 200, 150)";
";" = "lettermod(alt, ;, 200, 150)";
};
meta = {
f1 = "f1";
f2 = "f2";
f3 = "f3";
f4 = "f4";
f5 = "f5";
f6 = "f6";
f7 = "f7";
f8 = "f8";
f9 = "f9";
f10 = "f10";
back = "f1";
forward = "f2";
refresh = "f3";
zoom = "f4";
scale = "f5";
brightnessdown = "f6";
brightnessup = "f7";
mute = "f8";
volumedown = "f9";
volumeup = "f10";
sleep = "f12";
};
alt = {
backspace = "delete";
meta = "capslock";
brightnessdown = "kbdillumdown";
brightnessup = "kbdillumup";
f6 = "kbdillumdown";
f7 = "kbdillumup";
};
control = {
f5 = "print";
scale = "print";
};
controlalt = {
backspace = "C-A-delete";
};
};
};
};
system.replaceDependencies.replacements = [
{
original = pkgs.alsa-ucm-conf;
replacement = cb-ucm-conf;
}
];
services.pipewire.wireplumber.configPackages = [
(pkgs.writeTextDir "share/wireplumber/main.lua.d/51-increase-headroom.lua" ''
rule = {
matches = {
{
{ "node.name", "matches", "alsa_output.*" },
},
},
apply_properties = {
["api.alsa.headroom"] = 4096,
},
}
table.insert(alsa_monitor.rules,rule)
'')
];
boot = {
extraModprobeConfig = ''
options snd-intel-dspcfg dsp_driver=3
'';
};
}