-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
Copy pathapp2.nix
85 lines (85 loc) · 2.27 KB
/
app2.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
_: {
perSystem =
{
pkgs,
pkgsUnstable,
ensureAtRepositoryRoot,
lib,
...
}:
let
buildPnpmPackage = import ../tools/typescript/buildPnpmPackage.nix {
inherit pkgs lib;
};
deps = with pkgsUnstable; [
python3
stdenv.cc
pkg-config
nodePackages_latest.nodejs
pnpm_10
];
in
{
packages = {
app2 = buildPnpmPackage rec {
packageJsonPath = ./package.json;
extraSrcs = [
../app2
../typescript-sdk
../ts-sdk
];
hash = "sha256-9wWe2Cpny8gIbFjZYX/wIYs0RDQinAVia8V31/i72R0=";
buildInputs = deps;
nativeBuildInputs = buildInputs;
pnpmWorkspaces = [
"app2"
"@unionlabs/sdk"
"@unionlabs/client"
];
buildPhase = ''
runHook preBuild
pnpm --filter=app2 prepare
pnpm --filter=app2 build
runHook postBuild
'';
checkPhase = ''
pnpm --filter=app2 check
'';
doCheck = false; # TODO(ehegnes): enable checks
installPhase = ''
mkdir -p $out
cp -r ./app2/build/* $out
'';
doDist = false;
};
};
apps = {
app2-dev-server = {
type = "app";
program = pkgs.writeShellApplication {
name = "app-dev-server";
runtimeInputs = deps;
text = ''
${ensureAtRepositoryRoot}
cd app2/
pnpm install
pnpm run dev -- --host
'';
};
};
app2-fetch-schema = {
type = "app";
program = pkgs.writeShellApplication {
name = "app2-fetch-schema";
runtimeInputs = deps;
text = ''
${ensureAtRepositoryRoot}
cd app2/
pnpm dlx gql.tada generate-schema --tsconfig ./tsconfig.json --output "./src/generated/schema.graphql" "https://graphql.union.build/v1/graphql"
pnpm dlx gql.tada generate-output --disable-preprocessing --tsconfig ./tsconfig.json --output ./src/generated/graphql-env.d.ts
'';
};
};
};
};
}