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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
{
description = "Gargantext PureScript fronetnd";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=24.05";
inputs.purescript-overlay = {
url = "github:thomashoneyman/purescript-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, purescript-overlay }:
flake-utils.lib.eachDefaultSystem (system:
#let pkgs = nixpkgs.legacyPackages.${system};
let
pkgs = import nixpkgs {
inherit system;
overlays = builtins.attrValues { purescript = purescript-overlay.overlays.default; };
};
dependencies = with pkgs; [
purs-bin.purs-0_15_16-1 # from the purescript-overlay
spago-bin.spago-0_93_37
#purescript
#spago-unstable
esbuild
nodejs
nodePackages.npm
];
serve = pkgs.writeShellScriptBin "serve" ''
set -e
npm run server
'';
build-watch = pkgs.writeShellScriptBin "build-watch" ''
set -e
echo "Build watch"
npm spago build -w --then browserify
'';
build-zephyr = pkgs.writeShellScriptBin "build-zephyr" ''
set -e
npm spago build --purs-args '--codegen corefn,js'
zephyr -f Main.main
browserify-zephyr
'';
minify-bundle = pkgs.writeShellScriptBin "minify-bundle" ''
set -e
npm run minify
'';
in
{
packages = rec {
ci = pkgs.writeShellApplication {
name = "install";
runtimeInputs = dependencies;
text = ''
set -e
echo "Installing JS Dependencies (CI)"
# https://docs.npmjs.com/cli/v9/commands/npm-ci
npm ci
'';
};
install = pkgs.writeShellApplication {
name = "install";
runtimeInputs = dependencies;
text = ''
set -e
echo "Installing JS Dependencies"
npm install
# https://docs.npmjs.com/cli/v9/commands/npm-ci
#npm ci
#npm/bin/npm install --dev
'';
};
compile = pkgs.writeShellApplication {
name = "compile";
runtimeInputs = dependencies;
text = ''
set -e
#echo "Installing JS Dependencies"
#npm install
# https://docs.npmjs.com/cli/v9/commands/npm-ci
#npm ci
#npm/bin/npm install --dev
echo "Compiling"
npm run build
'';
};
build = pkgs.writeShellApplication {
name = "build";
runtimeInputs = [ compile ] ++ dependencies;
text = ''
set -e
# compile
echo "Bundling"
npm run bundle
'';
};
test-ps = pkgs.writeShellApplication {
name = "test-ps";
runtimeInputs = [ compile ] ++ dependencies;
text = ''
set -e
compile
echo "Testing"
npm run test
'';
};
repl = pkgs.writeShellApplication {
name = "repl";
runtimeInputs = [ compile ] ++ dependencies;
text = ''
npm run repl
'';
};
build-css = pkgs.writeShellApplication {
name = "build-css";
runtimeInputs = [ compile ] ++ dependencies;
text = ''
set -e
npm run css
'';
};
};
devShells.default = pkgs.mkShell {
name = "purescript-gargantext";
#inputsFrom = builtins.attrValues self.packages.${system};
buildInputs = with pkgs; (dependencies ++ [
# scripts
self.packages.${system}.build
self.packages.${system}.build-css
self.packages.${system}.compile
self.packages.${system}.test-ps
self.packages.${system}.repl
build-watch
build-zephyr
minify-bundle
serve
]);
};
}
);
}