mitemp-prometheus/nix/package.nix
2026-03-27 22:52:57 +01:00

37 lines
725 B
Nix

{
stdenv,
rustPlatform,
lib,
pkg-config,
dbus,
}: let
inherit (lib.sources) sourceByRegex;
inherit (builtins) fromTOML readFile;
src = sourceByRegex ../. ["Cargo.*" "(src)(/.*)?"];
cargoToml = (fromTOML (readFile ../Cargo.toml)).package;
in
rustPlatform.buildRustPackage rec {
pname = cargoToml.name;
inherit src;
inherit (cargoToml) version;
buildInputs = [
dbus
];
nativeBuildInputs = [
pkg-config
];
preInstall = ''
mkdir -p $out/share/dbus-1/system.d
cp ${../dbus-bluetooth.xml} $out/share/dbus-1/system.d/dbus-bluetooth.conf
'';
cargoLock = {
lockFile = ../Cargo.lock;
};
meta.mainProgram = "mitemp-prometheus";
}