Skip to content

Commit fe5f156

Browse files
author
Your Name
committed
Supported Nix Flake
1 parent c8164f1 commit fe5f156

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
result

flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
}

package.nix

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
lib,
3+
stdenv,
4+
libinput,
5+
ruby,
6+
makeWrapper # 提供wrapProgram工具
7+
}:
8+
stdenv.mkDerivation rec {
9+
pname = "linux_detect_tablet_mode";
10+
version = "unstable";
11+
12+
src = ./.;
13+
14+
# 依赖:libinput(提供命令)和makeWrapper(提供wrapProgram)
15+
buildInputs = [ libinput ruby ];
16+
nativeBuildInputs = [ makeWrapper ]; # 构建时需要makeWrapper
17+
18+
installPhase = ''
19+
mkdir -p $out/bin
20+
cp "$src/watch_tablet" "$out/bin/"
21+
chmod +x "$out/bin/watch_tablet"
22+
23+
wrapProgram "$out/bin/watch_tablet" \
24+
--prefix PATH : "${libinput}/bin" \
25+
--prefix PATH : "${ruby}/bin"
26+
'';
27+
28+
meta = with lib; {
29+
description = "Tablet mode detection and setup scripts for linux";
30+
license = licenses.mit;
31+
mainProgram = "watch_tablet";
32+
};
33+
}
34+

0 commit comments

Comments
 (0)