Files
nixos-blueprint/hosts/kled/hardware/laptop/chromebook.nix
T
2026-04-24 15:17:40 +03:00

166 lines
4.1 KiB
Nix

{
pkgs,
lib,
perSystem,
...
}: let
ectool = "${perSystem.cros.cros-ectool}/bin/ectool";
in {
systemd.tmpfiles.rules = [
"w /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference - - - - balance_performance
"
"w /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor - - - - performance"
];
systemd.services.ectool-thermalset = {
enable = true;
serviceConfig.Type = "oneshot";
script = ''
${ectool} thermalset 0 0 361 371 333 353
${ectool} thermalset 1 0 361 371 333 353
'';
};
services.kanata.enable = lib.mkForce false;
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 = let
# finger = mod;
pinky = "alt";
ring = "meta";
middle = "control";
index = "shift";
# timeouts
idle = "200";
hold = "150";
# function takes finger and letter
homeRowMod = f: l: "lettermod(${f}, ${l}, ${idle}, ${hold})";
in {
"a" = homeRowMod pinky "a";
"s" = homeRowMod ring "s";
"d" = homeRowMod middle "d";
"f" = homeRowMod index "f";
"j" = homeRowMod index "j";
"k" = homeRowMod middle "k";
"l" = homeRowMod ring "l";
";" = homeRowMod pinky ";";
f1 = "back";
f2 = "forward";
f3 = "refresh";
f4 = "f11";
f5 = "scale";
f6 = "brightnessdown";
f7 = "brightnessup";
f8 = "mute";
f9 = "volumedown";
f10 = "volumeup";
f13 = "coffee"; # lock key reports as XF86Tools
back = "back";
forward = "forward";
refresh = "refresh";
zoom = "f11";
scale = "scale";
brightnessdown = "brightnessdown";
brightnessup = "brightnessup";
mute = "mute";
volumedown = "volumedown";
volumeup = "volumeup";
};
meta = {
f1 = "f1";
f2 = "f2";
f3 = "f3";
f4 = "f4";
f5 = "f5";
f6 = "f6";
f7 = "f7";
f8 = "f8";
f9 = "f9";
f10 = "f10";
f13 = "f12";
back = "f1";
forward = "f2";
refresh = "f3";
zoom = "f4";
scale = "f5";
brightnessdown = "f6";
brightnessup = "f7";
mute = "f8";
volumedown = "f9";
volumeup = "f10";
};
alt = {
backspace = "delete";
meta = "capslock";
brightnessdown = "kbdillumdown";
brightnessup = "kbdillumup";
f5 = "print";
f6 = "kbdillumdown";
f7 = "kbdillumup";
scale = "print";
};
controlalt.backspace = "C-A-delete";
};
};
};
hardware.sensor.iio.enable = true;
hardware.enableRedistributableFirmware = true;
security.wrappers.ectool = lib.mkDefault {
setuid = true;
owner = "root";
group = "root";
source = ectool;
};
boot.extraModprobeConfig = ''
options snd_intel_dspcfg dsp_driver=3
'';
environment = {
systemPackages = [pkgs.sof-firmware];
sessionVariables.ALSA_CONFIG_UCM2 = lib.mkDefault "${perSystem.cros.alsa-ucm-conf-cros}/share/alsa/ucm2";
etc = {
"wireplumber/conf.d/51-increase-headroom.lua".text = ''
monitor.alsa.rules = [
{
matches = [
{
node.name = "~alsa_output.*"
}
]
actions = {
update-props = {
api.alsa.headroom = 2048
}
}
}
]
'';
};
};
# system.replaceDependencies.replacements = [
# {
# original = pkgs.alsa-ucm-conf;
# replacement = perSystem.cros.alsa-ucm-conf-cros;
# }
# ];
}