54 lines
1,007 B
Nix
54 lines
1,007 B
Nix
{ lib
|
|
, stdenvNoCC
|
|
, bun
|
|
, bun2nix
|
|
, makeWrapper
|
|
}:
|
|
|
|
let
|
|
packageJson = lib.importJSON ../package.json;
|
|
in
|
|
stdenvNoCC.mkDerivation {
|
|
pname = "kotsukotsu";
|
|
version = packageJson.version;
|
|
|
|
src = lib.cleanSource ../.;
|
|
bunDeps = bun2nix.fetchBunDeps {
|
|
bunNix = ../bun.nix;
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
bun2nix.hook
|
|
bun
|
|
makeWrapper
|
|
];
|
|
|
|
dontRunLifecycleScripts = true;
|
|
dontUseBunInstall = true;
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
bun run build
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/share/kotsukotsu $out/bin
|
|
cp -r build/. $out/share/kotsukotsu/
|
|
|
|
makeWrapper ${lib.getExe bun} $out/bin/kotsukotsu \
|
|
--run "cd $out/share/kotsukotsu" \
|
|
--add-flags "$out/share/kotsukotsu/server.js"
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = {
|
|
description = "Typing practice app with passkey auth";
|
|
homepage = "https://example.invalid";
|
|
mainProgram = "kotsukotsu";
|
|
platforms = lib.platforms.linux;
|
|
};
|
|
}
|