depot/third_party/nixpkgs/pkgs/by-name/gl/glasskube/package.nix
Default email 5c370c0b2a Project import generated by Copybara.
GitOrigin-RevId: 33d1e753c82ffc557b4a585c77de43d4c922ebb5
2024-05-15 17:35:15 +02:00

82 lines
1.9 KiB
Nix

{ lib
, buildGoModule
, buildNpmPackage
, fetchFromGitHub
, nix-update-script
, installShellFiles
}:
let
version = "0.2.1";
gitSrc = fetchFromGitHub {
owner = "glasskube";
repo = "glasskube";
rev = "refs/tags/v${version}";
hash = "sha256-yHktQZ/s3RYcRQd0U+0VTnLOMTyRmlny9RtAdfFT6J8=";
};
web-bundle = buildNpmPackage rec {
inherit version;
pname = "glasskube-web-bundle";
src = gitSrc;
npmDepsHash = "sha256-WKwEAVMG6r/ZFmxgLR+zJCW8F2DOHxpWDYqhX/vcdrs=";
dontNpmInstall = true;
installPhase = ''
runHook preInstall
mkdir $out
mv internal/web/root/static/bundle $out
runHook postInstall
'';
};
in buildGoModule rec {
inherit version;
pname = "glasskube";
src = gitSrc;
vendorHash = "sha256-ADa3nQZ/5K9m0aB5NwGQpjqhGwAne5pN2Z5RUb3eEcU=";
CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
"-X github.com/glasskube/glasskube/internal/config.Version=${version}"
"-X github.com/glasskube/glasskube/internal/config.Commit=${src.rev}"
];
subPackages = [ "cmd/${pname}" "cmd/package-operator" ];
nativeBuildInputs = [ installShellFiles ];
preBuild = ''
cp -r ${web-bundle}/bundle internal/web/root/static/bundle
'';
postInstall = ''
# Completions
installShellCompletion --cmd glasskube \
--bash <($out/bin/glasskube completion bash) \
--fish <($out/bin/glasskube completion fish) \
--zsh <($out/bin/glasskube completion zsh)
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description =
"The missing Package Manager for Kubernetes featuring a GUI and a CLI";
homepage = "https://github.com/glasskube/glasskube";
changelog =
"https://github.com/glasskube/glasskube/releases/tag/v${version}";
maintainers = with maintainers; [ jakuzure ];
license = licenses.asl20;
mainProgram = "glasskube";
};
}