mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:19:22 +08:00
try to get halo keyboard working
This commit is contained in:
@@ -11,4 +11,8 @@
|
||||
};
|
||||
cmakeFlags = [ "-DCMAKE_CXX_FLAGS=-Wno-error=stringop-truncation" ];
|
||||
nativeBuildInputs = [ cmake ];
|
||||
postInstall =
|
||||
''
|
||||
cp $out/etc/touch_keyboard/layouts/YB1-X9x-pc105.csv $out/etc/touch_keyboard/layout.csv
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -35,4 +35,5 @@
|
||||
pslist = callPackage ./pslist {};
|
||||
glad = callPackage ./glad {};
|
||||
chromiumos-touch-keyboard = callPackage ./chromiumos-touch-keyboard {};
|
||||
yoga-support = callPackage ./yoga-support {};
|
||||
}
|
||||
|
||||
24
local/pkgs/yoga-support/default.nix
Normal file
24
local/pkgs/yoga-support/default.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{ lib, stdenv, fetchFromGitHub, python3 }:
|
||||
let
|
||||
python = python3.withPackages (ps: with ps; [ evdev pyudev ]);
|
||||
in stdenv.mkDerivation
|
||||
{
|
||||
name = "yogabook-support";
|
||||
src = fetchFromGitHub
|
||||
{
|
||||
owner = "jekhor";
|
||||
repo = "yogabook-support";
|
||||
rev = "8ecf7861e469ba4094115fff0e81d537135e3f22";
|
||||
sha256 = "4UtiQooCaeUDHc9YE9EQRJ2MNKvOqqCv85k0YyI2BO4=";
|
||||
};
|
||||
buildInputs = [ python ];
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
cp pen-key-handler yogabook-modes-handler $out/bin
|
||||
mkdir -p $out/lib/udev/rules.d
|
||||
cp 61-sensor-yogabook.rules $out/lib/udev/rules.d
|
||||
mkdir -p $out/lib/udev/hwdb.d
|
||||
cp 61-sensor-yogabook.hwdb $out/lib/udev/hwdb.d
|
||||
'';
|
||||
}
|
||||
@@ -145,30 +145,49 @@ inputs:
|
||||
{ programs.gamemode.settings.gpu.gpu_device = "${toString hardware.gamemode.drmDevice}"; }
|
||||
# halo-keyboard
|
||||
(mkIf hardware.halo-keyboard.enable
|
||||
{
|
||||
environment.systemPackages = [ inputs.pkgs.localPackages.chromiumos-touch-keyboard ];
|
||||
services.udev.packages = [ inputs.pkgs.localPackages.chromiumos-touch-keyboard ];
|
||||
systemd.services.touch-keyboard-handler =
|
||||
(
|
||||
let
|
||||
keyboard = inputs.pkgs.localPackages.chromiumos-touch-keyboard;
|
||||
support = inputs.pkgs.localPackages.yoga-support;
|
||||
in
|
||||
{
|
||||
# wantedBy = [ "multi-user.target" ];
|
||||
# after = [ "systemd-udevd.service" ];
|
||||
serviceConfig =
|
||||
services.udev.packages = [ keyboard support ];
|
||||
systemd.services =
|
||||
{
|
||||
Type = "simple";
|
||||
WorkingDirectory = "/etc/touch_keyboard";
|
||||
ExecStartPre=
|
||||
[
|
||||
''-sh -c "echo 0 > /sys/class/pwm/pwmchip1/export"''
|
||||
''sh -c "echo 0 > /sys/class/pwm/pwmchip1/pwm0/enable"''
|
||||
''sh -c "echo 1 > /sys/class/pwm/pwmchip1/pwm0/enable"''
|
||||
];
|
||||
ExecStart = "${inputs.pkgs.localPackages.chromiumos-touch-keyboard}/bin/touch_keyboard_handler";
|
||||
# Restart = "always";
|
||||
# RestartSec = "5";
|
||||
touch-keyboard-handler.serviceConfig =
|
||||
{
|
||||
Type = "simple";
|
||||
WorkingDirectory = "/etc/touch_keyboard";
|
||||
# ExecStartPre = let sh = "${inputs.pkgs.bash}/bin/sh"; in
|
||||
# [
|
||||
# ''-${sh} -c "echo 0 > /sys/class/pwm/pwmchip1/export"''
|
||||
# ''${sh} -c "echo 0 > /sys/class/pwm/pwmchip1/pwm0/enable"''
|
||||
# ''${sh} -c "echo 1 > /sys/class/pwm/pwmchip1/pwm0/enable"''
|
||||
# ];
|
||||
ExecStart = "${keyboard}/bin/touch_keyboard_handler";
|
||||
};
|
||||
yogabook-modes-handler =
|
||||
{
|
||||
wantedBy = [ "default.target" ];
|
||||
serviceConfig =
|
||||
{
|
||||
Type = "simple";
|
||||
ExecStart = "${support}/bin/yogabook-modes-handler";
|
||||
StandardOutput = "journal";
|
||||
};
|
||||
};
|
||||
monitor-sensor =
|
||||
{
|
||||
wantedBy = [ "default.target" ];
|
||||
serviceConfig =
|
||||
{
|
||||
Type = "simple";
|
||||
ExecStart = "${inputs.pkgs.iio-sensor-proxy}/bin/monitor-sensor --hinge";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
environment.etc."touch_keyboard".source =
|
||||
"${inputs.pkgs.localPackages.chromiumos-touch-keyboard}/etc/touch_keyboard";
|
||||
})
|
||||
environment.etc."touch_keyboard".source = "${keyboard}/etc/touch_keyboard";
|
||||
}
|
||||
))
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user