-
Notifications
You must be signed in to change notification settings - Fork 39
/
app.nix
87 lines (83 loc) · 2.28 KB
/
app.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
86
87
_: {
perSystem =
{
lib,
pkgs,
jsPkgs,
ensureAtRepositoryRoot,
...
}:
let
deps = with jsPkgs; [
python3
pkg-config
nodePackages_latest.nodejs
nodePackages_latest."patch-package"
];
packageJSON = lib.importJSON ./package.json;
in
{
packages = {
app = jsPkgs.buildNpmPackage {
npmDepsHash = "sha256-YAUgEe+4g4GbKprXJoeMKrkvhUqXZ6md5WJph2DGcEM=";
src = ./.;
sourceRoot = "app";
npmFlags = [
"--loglevel=verbose"
"--enable-pre-post-scripts"
];
pname = packageJSON.name;
inherit (packageJSON) version;
nativeBuildInputs = deps;
buildInputs = deps;
installPhase = ''
mkdir -p $out
cp -r ./build/* $out
'';
doDist = false;
NODE_OPTIONS = "--no-warnings";
};
};
apps = {
app-dev-server = {
type = "app";
program = pkgs.writeShellApplication {
name = "app-dev-server";
runtimeInputs = deps;
text = ''
${ensureAtRepositoryRoot}
cd app/
npm install
npm run dev
'';
};
};
app-fetch-schema = {
type = "app";
program = pkgs.writeShellApplication {
name = "app-dev-server";
runtimeInputs = deps;
text = ''
${ensureAtRepositoryRoot}
cd app/
npx gql.tada generate-schema --tsconfig ./tsconfig.json --output "./src/generated/schema.graphql" "https://blue.graphql.union.build/v1/graphql"
npx gql.tada generate-output --disable-preprocessing --tsconfig ./tsconfig.json --output ./src/generated/graphql-env.d.ts
'';
};
};
deploy-app-ipfs = {
type = "app";
program = pkgs.writeShellApplication {
name = "deploy-app-ipfs";
runtimeInputs = deps;
text = ''
${ensureAtRepositoryRoot}
cd app/
nix build .#app
npm_config_yes=true npx @fleek-platform/cli sites deploy
'';
};
};
};
};
}