10 rustPlatform.buildRustPackage rec {
11 pname = "speakersafetyd";
15 inherit pname version;
16 hash = "sha256-I1fL1U4vqKxPS1t6vujMTdi/JAAOCcPkvUqv6FqkId4=";
18 cargoHash = "sha256-Adwct+qFhUsOIao8XqNK2zcn13DBlQNA+X4aRFeIAXM=";
20 nativeBuildInputs = [ pkg-config ];
21 buildInputs = [ alsa-lib ];
24 substituteInPlace speakersafetyd.service --replace "/usr" "$out"
25 substituteInPlace Makefile --replace "target/release" "target/${rust.lib.toRustTargetSpec stdenv.hostPlatform}/$cargoBuildType"
26 # creating files in /var does not make sense in a nix package
27 substituteInPlace Makefile --replace 'install -dDm0755 $(DESTDIR)/$(VARDIR)/lib/speakersafetyd/blackbox' ""
32 "UNITDIR=$(out)/lib/systemd/system"
33 "UDEVDIR=$(out)/lib/udev/rules.d"
34 "SHAREDIR=$(out)/share"
35 "TMPFILESDIR=$(out)/lib/tmpfiles.d"
38 dontCargoInstall = true;
41 description = "Userspace daemon written in Rust that implements an analogue of the Texas Instruments Smart Amp speaker protection model";
42 mainProgram = "speakersafetyd";
43 homepage = "https://github.com/AsahiLinux/speakersafetyd";
44 maintainers = with maintainers; [ yuka ];
45 license = licenses.mit;
46 platforms = platforms.linux;