Unverified Commit 68c8a7eb authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

go-chromecast: fix build by using `buildGo122Module` (#353037)

parents 44a97c24 a8214534
Loading
Loading
Loading
Loading
+58 −0
Original line number Diff line number Diff line
{ lib, buildGoModule, fetchFromGitHub }:
{
  lib,
  buildGo122Module,
  fetchFromGitHub,
  installShellFiles,
  stdenvNoCC,
  versionCheckHook,
}:

buildGoModule rec {
# "go test" fails with go 1.23
buildGo122Module rec {
  pname = "go-chromecast";
  version = "0.3.1";

  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=";

  ldflags = [ "-s" "-w" "-X main.version=${version}" "-X main.commit=${src.rev}" "-X main.date=unknown" ];
  CGO_ENABLED = 0;

  meta = with lib; {
  ldflags = [
    "-s"
    "-w"
    "-X=main.version=${version}"
    "-X=main.commit=${src.rev}"
    "-X=main.date=unknown"
  ];

  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";
  };
}
+0 −2
Original line number Diff line number Diff line
@@ -5027,8 +5027,6 @@ with pkgs;
  gfxreconstruct = callPackage ../tools/graphics/gfxreconstruct { };
  go-chromecast = callPackage ../applications/video/go-chromecast { };
  go-containerregistry = callPackage ../development/tools/go-containerregistry { };
  inherit (go-containerregistry) crane gcrane;