diff --git a/pkgs/applications/video/go-chromecast/default.nix b/pkgs/applications/video/go-chromecast/default.nix index 0c00eb04380e..52a8321c300e 100644 --- a/pkgs/applications/video/go-chromecast/default.nix +++ b/pkgs/applications/video/go-chromecast/default.nix @@ -2,6 +2,9 @@ lib, buildGo122Module, fetchFromGitHub, + installShellFiles, + stdenvNoCC, + versionCheckHook, }: # "go test" fails with go 1.23 @@ -11,26 +14,45 @@ buildGo122Module rec { src = fetchFromGitHub { owner = "vishen"; - repo = pname; - rev = "v${version}"; + repo = "go-chromecast"; + rev = "refs/tags/v${version}"; hash = "sha256-Kzo8iWj4mtnX1Jxm2sLsnmEOmpzScxWHZ/sLYYm3vQI="; }; vendorHash = "sha256-cEUlCR/xtPJJSWplV1COwV6UfzSmVArF4V0pJRk+/Og="; + CGO_ENABLED = 0; + ldflags = [ "-s" "-w" - "-X main.version=${version}" - "-X main.commit=${src.rev}" - "-X main.date=unknown" + "-X=main.version=${version}" + "-X=main.commit=${src.rev}" + "-X=main.date=unknown" ]; - meta = with lib; { + doInstallCheck = true; + + nativeBuildInputs = [ installShellFiles ]; + + nativeInstallCheckInputs = [ + versionCheckHook + ]; + + versionCheckProgramArg = "--version"; + + postInstall = lib.optionalString (stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform) '' + installShellCompletion --cmd go-chromecast \ + --bash <($out/bin/go-chromecast completion bash) \ + --fish <($out/bin/go-chromecast completion fish) \ + --zsh <($out/bin/go-chromecast completion zsh) + ''; + + meta = { homepage = "https://github.com/vishen/go-chromecast"; description = "CLI for Google Chromecast, Home devices and Cast Groups"; - license = licenses.asl20; - maintainers = [ ]; + license = lib.licenses.asl20; + maintainers = [ lib.maintainers.zi3m5f ]; mainProgram = "go-chromecast"; }; }