From ec2b988672affc7db695c1aba96aca436d678826 Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 4 Dec 2024 22:40:47 +0000 Subject: [PATCH] unixtools: fix subpackages to include ALL relevant manpages some tools have man sections other than `1`, which the previous logic would omit. for example, `man 8 sysctl` was previously not linked into the `unixtools.sysctl` package but now is. --- pkgs/top-level/unixtools.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/top-level/unixtools.nix b/pkgs/top-level/unixtools.nix index 93bb34bba20d3..a8c132c0b3359 100644 --- a/pkgs/top-level/unixtools.nix +++ b/pkgs/top-level/unixtools.nix @@ -23,7 +23,7 @@ let singleBinary = cmd: providers: let provider = providers.${stdenv.hostPlatform.parsed.kernel.name} or providers.linux; bin = "${getBin provider}/bin/${cmd}"; - manpage = "${getOutput "man" provider}/share/man/man1/${cmd}.1.gz"; + manDir = "${getOutput "man" provider}/share/man"; in runCommand "${cmd}-${provider.name}" { meta = { mainProgram = cmd; @@ -43,9 +43,12 @@ let mkdir -p $out/bin ln -s ${bin} $out/bin/${cmd} - if [ -f ${manpage} ]; then - mkdir -p $out/share/man/man1 - ln -s ${manpage} $out/share/man/man1/${cmd}.1.gz + if [ -d ${manDir} ]; then + manpages=($(cd ${manDir} ; find . -name '${cmd}*')) + for manpage in "''${manpages[@]}"; do + mkdir -p $out/share/man/$(dirname $manpage) + ln -s ${manDir}/$manpage $out/share/man/$manpage + done fi '';