nixpkgs/pkgs/by-name/wl/wluma/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

80 lines
1.7 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.4.0";
src = fetchFromGitHub {
owner = "maximbaz";
repo = "wluma";
rev = version;
sha256 = "sha256-Ow3SjeulYiHY9foXrmTtLK3F+B3+DrtDjBUke3bJeDw=";
};
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-BwduYAYIRxc40nn9kloHv+Dt8jLSZViweSYGL5e45YM=";
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";
};
}