Created
May 25, 2026 05:08
-
-
Save arxae/29260cc67c89e1edd7a017d7d79462de to your computer and use it in GitHub Desktop.
Risuai
This file contains hidden or 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
| { pkgs, ... }: | |
| let | |
| pname = "risuai"; | |
| version = "2026.4.181"; | |
| src = pkgs.fetchFromGitHub { | |
| owner = "kwaroran"; | |
| repo = "RisuAI"; | |
| rev = "v${version}"; | |
| hash = "sha256-OD0Yt6E+S0G5bWF9Rq1W89WvOq2YpNSl1rW2RIYMqcw="; | |
| }; | |
| pnpmDeps = pkgs.pnpm.fetchDeps { | |
| inherit pname version src; | |
| fetcherVersion = 3; | |
| hash = "sha256-wE/Z9mvK9xxdc/u/joM/416NEtlHba3H5dFU9GEDpHI="; | |
| }; | |
| risuai = pkgs.stdenv.mkDerivation { | |
| inherit pname version src pnpmDeps; | |
| nativeBuildInputs = [ | |
| pkgs.nodejs | |
| pkgs.pnpm.configHook | |
| ]; | |
| buildPhase = '' | |
| export VITE_RISU_LEGAL_CONFIGURED=TRUE | |
| pnpm build | |
| ''; | |
| installPhase = '' | |
| mkdir -p $out | |
| cp -r dist $out/ | |
| cp -r server $out/ | |
| cp -r node_modules $out/ | |
| cp package.json $out/ | |
| ''; | |
| }; | |
| startScript = pkgs.writeShellScript "risuai-start" '' | |
| set -e | |
| STATEDIR=/var/lib/risuai | |
| mkdir -p $STATEDIR/save | |
| mkdir -p $STATEDIR/run | |
| # Symlink store paths into writable working dir | |
| ln -sfn ${risuai}/dist $STATEDIR/run/dist | |
| ln -sfn ${risuai}/server $STATEDIR/run/server | |
| ln -sfn ${risuai}/node_modules $STATEDIR/run/node_modules | |
| ln -sfn ${risuai}/package.json $STATEDIR/run/package.json | |
| ln -sfn $STATEDIR/save $STATEDIR/run/save | |
| cd $STATEDIR/run | |
| exec ${pkgs.nodejs}/bin/node ${risuai}/server/node/server.cjs | |
| ''; | |
| in | |
| { | |
| systemd.services.risuai = { | |
| description = "RisuAI web frontend"; | |
| wantedBy = [ "multi-user.target" ]; | |
| after = [ "network.target" ]; | |
| serviceConfig = { | |
| ExecStart = startScript; | |
| StateDirectory = "risuai"; | |
| Restart = "on-failure"; | |
| Environment = "PORT=6001"; | |
| }; | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment