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

This commit is contained in:
Weijia Wang 2024-11-03 01:00:47 +01:00 committed by GitHub
commit 68c8a7ebdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 58 additions and 27 deletions

View File

@ -1,25 +0,0 @@
{ lib, buildGoModule, fetchFromGitHub }:
buildGoModule rec {
pname = "go-chromecast";
version = "0.3.1";
src = fetchFromGitHub {
owner = "vishen";
repo = pname;
rev = "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" ];
meta = with lib; {
homepage = "https://github.com/vishen/go-chromecast";
description = "CLI for Google Chromecast, Home devices and Cast Groups";
license = licenses.asl20;
maintainers = [ ];
mainProgram = "go-chromecast";
};
}

View File

@ -0,0 +1,58 @@
{
lib,
buildGo122Module,
fetchFromGitHub,
installShellFiles,
stdenvNoCC,
versionCheckHook,
}:
# "go test" fails with go 1.23
buildGo122Module rec {
pname = "go-chromecast";
version = "0.3.1";
src = fetchFromGitHub {
owner = "vishen";
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"
];
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 = lib.licenses.asl20;
maintainers = [ lib.maintainers.zi3m5f ];
mainProgram = "go-chromecast";
};
}

View File

@ -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;