51 lines
1.6 KiB
Nix
51 lines
1.6 KiB
Nix
{ config
|
|
, lib
|
|
, pkgs
|
|
, ...
|
|
}:
|
|
|
|
{
|
|
options.phone.buffyboard = {
|
|
enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
};
|
|
};
|
|
config = {
|
|
boot.initrd.kernelModules = [ "uinput" "evdev" ];
|
|
boot.initrd.extraUtilsCommands = ''
|
|
copy_bin_and_libs ${pkgs.buffyboard}/bin/buffyboard
|
|
cp -a ${pkgs.libinput.out}/share $out/
|
|
'';
|
|
boot.initrd.extraUdevRulesCommands = ''
|
|
cp -v ${config.systemd.package}/lib/udev/rules.d/60-input-id.rules $out/
|
|
cp -v ${config.systemd.package}/lib/udev/rules.d/60-persistent-input.rules $out/
|
|
cp -v ${config.systemd.package}/lib/udev/rules.d/70-touchpad.rules $out/
|
|
'';
|
|
boot.initrd.preLVMCommands = ''
|
|
mkdir -p /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.libinput.name}/
|
|
ln -s "$(dirname "$(dirname "$(which buffyboard)")")"/share /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.libinput.name}/
|
|
buffyboard 2>/dev/null &
|
|
'';
|
|
boot.initrd.postMountCommands = ''
|
|
pkill -x buffyboard
|
|
'';
|
|
systemd.services.buffyboard = {
|
|
description = "buffyboard";
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
ExecStart = "${pkgs.buffyboard}/bin/buffyboard";
|
|
Restart = "always";
|
|
RestartSec = "1";
|
|
};
|
|
};
|
|
security.sudo.extraRules = [
|
|
{ groups = [ "users" ];
|
|
commands = [
|
|
{ command = "/run/current-system/sw/bin/systemctl stop buffyboard"; options = [ "SETENV" "NOPASSWD" ]; }
|
|
{ command = "/run/current-system/sw/bin/systemctl start buffyboard"; options = [ "SETENV" "NOPASSWD" ]; }
|
|
]; }
|
|
];
|
|
};
|
|
}
|