forked from nix-community/todomvc-nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devshell.nix
180 lines (160 loc) · 3.56 KB
/
devshell.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
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
{ pkgs }:
with pkgs;
# Configure your development environment.
#
# Documentation: https://github.com/numtide/devshell
devshell.mkShell {
name = "todomvc-nix";
motd = ''
Welcome to the todomvc-nix application.
If you see this message, it means your are inside the Nix shell.
Command available:
- pginit: initial PostgreSQL setup
- pgstart: start psql service
- pgstop: stop psql service
- migrate: migrate the database
- deletdb: remove the database completely.
'';
commands = [
{
name = "pginit";
help = "init psql service";
category = "database";
command = "${todomvc.nix.database.pgutil.init_pg} || echo '''PG init failed''' ";
}
{
name = "pgstart";
help = "start psql service";
category = "database";
command = "${todomvc.nix.database.pgutil.start_pg} || echo '''PG start failed''' ";
}
{
name = "pgstop";
help = "stop psql service";
category = "database";
command = "${todomvc.nix.database.pgutil.stop_pg} || echo '''PG stop failed''' ";
}
{
name = "migrate";
help = "migrate database using sqitch";
category = "database";
command = "${todomvc.nix.database.migrate}/bin/sqitch deploy || echo '''Migrate database failed''' ";
}
{
name = "deletedb";
help = "delete database using sqitch";
category = "database";
command = "${todomvc.nix.database.migrate}/bin/sqitch revert || echo '''Migrate database failed''' ";
}
{
name = "nixpkgs-fmt";
help = "use this to format the Nix code";
category = "fmt";
package = "nixpkgs-fmt";
}
];
bash = {
extra = ''
export LD_INCLUDE_PATH="$DEVSHELL_DIR/include"
export LD_LIB_PATH="$DEVSHELL_DIR/lib"
'';
interactive = '''';
};
env = [
{
name = "DATABASE_URL";
value = "postgresql://todomvc_dbuser:todomvc_dbpass@localhost:5432/todomvc_db";
}
{
name = "PGHOST";
value = "localhost";
}
{
name = "PGPORT";
value = "5432";
}
{
name = "PGDATABASE";
value = "todomvc_db";
}
{
name = "PGUSER";
value = "todomvc_dbuser";
}
{
name = "PGPASSWORD";
value = "todomvc_dbpass";
}
{
name = "OPENSSL_DIR";
value = "${openssl.bin}/bin";
}
{
name = "OPENSSL_LIB_DIR";
value = "${openssl.out}/lib";
}
{
name = "OPENSSL_INCLUDE_DIR";
value = "${openssl.out.dev}/include";
}
];
packages = [
# Haskell
# todomvc.reflexDev.ghc.frontend
todomvc.todoHaskell.haskell.packages.ghc865.cabal-install
(todomvc.todoHaskell.haskell.packages.ghc865.ghcWithPackages (p: with p; [
aeson
aeson-pretty
http-types
todo-common
zlib
polysemy
todo-haskell
unliftio
wai
wai-logger
wai-extra
servant
servant-server
postgresql-simple
jsaddle
jsaddle-warp
transformers
warp
websockets
todo-common
servant-jsaddle
miso-jsaddle
lens
text
http-proxy
http-client
mtl
]))
# build tools
## Rust
todomvc.nix.rustOverlay
wasm-bindgen-cli
binaryen
# Rust
## Backend
todomvc.nix.rustOverlay
### Others
binutils
pkgconfig
openssl
openssl.dev
gcc
glibc
gmp.dev
nixpkgs-fmt
# Javascript related frontend
# It is also used for Rust's frontend development
nodejs-12_x
wasm-pack
yarn
yarn2nix
# database
postgresql
];
}