2022-01-03 16:56:52 +00:00
|
|
|
{ lib
|
2024-06-05 15:53:02 +00:00
|
|
|
, stdenv
|
2022-01-03 16:56:52 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, rustPlatform
|
2024-06-05 15:53:02 +00:00
|
|
|
, marked-man
|
|
|
|
, coreutils
|
2022-01-03 16:56:52 +00:00
|
|
|
, vulkan-loader
|
2023-07-15 17:15:38 +00:00
|
|
|
, wayland
|
2022-01-19 23:45:15 +00:00
|
|
|
, pkg-config
|
|
|
|
, udev
|
|
|
|
, v4l-utils
|
2024-06-05 15:53:02 +00:00
|
|
|
, dbus
|
|
|
|
, nix-update-script
|
2022-01-03 16:56:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "wluma";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "4.4.0";
|
2022-01-03 16:56:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "maximbaz";
|
|
|
|
repo = "wluma";
|
|
|
|
rev = version;
|
2024-06-05 15:53:02 +00:00
|
|
|
sha256 = "sha256-Ow3SjeulYiHY9foXrmTtLK3F+B3+DrtDjBUke3bJeDw=";
|
2022-01-03 16:56:52 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile --replace \
|
|
|
|
'target/release/$(BIN)' \
|
|
|
|
'target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/$(BIN)'
|
|
|
|
|
|
|
|
# Needs chmod and chgrp
|
|
|
|
substituteInPlace 90-wluma-backlight.rules --replace \
|
|
|
|
'RUN+="/bin/' 'RUN+="${coreutils}/bin/'
|
|
|
|
|
|
|
|
substituteInPlace wluma.service --replace \
|
|
|
|
'ExecStart=/usr/bin/wluma' 'ExecStart=${placeholder "out"}/bin/wluma'
|
|
|
|
'';
|
|
|
|
|
2023-03-27 19:17:25 +00:00
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
};
|
2022-07-14 12:49:19 +00:00
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
pkg-config
|
2022-03-05 16:20:37 +00:00
|
|
|
rustPlatform.bindgenHook
|
2024-06-05 15:53:02 +00:00
|
|
|
marked-man
|
2022-01-19 23:45:15 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
udev
|
2022-03-05 16:20:37 +00:00
|
|
|
v4l-utils
|
2023-07-15 17:15:38 +00:00
|
|
|
vulkan-loader
|
2024-06-05 15:53:02 +00:00
|
|
|
dbus
|
2022-01-19 23:45:15 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
postBuild = ''
|
|
|
|
make docs
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontCargoInstall = true;
|
|
|
|
installFlags = [ "PREFIX=${placeholder "out"}" ];
|
2022-01-03 16:56:52 +00:00
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/wluma \
|
2023-07-15 17:15:38 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ wayland ]}"
|
2022-01-03 16:56:52 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
2022-01-03 16:56:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Automatic brightness adjustment based on screen contents and ALS";
|
|
|
|
homepage = "https://github.com/maximbaz/wluma";
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/maximbaz/wluma/releases/tag/${version}";
|
2022-01-03 16:56:52 +00:00
|
|
|
license = licenses.isc;
|
2024-06-05 15:53:02 +00:00
|
|
|
maintainers = with maintainers; [ yshym jmc-figueira atemu ];
|
2022-01-03 16:56:52 +00:00
|
|
|
platforms = platforms.linux;
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "wluma";
|
2022-01-03 16:56:52 +00:00
|
|
|
};
|
|
|
|
}
|