|
52 | 52 | # TODO Affjax FFI should be in ctl-nix |
53 | 53 | foreign.Affjax.node_modules = node_modules; |
54 | 54 | }; |
| 55 | + ps-command = ps.command { }; |
55 | 56 | prebuilt = (pkgs.arion.build { |
56 | 57 | inherit pkgs; |
57 | 58 | modules = [ (pkgs.buildCtlRuntime { }) ]; |
58 | 59 | }).outPath; |
| 60 | + concurrent = pkgs.writeShellApplication { |
| 61 | + name = "concurrent"; |
| 62 | + runtimeInputs = with pkgs; [ |
| 63 | + concurrently |
| 64 | + ]; |
| 65 | + text = '' |
| 66 | + concurrently\ |
| 67 | + --color "auto"\ |
| 68 | + --prefix "[{command}]"\ |
| 69 | + --handle-input\ |
| 70 | + --restart-tries 10\ |
| 71 | + "$@" |
| 72 | + ''; |
| 73 | + }; |
| 74 | + # TODO move from docker runtime to a nix runtime |
59 | 75 | runtime = pkgs.writeShellApplication { |
60 | 76 | name = "runtime"; |
61 | 77 | runtimeInputs = [ pkgs.arion pkgs.docker ]; |
|
69 | 85 | docker run --rm -it -v "$(pwd)":/data -w /data -v store_node-preview-ipc:/ipc -e CARDANO_NODE_SOCKET_PATH=/ipc/node.socket --entrypoint cardano-cli "inputoutput/cardano-node" "$@" |
70 | 86 | ''; |
71 | 87 | }; |
72 | | - ps-command = ps.command { }; |
73 | 88 | purs-watch = pkgs.writeShellApplication { |
74 | 89 | name = "purs-watch"; |
75 | 90 | runtimeInputs = with pkgs; [ entr ps-command ]; |
76 | | - text = "find src | entr -s 'echo building && purs-nix compile'"; |
| 91 | + text = ''find {src,test} | entr -s "purs-nix $*"''; |
77 | 92 | }; |
78 | 93 | webpack = pkgs.writeShellApplication { |
79 | 94 | name = "webpack"; |
|
88 | 103 | dev = pkgs.writeShellApplication { |
89 | 104 | name = "dev"; |
90 | 105 | runtimeInputs = with pkgs; [ |
91 | | - concurrently |
| 106 | + concurrent |
92 | 107 | runtime |
93 | 108 | purs-watch |
94 | 109 | serve |
95 | 110 | ]; |
96 | 111 | text = '' |
97 | | - concurrently\ |
98 | | - --color "auto"\ |
99 | | - --prefix "[{command}]"\ |
100 | | - --handle-input\ |
101 | | - --restart-tries 10\ |
102 | | - purs-watch\ |
| 112 | + concurrent \ |
| 113 | + "purs-watch compile"\ |
103 | 114 | serve\ |
104 | 115 | "runtime up" |
105 | 116 | ''; |
|
111 | 122 | }; |
112 | 123 | docs = pkgs.writeShellApplication { |
113 | 124 | name = "docs"; |
114 | | - runtimeInputs = with pkgs; [ nodejs ps-command ]; |
115 | | - text = ''purs-nix docs && npx http-server ./generated-docs/html -o''; |
| 125 | + runtimeInputs = with pkgs; [ |
| 126 | + concurrent |
| 127 | + nodejs |
| 128 | + purs-watch |
| 129 | + ]; |
| 130 | + text = '' |
| 131 | + concurrent \ |
| 132 | + "purs-watch docs" \ |
| 133 | + "npx http-server ./generated-docs/html -o" |
| 134 | + ''; |
| 135 | + }; |
| 136 | + testInputs = with pkgs; [ |
| 137 | + plutip-server |
| 138 | + postgresql |
| 139 | + ogmios |
| 140 | + kupo |
| 141 | + ogmios-datum-cache |
| 142 | + ]; |
| 143 | + # FIXME ctl-full tests not working |
| 144 | + # related to LovelaceAcademy/ctl-nix#29 |
| 145 | + tests = pkgs.writeShellApplication { |
| 146 | + name = "tests"; |
| 147 | + runtimeInputs = testInputs ++ [ purs-watch ]; |
| 148 | + text = ''purs-watch test "$@"''; |
116 | 149 | }; |
117 | 150 | in |
118 | 151 | { |
119 | 152 | packages.default = ps.output { }; |
120 | 153 |
|
121 | 154 | checks.default = (ps.test.check { }).overrideAttrs ({ buildInputs ? [ ], ... }: { |
122 | | - buildInputs = with pkgs; buildInputs ++ [ |
123 | | - plutip-server |
124 | | - postgresql |
125 | | - ogmios |
126 | | - kupo |
127 | | - ogmios-datum-cache |
128 | | - ]; |
| 155 | + buildInputs = buildInputs ++ testInputs; |
129 | 156 | }); |
130 | 157 |
|
131 | 158 | devShells.default = |
|
140 | 167 | purs |
141 | 168 | ps-command |
142 | 169 | purs-watch |
143 | | - webpack |
144 | | - serve |
145 | 170 | dev |
146 | 171 | bundle |
147 | 172 | docs |
| 173 | + tests |
148 | 174 | ]; |
149 | 175 | shellHook = '' |
150 | 176 | alias log_='printf "\033[1;32m%s\033[0m\n" "$@"' |
151 | 177 | alias info_='printf "\033[1;34m[INFO] %s\033[0m\n" "$@"' |
152 | 178 | alias warn_='printf "\033[1;33m[WARN] %s\033[0m\n" "$@"' |
153 | 179 | log_ "Welcome to ctl-full shell." |
154 | | - info_ "Available commands: runtime, cardano-cli, webpack, purs-nix, serve, dev, bundle, docs." |
| 180 | + info_ "Available commands: dev, tests, docs, runtime, cardano-cli, purs-nix, bundle." |
155 | 181 | info_ "testnet-magic for preview is 2" |
156 | 182 | ''; |
157 | 183 | }; |
|
0 commit comments