dotfiles/derivations/wluma/wluma.nix
delta 27c9f432a5 linux-cachyos 6.9 kernel
unbound dns caching
some hyprland bash scripts
fix graphical glitches on laptop
tailsacle no accept dns
2024-06-18 22:29:17 +03:00

79 lines
1.8 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, rustPlatform
, marked-man
, coreutils
, vulkan-loader
, wayland
, pkg-config
, udev
, v4l-utils
, dbus
, nix-update-script
}:
rustPlatform.buildRustPackage rec {
pname = "wluma";
version = "4.40";
src = fetchFromGitHub {
owner = "avalsch";
repo = "wluma";
rev = "27624132a862af36e7d51c8ca215cf6f2dfbed1d";
sha256 = "sha256-C29i+y/J7ABsEewMhQXCHMRpADogzp4PYtL+Ar0CKTw==";
};
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'
'';
cargoHash = "sha256-90l1lO7ERrsbYCo7ZX7zikemehBgUHN/HTfx+EoBMjc=";
nativeBuildInputs = [
makeWrapper
pkg-config
rustPlatform.bindgenHook
marked-man
];
buildInputs = [
udev
v4l-utils
vulkan-loader
dbus
];
postBuild = ''
make docs
'';
dontCargoInstall = true;
installFlags = [ "PREFIX=${placeholder "out"}" ];
postInstall = ''
wrapProgram $out/bin/wluma \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ wayland ]}"
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "Automatic brightness adjustment based on screen contents and ALS";
homepage = "https://github.com/maximbaz/wluma";
changelog = "https://github.com/maximbaz/wluma/releases/tag/${version}";
license = licenses.isc;
maintainers = with maintainers; [ yshym jmc-figueira atemu ];
platforms = platforms.linux;
mainProgram = "wluma";
};
}