about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAtemu2024-05-06 02:09:46 +0200
committerAtemu2024-05-06 02:27:21 +0200
commite153bc88e94d554d2d7e4c42efddf506dab8ea9b (patch)
tree50fd02deae931396581d8994aacf072a09f63fd2
parent7a04d30b417e0b790081afcba106b516b33e85f2 (diff)
wluma: use upstream Makefile's install command
This includes the systemd unit, udev rules, license, docs, man pages and
examples.

marked-man is necessary to generate the man page and was added in this commit's
parent commit.
-rw-r--r--pkgs/tools/wayland/wluma/default.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/tools/wayland/wluma/default.nix b/pkgs/tools/wayland/wluma/default.nix
index 07142210c303..c2defacaa4d0 100644
--- a/pkgs/tools/wayland/wluma/default.nix
+++ b/pkgs/tools/wayland/wluma/default.nix
@@ -1,7 +1,10 @@
 { lib
+, stdenv
 , fetchFromGitHub
 , makeWrapper
 , rustPlatform
+, marked-man
+, coreutils
 , vulkan-loader
 , wayland
 , pkg-config
@@ -20,6 +23,19 @@ rustPlatform.buildRustPackage rec {
     sha256 = "sha256-FaX87k8LdBhrBX4qvokSHkcNaQZ0+oSbkn9d0dK6FGo=";
   };
 
+  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'
+  '';
+
   cargoLock = {
     lockFile = ./Cargo.lock;
     outputHashes = {
@@ -31,6 +47,7 @@ rustPlatform.buildRustPackage rec {
     makeWrapper
     pkg-config
     rustPlatform.bindgenHook
+    marked-man
   ];
 
   buildInputs = [
@@ -39,6 +56,12 @@ rustPlatform.buildRustPackage rec {
     vulkan-loader
   ];
 
+  postBuild = ''
+    make docs
+  '';
+
+  dontCargoInstall = true;
+  installFlags = [ "PREFIX=${placeholder "out"}" ];
   postInstall = ''
     wrapProgram $out/bin/wluma \
       --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ wayland ]}"