diff --git a/pkgs/top-level/unix-tools.nix b/pkgs/top-level/unix-tools.nix index 2e2cc3cea880..0d6e8d1c6c2d 100644 --- a/pkgs/top-level/unix-tools.nix +++ b/pkgs/top-level/unix-tools.nix @@ -12,19 +12,20 @@ let - singleBinary = cmd: providers: - if builtins.hasAttr hostPlatform.parsed.kernel.name providers then - runCommand cmd {} '' - mkdir -p $out/bin + singleBinary = cmd: providers: let + provider = "${providers.${hostPlatform.parsed.kernel.name} or "missing-package"}/bin/${cmd}"; + in runCommand cmd { + meta.platforms = map (n: { kernel.name = n; }) (pkgs.lib.attrNames providers); + } '' + mkdir -p $out/bin - if ! [ -x "${providers.${hostPlatform.parsed.kernel.name}}/bin/${cmd}" ]; then - echo "Cannot find command ${cmd}" - exit 1 - fi + if ! [ -x "${provider}" ]; then + echo "Cannot find command ${cmd}" + exit 1 + fi - ln -s ${providers.${hostPlatform.parsed.kernel.name}}/bin/${cmd} $out/bin/${cmd} - '' - else throw "${hostPlatform.parsed.kernel.name} does not have ${cmd}"; + ln -s "${provider}" "$out/bin/${cmd}" + ''; in rec {