From fd021e6dca42f968b18a72ef7f65aeee63e8ed7d Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Tue, 4 Aug 2026 01:09:33 +0200 Subject: [PATCH] lux-cli: use Lux to generate man pages & completions Signed-off-by: Marc Jakobi --- pkgs/by-name/lu/lux-cli/package.nix | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/lu/lux-cli/package.nix b/pkgs/by-name/lu/lux-cli/package.nix index 7385c8841dd0..5ed2cd6deb47 100644 --- a/pkgs/by-name/lu/lux-cli/package.nix +++ b/pkgs/by-name/lu/lux-cli/package.nix @@ -1,4 +1,6 @@ { + stdenv, + buildPackages, fetchFromGitHub, gnupg, gpgme, @@ -65,14 +67,25 @@ rustPlatform.buildRustPackage (finalAttrs: { nix ]; - postBuild = '' - cargo xtask dist-man - cargo xtask dist-completions - ''; - postInstall = '' - installManPage target/dist/*.1 - installShellCompletion target/dist/lx.{bash,fish} --zsh target/dist/_lx + ${ + # Using lx to generate man pages and completions is faster than xtask + if stdenv.hostPlatform.emulatorAvailable buildPackages then + let + lx = "${stdenv.hostPlatform.emulator buildPackages} $out/bin/lx"; + in + '' + ${lx} util man --target-dir="target/dist" + ${lx} util completion --target-dir="target/dist" + '' + else + '' + cargo xtask dist-man + cargo xtask dist-completions + '' + } + installManPage target/dist/*.1 + installShellCompletion target/dist/lx.{bash,fish} --zsh target/dist/_lx ''; meta = {