ptouch-api/nix/package.nix

26 lines
584 B
Nix

{
rustPlatform,
pkg-config,
lib,
}: let
inherit (lib.sources) sourceByRegex;
inherit (builtins) fromTOML readFile;
src = sourceByRegex ../. ["Cargo.*" "(src|web)(/.*)?" ".*\.rules"];
version = (fromTOML (readFile ../Cargo.toml)).package.version;
in
rustPlatform.buildRustPackage rec {
pname = "ptouch-remote";
inherit src version;
cargoLock = {
lockFile = ../Cargo.lock;
};
postInstall = ''
mkdir -p $out/lib/udev/rules.d/
cp ./51-ptouch-remote.rules $out/lib/udev/rules.d/
'';
meta.mainProgram = "ptouch-remote";
}