1 { lib, rustPlatform, fetchFromGitHub, pkg-config, installShellFiles, udev, coreutils }:
3 rustPlatform.buildRustPackage rec {
4 pname = "surface-control";
7 src = fetchFromGitHub {
8 owner = "linux-surface";
11 sha256 = "sha256-QgkUxT5Ae0agvalZl1ie+1LwxgaTzMrKpQY3KkpWwG4=";
15 lockFile = ./Cargo.lock;
17 "sdtx-0.1.3" = "sha256-srYSVXRP/rynhhE3ZfOGRM6c7GDgjfmjO/GLXeTze3A=";
21 nativeBuildInputs = [ pkg-config installShellFiles ];
22 buildInputs = [ udev ];
25 installShellCompletion \
26 $releaseDir/build/surface-*/out/surface.{bash,fish} \
27 --zsh $releaseDir/build/surface-*/out/_surface
28 install -Dm 0444 -t $out/etc/udev/rules.d \
29 etc/udev/40-surface-control.rules
30 substituteInPlace $out/etc/udev/rules.d/40-surface-control.rules \
31 --replace "/usr/bin/chmod" "${coreutils}/bin/chmod" \
32 --replace "/usr/bin/chown" "${coreutils}/bin/chown"
37 "Control various aspects of Microsoft Surface devices on Linux from the Command-Line";
38 homepage = "https://github.com/linux-surface/surface-control";
39 license = licenses.mit;
41 platforms = platforms.linux;
42 mainProgram = "surface";