File tree Expand file tree Collapse file tree 4 files changed +76
-0
lines changed Expand file tree Collapse file tree 4 files changed +76
-0
lines changed Original file line number Diff line number Diff line change 1+ result
Original file line number Diff line number Diff line change 1+ {
2+ description = "Tablet mode detection and setup scripts for linux" ;
3+
4+ inputs = {
5+ nixpkgs . url = "github:nixos/nixpkgs/nixos-unstable" ;
6+ } ;
7+
8+ outputs = { self , nixpkgs } : {
9+
10+ packages . x86_64-linux . linux_detect_tablet_mode = nixpkgs . legacyPackages . "x86_64-linux" . callPackage ./package.nix { } ;
11+
12+ packages . x86_64-linux . default = self . packages . x86_64-linux . linux_detect_tablet_mode ;
13+
14+ } ;
15+ }
Original file line number Diff line number Diff line change 1+ {
2+ lib ,
3+ stdenv ,
4+ libinput ,
5+ makeWrapper # 提供wrapProgram工具
6+ } :
7+ stdenv . mkDerivation rec {
8+ pname = "linux_detect_tablet_mode" ;
9+ version = "unstable" ;
10+
11+ src = ./. ;
12+
13+ # 依赖:libinput(提供命令)和makeWrapper(提供wrapProgram)
14+ buildInputs = [ libinput ] ;
15+ nativeBuildInputs = [ makeWrapper ] ; # 构建时需要makeWrapper
16+
17+ installPhase = ''
18+ mkdir -p $out/bin
19+ cp "$src/watch_tablet" "$out/bin/"
20+ chmod +x "$out/bin/watch_tablet"
21+
22+ # 关键:用wrapProgram包装脚本,强制将libinput的bin目录添加到PATH
23+ wrapProgram "$out/bin/watch_tablet" \
24+ --prefix PATH : "${ libinput } /bin" # 显式添加libinput的bin路径
25+ '' ;
26+
27+ meta = with lib ; {
28+ description = "Tablet mode detection and setup scripts for linux" ;
29+ license = licenses . mit ;
30+ mainProgram = "watch_tablet" ;
31+ } ;
32+ }
33+
You can’t perform that action at this time.
0 commit comments