Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
result
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
description = "Tablet mode detection and setup scripts for linux";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};

outputs = { self, nixpkgs }: {

packages.x86_64-linux.linux_detect_tablet_mode = nixpkgs.legacyPackages."x86_64-linux".callPackage ./package.nix { };

packages.x86_64-linux.default = self.packages.x86_64-linux.linux_detect_tablet_mode;

};
}
34 changes: 34 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
lib,
stdenv,
libinput,
ruby,
makeWrapper # 提供wrapProgram工具
}:
stdenv.mkDerivation rec {
pname = "linux_detect_tablet_mode";
version = "unstable";

src = ./.;

# 依赖:libinput(提供命令)和makeWrapper(提供wrapProgram)
buildInputs = [ libinput ruby ];
nativeBuildInputs = [ makeWrapper ]; # 构建时需要makeWrapper

installPhase = ''
mkdir -p $out/bin
cp "$src/watch_tablet" "$out/bin/"
chmod +x "$out/bin/watch_tablet"

wrapProgram "$out/bin/watch_tablet" \
--prefix PATH : "${libinput}/bin" \
--prefix PATH : "${ruby}/bin"
'';

meta = with lib; {
description = "Tablet mode detection and setup scripts for linux";
license = licenses.mit;
mainProgram = "watch_tablet";
};
}