Ryujinx-Ldn-Website/default.nix
TSRBerry d0ab84a254
Switch to TypeScript and express & Add stats API (#1)
* Switch to node package

Setup environment for:
- Typescript
- express with ejs as the view engine

* Apply prettier formatting

* Read API stats from Redis

* Apply prettier formatting

* Add Dockerfile

* Add environment variables for configuration to README.md

* Log redis errors correctly

* Connect to redis before executing requests

* Rename json properties to match the current ones

* Configure Redis error handler and client correctly

* Remove workflow to fix pnpm dependencies

GitHub supports pnpm for dependabot natively now:
https://github.blog/changelog/2023-06-12-dependabot-version-updates-now-supports-pnpm/

* Add REDIS_SOCKET env var and prefer it over REDIS_URL

* Add default.nix

* Add SOCKET_PATH env var and prefer it over HOST and PORT

* Bump website version

* Add node symlink to output directory

* Add DATA_PATH env var

* Apply prettier formatting

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-07-02 04:05:12 +02:00

47 lines
1 KiB
Nix

{ pkgs ? (import <nixpkgs> {})}:
with pkgs;
with (import (fetchFromGitHub {
owner = "TSRBerry";
repo = "pnpm2nix";
rev = "v0.1";
sha256 = "0vyxcqhdazr17hym4fgh8dqq97lplmp5fmpwmdq2xk73mw060nvq";
}) { inherit pkgs; });
let
buildPackage = mkPnpmPackage {
src = nix-gitignore.gitignoreSource [] ./.;
linkDevDependencies = true;
postBuild = ''
cp -R "node_modules/$pname"/* ./
export PATH="node_modules/.bin:$PATH"
mkdir -p "$out/dist"
npm run build -- --outDir "$out/dist"
mv public package.json pnpm-lock.yaml "$out/"
'';
postInstall = ''
rm -rf "$out/bin" "$lib/node_modules/$pname"
'';
};
package = mkPnpmPackage {
src = buildPackage;
postInstall = ''
mv "$lib/node_modules/$pname/dist" "$lib/node_modules/$pname/public" "$lib/node_modules/$pname/package.json" "$out/"
rm -rf "$lib/node_modules/$pname"
ln -s "$lib/node_modules" "$out/node_modules"
ln -s "$npm_config_nodedir/bin/node" "$out/bin/node"
'';
};
in package