|
5 | 5 | channel = "stable-23.11"; # or "unstable"
|
6 | 6 |
|
7 | 7 | # Use https://search.nixos.org/packages to find packages
|
8 |
| - packages = [ |
| 8 | + packages = [ |
| 9 | + pkgs.postgresql_15_jit |
| 10 | + pkgs.postgresql15Packages.timescaledb |
| 11 | + pkgs.postgresql15Packages.timescaledb_toolkit |
9 | 12 | pkgs.util-linux.bin
|
10 | 13 | pkgs.dotnet-sdk_8
|
11 | 14 | pkgs.vscode-extensions.ms-dotnettools.csharp
|
|
30 | 33 | # pkgs.nodePackages.nodemon
|
31 | 34 | ];
|
32 | 35 |
|
33 |
| - services.postgres = { |
34 |
| - extensions = [ |
35 |
| - "timescaledb" |
36 |
| - "timescaledb_toolkit" |
37 |
| - ]; |
38 |
| - enable = true; |
39 |
| - }; |
40 |
| - # services.mongodb.enable = true; |
| 36 | + #services.postgres = { |
| 37 | + # extensions = [ |
| 38 | + # "timescaledb" |
| 39 | + # "timescaledb_toolkit" |
| 40 | + # "pgvector" |
| 41 | + # ]; |
| 42 | + # enable = true; |
| 43 | + #}; |
41 | 44 | services.docker.enable = true;
|
42 | 45 |
|
43 | 46 | # Sets environment variables in the workspace
|
|
70 | 73 | workspace = {
|
71 | 74 | # Runs when a workspace is first created
|
72 | 75 | onCreate = {
|
73 |
| - # Example: install JS dependencies from NPM |
74 |
| - # npm-install = "npm install"; |
75 | 76 | init-mongodb = "
|
76 | 77 | mkdir -p ~/mongodb/var/lib/mongo/ &&
|
77 | 78 | mkdir -p ~/mongodb/var/log/mongodb/ &&
|
|
83 | 84 | mongoimport --db json_scada --collection realtimeData --type json --file ~/json-scada/demo-docker/mongo_seed/files/demo_data.json &&
|
84 | 85 | mongoimport --db json_scada --collection processInstances --type json --file ~/json-scada/demo-docker/mongo_seed/files/demo_process_instances.json &&
|
85 | 86 | mongoimport --db json_scada --collection users --type json --file ~/json-scada/demo-docker/mongo_seed/files/demo_users.json &&
|
86 |
| - mongosh json_scada --eval \"db.realtimeData.updateMany({_id:{\$gt:0}},{\$set:{dbId:'demo'}})\" && |
| 87 | + "; |
| 88 | + init-postgresql = " |
| 89 | + mkdir -p ~/postgres && |
| 90 | + initdb -D ~/postgres && |
| 91 | + cp ~/json-scada/platform-nix-idx/postgresql.conf ~/postgres/postgresql.conf && |
| 92 | + cp ~/json-scada/platform-nix-idx/pg_hba.conf ~/postgres/pg_hba.conf && |
| 93 | + /usr/bin/pg_ctl -D /home/user/postgres start && |
| 94 | + /usr/bin/createuser -h localhost -s postgres && |
87 | 95 | psql -U postgres -w -h localhost -f ~/json-scada/sql/create_tables.sql template1 &&
|
88 | 96 | psql -U postgres -w -h localhost -f ~/json-scada/sql/metabaseappdb.sql metabaseappdb &&
|
89 |
| - psql -U postgres -w -h localhost -f ~/json-scada/sql/grafanaappdb.sql grafanaappdb && |
90 |
| - psql -U postgres -w -h localhost -d json_scada -c \"CREATE EXTENSION timescaledb_toolkit;\" |
| 97 | + psql -U postgres -w -h localhost -f ~/json-scada/sql/grafanaappdb.sql grafanaappdb |
91 | 98 | ";
|
92 | 99 | build-jsonscada = "cd ~/json-scada/platform-linux && ./build.sh";
|
93 | 100 | };
|
|
96 | 103 | # Example: start a background task to watch and re-build backend code
|
97 | 104 | # watch-backend = "npm run watch-backend";
|
98 | 105 | start-mongodb = "/usr/bin/mongod -f ~/json-scada/platform-nix-idx/mongod.conf";
|
| 106 | + start-supervisor = "(supervisord -c ~/json-scada/platform-nix-idx/supervisord.conf &)"; |
99 | 107 | };
|
100 | 108 | };
|
101 | 109 | };
|
|
0 commit comments