depot/third_party/nixpkgs/pkgs/tools/wayland/wluma/default.nix
Default email a8b1b57b85 Project import generated by Copybara.
GitOrigin-RevId: fc4148a47fa927319186061aa42633c8aa5777f1
2022-01-22 02:22:15 +01:00

60 lines
1.5 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, rustPlatform
, vulkan-loader
, pkg-config
, udev
, v4l-utils
, llvmPackages
}:
rustPlatform.buildRustPackage rec {
pname = "wluma";
version = "4.0.0";
src = fetchFromGitHub {
owner = "maximbaz";
repo = "wluma";
rev = version;
sha256 = "sha256-lh0GX2M3AFXjlu+jTQGiNKQXM7DiBc7RYMH9PYMLmV4=";
};
nativeBuildInputs = [
makeWrapper
pkg-config
];
buildInputs = [
udev
v4l-utils.lib
];
LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib";
# Works around the issue with rust-bindgen and the Nix gcc wrapper:
# https://hoverbear.org/blog/rust-bindgen-in-nix/
preBuild = ''
export BINDGEN_EXTRA_CLANG_ARGS="$(< ${stdenv.cc}/nix-support/libc-cflags) \
$(< ${stdenv.cc}/nix-support/cc-cflags) \
-isystem ${llvmPackages.libclang.lib}/lib/clang/${lib.getVersion llvmPackages.clang}/include \
-idirafter ${stdenv.cc.cc}/lib/gcc/${stdenv.hostPlatform.config}/${lib.getVersion stdenv.cc.cc}/include \
-idirafter ${v4l-utils.dev}/include"
'';
postInstall = ''
wrapProgram $out/bin/wluma \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ vulkan-loader ]}"
'';
cargoSha256 = "sha256-ArT4xDi+qRpukuIX1RgTgC/At9kkuG3Lf1X56Q2j/2Q=";
meta = with lib; {
description = "Automatic brightness adjustment based on screen contents and ALS";
homepage = "https://github.com/maximbaz/wluma";
license = licenses.isc;
maintainers = with maintainers; [ yevhenshymotiuk ];
platforms = platforms.linux;
};
}