picoclaw: add picoclaw-launcher frontend (#534211)
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
{
|
||||
lib,
|
||||
buildNpmPackage,
|
||||
picoclaw,
|
||||
|
||||
fetchPnpmDeps,
|
||||
nodejs,
|
||||
pnpmConfigHook,
|
||||
pnpm_10,
|
||||
}:
|
||||
let
|
||||
pnpm = pnpm_10;
|
||||
in
|
||||
buildNpmPackage (finalAttrs: {
|
||||
pname = "picoclaw-launcher-frontend";
|
||||
inherit (picoclaw) src version;
|
||||
|
||||
sourceRoot = "${finalAttrs.src.name}/web/frontend";
|
||||
|
||||
nativeBuildInputs = [
|
||||
nodejs
|
||||
pnpm
|
||||
];
|
||||
|
||||
npmDeps = null;
|
||||
pnpmDeps = fetchPnpmDeps {
|
||||
inherit (finalAttrs)
|
||||
pname
|
||||
version
|
||||
src
|
||||
sourceRoot
|
||||
;
|
||||
inherit pnpm;
|
||||
fetcherVersion = 4;
|
||||
hash = "sha256-ECZBq/miLE9dkEOx8e8WI68tI0HBb+iFVeztwMVeeKw=";
|
||||
};
|
||||
npmConfigHook = pnpmConfigHook;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cp -r dist $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = lib.removeAttrs picoclaw.meta [ "mainProgram" ];
|
||||
})
|
||||
@@ -1,9 +1,11 @@
|
||||
{
|
||||
lib,
|
||||
buildGoModule,
|
||||
callPackage,
|
||||
fetchFromGitHub,
|
||||
olm,
|
||||
versionCheckHook,
|
||||
nix-update-script,
|
||||
}:
|
||||
|
||||
buildGoModule (finalAttrs: {
|
||||
@@ -23,6 +25,9 @@ buildGoModule (finalAttrs: {
|
||||
buildInputs = [ olm ];
|
||||
|
||||
preBuild = ''
|
||||
rm -rf web/backend/dist
|
||||
cp -r ${finalAttrs.passthru.frontend} web/backend/dist
|
||||
|
||||
go generate ./...
|
||||
'';
|
||||
|
||||
@@ -32,6 +37,12 @@ buildGoModule (finalAttrs: {
|
||||
"-X github.com/sipeed/picoclaw/pkg/config.Version=${finalAttrs.version}"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
ln -sf $out/bin/{backend,picoclaw-launcher}
|
||||
install -Dm644 web/picoclaw-launcher.png -t $out/share/icons/hicolor/256x256/apps
|
||||
install -Dm444 web/picoclaw-launcher.desktop -t $out/share/applications
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
nativeInstallCheckInputs = [ versionCheckHook ];
|
||||
versionCheckProgramArg = "version";
|
||||
@@ -49,6 +60,11 @@ buildGoModule (finalAttrs: {
|
||||
in
|
||||
[ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
|
||||
|
||||
passthru = {
|
||||
frontend = callPackage ./frontend.nix { picoclaw = finalAttrs.finalPackage; };
|
||||
updateScript = nix-update-script { extraArgs = [ "--subpackage=frontend" ]; };
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Tiny, Fast, and Deployable anywhere - automate the mundane, unleash your creativity";
|
||||
homepage = "https://github.com/sipeed/picoclaw";
|
||||
|
||||
Reference in New Issue
Block a user