-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
39226f0
commit 7e60395
Showing
1 changed file
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{ | ||
stdenv, | ||
nodejs, | ||
fetchFromGitHub, | ||
fetchNpmDeps, | ||
buildGoModule, | ||
lib, | ||
npmHooks, | ||
wails, | ||
webkitgtk_4_0, | ||
pkg-config, | ||
wrapGAppsHook3, | ||
autoPatchelfHook, | ||
}: | ||
let | ||
pname = "ask-mai"; | ||
version = "0.4.0"; | ||
src = fetchFromGitHub { | ||
owner = "rainu"; | ||
repo = "ask-mai"; | ||
tag = "v${version}"; | ||
hash = "sha256-hSQs0d9hVnCUnjijVTMN4weI70f1pKAyYsI0r4ulE3w="; | ||
}; | ||
frontend = stdenv.mkDerivation (finalAttrs: { | ||
inherit pname version src; | ||
|
||
nativeBuildInputs = [ | ||
nodejs | ||
npmHooks.npmConfigHook | ||
]; | ||
|
||
npmDeps = fetchNpmDeps { | ||
inherit (finalAttrs) pname version src; | ||
sourceRoot = "${finalAttrs.src.name}/frontend"; | ||
hash = "sha256-hWbdF2AQgPvzWIruBuUya2VeHYDruOWtN2RyEnfvaXc="; | ||
}; | ||
|
||
sourceRoot = "${finalAttrs.src.name}/frontend"; | ||
npmPackFlags = [ "--ignore-scripts" ]; | ||
|
||
buildPhase = '' | ||
runHook preBuild | ||
npm run build | ||
runHook postBuild | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
npm install --verbose | ||
mkdir $out/ | ||
cp -r ./dist/* $out/ | ||
runHook postInstall | ||
''; | ||
}); | ||
in | ||
buildGoModule { | ||
inherit pname version src; | ||
|
||
vendorHash = "sha256-4XLm/lnN0vq1nfpy9E6ELhilZ5R6oyLw5E779Yye2uU="; | ||
|
||
nativeBuildInputs = [ | ||
wails | ||
pkg-config | ||
wrapGAppsHook3 | ||
autoPatchelfHook | ||
]; | ||
|
||
buildInputs = [ | ||
webkitgtk_4_0 | ||
]; | ||
|
||
postUnpack = '' | ||
cp -r ${frontend} $sourceRoot/frontend/dist | ||
''; | ||
|
||
buildPhase = '' | ||
runHook preBuild | ||
wails build -m -s -trimpath -skipbindings -devtools -tags webkit2_40 -o ask-mai | ||
runHook postBuild | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out | ||
cp -r ./build/bin $out/bin | ||
runHook postInstall | ||
''; | ||
|
||
meta = { | ||
description = "A little UI-Application for asking Gen-AI"; | ||
homepage = "https://github.com/rainu/ask-mai"; | ||
mainProgram = "ask-mai"; | ||
license = with lib.licenses; [ mit ]; | ||
maintainers = with lib.maintainers; [ confusedalex ]; | ||
platforms = lib.platforms.linux; | ||
}; | ||
} |