1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 03:30:45 +00:00

Merge pull request #298338 from jakuzure/glasskube-fix-bundle

glasskube: fix missing bundles from npm
This commit is contained in:
Weijia Wang 2024-03-31 18:30:22 +02:00 committed by GitHub
commit f792ecf1bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,31 +1,64 @@
{ lib
, buildGoModule
, buildNpmPackage
, fetchFromGitHub
, nix-update-script
, installShellFiles
}:
buildGoModule rec {
pname = "glasskube";
let
version = "0.1.0";
src = fetchFromGitHub {
gitSrc = fetchFromGitHub {
owner = "glasskube";
repo = "glasskube";
rev = "refs/tags/v${version}";
hash = "sha256-iJjO4V2sK3e/SpDZ5Lfw7gILgZrI4CGg0wLLVKthGUE=";
};
web-bundle = buildNpmPackage rec {
inherit version;
pname = "glasskube-web-bundle";
src = gitSrc;
npmDepsHash = "sha256-nv2ng8gUOi9K46bDuWt/Y3S6AJovUWaqM+8uGiu/QSs=";
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-iFWcTzZP0DKJ9hrmfUWR4U/VX2zsR+3uojI+GRI2R3I=";
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}" ];
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 \
@ -37,9 +70,11 @@ buildGoModule rec {
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "The missing Package Manager for Kubernetes featuring a GUI and a CLI";
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}";
changelog =
"https://github.com/glasskube/glasskube/releases/tag/v${version}";
maintainers = with maintainers; [ jakuzure ];
license = licenses.asl20;
mainProgram = "glasskube";