From 37c369c6f847e8a87b11e5a3560ed5d0f73aeeca Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 5 Feb 2026 19:31:37 +0900 Subject: [PATCH 1/2] whosthere: fix version display Switched to `versionCheckHook` to prevent similar issues, as we easily miss running `passthru.tests`. --- pkgs/by-name/wh/whosthere/package.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/wh/whosthere/package.nix b/pkgs/by-name/wh/whosthere/package.nix index bb64af813231..f45311d62f01 100644 --- a/pkgs/by-name/wh/whosthere/package.nix +++ b/pkgs/by-name/wh/whosthere/package.nix @@ -3,8 +3,7 @@ fetchFromGitHub, lib, nix-update-script, - testers, - whosthere, + versionCheckHook, }: buildGoModule (finalAttrs: { @@ -20,6 +19,12 @@ buildGoModule (finalAttrs: { vendorHash = "sha256-YVPsWpIXC5SLm+T2jEGqF4MBcKOAAk0Vpc7zCIFkNw8="; + ldflags = [ + "-s" + "-X" + "main.versionStr=${finalAttrs.version}" + ]; + checkFlags = let # Skip tests that require filesystem access @@ -30,8 +35,12 @@ buildGoModule (finalAttrs: { in [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ]; + nativeInstallCheckInputs = [ + versionCheckHook + ]; + doInstallCheck = true; + passthru.updateScript = nix-update-script { }; - passthru.tests.version = testers.testVersion { package = whosthere; }; meta = { description = "Local Area Network discovery tool"; From 4c330a12dbbe72254a094889694f84d6aaf7f2a6 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 5 Feb 2026 19:42:53 +0900 Subject: [PATCH 2/2] whosthere: add shell completions --- pkgs/by-name/wh/whosthere/package.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/by-name/wh/whosthere/package.nix b/pkgs/by-name/wh/whosthere/package.nix index f45311d62f01..1555abe0b225 100644 --- a/pkgs/by-name/wh/whosthere/package.nix +++ b/pkgs/by-name/wh/whosthere/package.nix @@ -1,7 +1,9 @@ { buildGoModule, fetchFromGitHub, + installShellFiles, lib, + stdenv, nix-update-script, versionCheckHook, }: @@ -19,6 +21,10 @@ buildGoModule (finalAttrs: { vendorHash = "sha256-YVPsWpIXC5SLm+T2jEGqF4MBcKOAAk0Vpc7zCIFkNw8="; + nativeBuildInputs = [ + installShellFiles + ]; + ldflags = [ "-s" "-X" @@ -35,6 +41,13 @@ buildGoModule (finalAttrs: { in [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ]; + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd whosthere \ + --bash <("$out/bin/whosthere" completion bash) \ + --fish <("$out/bin/whosthere" completion fish) \ + --zsh <("$out/bin/whosthere" completion zsh) + ''; + nativeInstallCheckInputs = [ versionCheckHook ];