mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
go-chromecast: adopt and other improvements
- adopt (no hardware to test) - add `versionCheckHook` - add shell completions with `installShellFiles` - other improvements
This commit is contained in:
parent
f23fe574f8
commit
90e636c1ba
@ -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";
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user