nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromCodeberg,
5 testers,
6 cmake,
7 libX11,
8 libXext,
9 sdbus-cpp,
10 udev,
11 xcbutilimage,
12 coreutils,
13 cli11,
14 ddcutil,
15 fmt,
16 nlohmann_json,
17 spdlog,
18 udevCheckHook,
19 nix-update-script,
20}:
21
22stdenv.mkDerivation (finalAttrs: {
23 pname = "gummy";
24 version = "0.6.1";
25
26 src = fetchFromCodeberg {
27 owner = "fusco";
28 repo = "gummy";
29 rev = finalAttrs.version;
30 hash = "sha256-ic+kTBoirMX6g79NdNoeFbNNo1LYg/z+nlt/GAB6UyQ=";
31 };
32
33 nativeBuildInputs = [
34 cmake
35 udevCheckHook
36 ];
37
38 buildInputs = [
39 cli11
40 ddcutil
41 fmt
42 libX11
43 libXext
44 nlohmann_json
45 sdbus-cpp
46 spdlog
47 udev
48 xcbutilimage
49 ];
50
51 cmakeFlags = [
52 (lib.mapAttrsToList lib.cmakeFeature {
53 "UDEV_DIR" = "${placeholder "out"}/lib/udev";
54 "UDEV_RULES_DIR" = "${placeholder "out"}/lib/udev/rules.d";
55 })
56 ];
57
58 # Fixes the "gummy start" command, without this it cannot find the binary.
59 # Setting this through cmake does not seem to work.
60 postPatch = ''
61 substituteInPlace gummyd/gummyd/api.cpp \
62 --replace "CMAKE_INSTALL_DAEMON_PATH" "\"${placeholder "out"}/libexec/gummyd\""
63 '';
64
65 preFixup = ''
66 substituteInPlace $out/lib/udev/rules.d/99-gummy.rules \
67 --replace "/bin/chmod" "${coreutils}/bin/chmod"
68
69 ln -s $out/libexec/gummyd $out/bin/gummyd
70 '';
71
72 doInstallCheck = true;
73
74 passthru.tests.version = testers.testVersion { package = finalAttrs.finalPackage; };
75 passthru.updateScript = nix-update-script { };
76
77 meta = {
78 homepage = "https://codeberg.org/fusco/gummy";
79 description = "Brightness and temperature manager for X11";
80 longDescription = ''
81 CLI screen manager for X11 that allows automatic and manual brightness/temperature adjustments,
82 via backlight (currently only for embedded displays) and gamma. Multiple monitors are supported.
83 '';
84 license = lib.licenses.gpl3Only;
85 maintainers = [ ];
86 };
87})