-
Notifications
You must be signed in to change notification settings - Fork 11
/
flake.nix
43 lines (42 loc) · 1.59 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... } @ inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
packages = rec {
boba-frontend-assets = pkgs.yarn2nix-moretea.mkYarnPackage {
name = "boba-frontend";
version = "0.0.1";
src = ./.;
dontFixup = true;
doDist = false;
nodejs = pkgs.nodejs-18_x;
NODE_OPTIONS = "--openssl-legacy-provider --max-old-space-size=8192";
buildPhase = ''
export NODE_MODULES_PARENT_PATH=$PWD
yarn build
'';
distPhase = "";
installPhase = ''
mkdir -p $out/libexec/boba-frontend
mv node_modules $out/libexec/boba-frontend/
mv deps $out/libexec/boba-frontend/
'';
};
boba-frontend = pkgs.writeShellScriptBin "boba-frontend" ''
export NODE_MODULES_PARENT_PATH=${boba-frontend-assets}/libexec/boba-frontend
export NODE_PATH=${boba-frontend-assets}/libexec/boba-frontend/node_modules
export NODE_OPTIONS="--openssl-legacy-provider";
export DEBUG=boba-frontend:*,-*info
${boba-frontend-assets}/libexec/boba-frontend/node_modules/.bin/next start "${boba-frontend-assets}/libexec/boba-frontend/deps/bobaboard-frontend" -p 3010
'';
default = boba-frontend;
};
}
);
}