|
20 | 20 | };
|
21 | 21 | };
|
22 | 22 |
|
23 |
| - outputs = inputs @ { self, flake-parts, hercules-ci-effects, ... }: |
| 23 | + outputs = |
| 24 | + inputs @ { self |
| 25 | + , flake-parts |
| 26 | + , hercules-ci-effects |
| 27 | + , ... |
| 28 | + }: |
24 | 29 | flake-parts.lib.mkFlake { inherit inputs; } ({ ... }: {
|
25 | 30 | imports = [
|
26 | 31 | # Hercules CI effects module used to deploy to GitHub Pages
|
|
30 | 35 | # Systems supported by this flake
|
31 | 36 | systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
32 | 37 |
|
33 |
| - perSystem = { self', pkgs, system, ... }: |
| 38 | + perSystem = |
| 39 | + { self' |
| 40 | + , pkgs |
| 41 | + , system |
| 42 | + , ... |
| 43 | + }: |
34 | 44 | let
|
35 |
| - easy-ps = (import inputs.easy-purescript-nix { inherit pkgs; }); |
| 45 | + easy-ps = import inputs.easy-purescript-nix { inherit pkgs; }; |
36 | 46 |
|
37 | 47 | spagoPkgs = import ./spago-packages.nix { inherit pkgs; };
|
38 | 48 |
|
|
48 | 58 | # If warnings generated from project source files will trigger a build error.
|
49 | 59 | # Controls `--strict` purescript-psa flag
|
50 | 60 | strictComp ? true
|
51 |
| - # Warnings from `purs` to silence during compilation, independent of `strictComp` |
| 61 | + , # Warnings from `purs` to silence during compilation, independent of `strictComp` |
52 | 62 | # Controls `--censor-codes` purescript-psa flag
|
53 |
| - , censorCodes ? [ "UserDefinedWarning" ] |
| 63 | + censorCodes ? [ "UserDefinedWarning" ] |
54 | 64 | , ...
|
55 | 65 | }:
|
56 | 66 | pkgs.stdenv.mkDerivation {
|
|
68 | 78 | unpackPhase = "true";
|
69 | 79 | buildPhase = ''
|
70 | 80 | install-spago-style
|
71 |
| - psa ${pkgs.lib.optionalString strictComp "--strict" } \ |
| 81 | + psa ${pkgs.lib.optionalString strictComp "--strict"} \ |
72 | 82 | --censor-lib \
|
73 | 83 | --is-lib=.spago ".spago/*/*/src/**/*.purs" \
|
74 | 84 | --censor-codes=${builtins.concatStringsSep "," censorCodes} \
|
|
124 | 134 | # If warnings generated from project source files will trigger a build error.
|
125 | 135 | # Controls `--strict` purescript-psa flag
|
126 | 136 | strictComp ? true
|
127 |
| - # Warnings from `purs` to silence during compilation, independent of `strictComp` |
| 137 | + , # Warnings from `purs` to silence during compilation, independent of `strictComp` |
128 | 138 | # Controls `--censor-codes` purescript-psa flag
|
129 |
| - , censorCodes ? [ "UserDefinedWarning" ] |
| 139 | + censorCodes ? [ "UserDefinedWarning" ] |
130 | 140 | , pursDependencies ? buildPursDependencies {
|
131 | 141 | inherit strictComp censorCodes;
|
132 | 142 | }
|
|
165 | 175 | chmod -R +w output/
|
166 | 176 | '';
|
167 | 177 | buildPhase = ''
|
168 |
| - psa ${pkgs.lib.optionalString strictComp "--strict" } \ |
| 178 | + psa ${pkgs.lib.optionalString strictComp "--strict"} \ |
169 | 179 | --censor-lib \
|
170 | 180 | --is-lib=.spago ".spago/*/*/src/**/*.purs" \
|
171 | 181 | --censor-codes=${builtins.concatStringsSep "," censorCodes} "./src/**/*.purs" \
|
|
186 | 196 | {
|
187 | 197 | # The main Purescript module
|
188 | 198 | testMain
|
189 |
| - # The entry point function in the main PureScript module |
190 |
| - , psEntryPoint ? "main" |
191 |
| - # Additional variables to pass to the test environment |
192 |
| - , env ? { } |
193 |
| - # Passed through to the `buildInputs` of the derivation. Use this to add |
| 199 | + , # The entry point function in the main PureScript module |
| 200 | + psEntryPoint ? "main" |
| 201 | + , # Additional variables to pass to the test environment |
| 202 | + env ? { } |
| 203 | + , # Passed through to the `buildInputs` of the derivation. Use this to add |
194 | 204 | # additional packages to the test environment
|
195 |
| - , buildInputs ? [ ] |
| 205 | + buildInputs ? [ ] |
196 | 206 | , builtProject ? buildPursProject { main = testMain; }
|
197 | 207 | , ...
|
198 |
| - }: pkgs.runCommand "ps-test" |
| 208 | + }: |
| 209 | + pkgs.runCommand "ps-test" |
199 | 210 | (
|
200 | 211 | {
|
201 | 212 | src = ./.;
|
202 | 213 | buildInputs = [ pkgs.nodejs ];
|
203 |
| - } // env |
| 214 | + } |
| 215 | + // env |
204 | 216 | )
|
205 | 217 | ''
|
206 | 218 | # Copy the purescript project files
|
|
220 | 232 | # Create output file to tell Nix we succeeded
|
221 | 233 | touch $out
|
222 | 234 | '';
|
223 |
| - |
224 | 235 | in
|
225 | 236 | {
|
226 | 237 | devShells = {
|
|
258 | 269 |
|
259 | 270 | # Example flake checks. Run with `nix flake check --keep-going`
|
260 | 271 | checks = {
|
261 |
| - tests = runPursTest { testMain = "Test.Main"; psEntryPoint = "main"; }; |
| 272 | + tests = runPursTest { |
| 273 | + testMain = "Test.Main"; |
| 274 | + psEntryPoint = "main"; |
| 275 | + }; |
262 | 276 |
|
263 |
| - formatting-check = pkgs.runCommand "formatting-check" |
264 |
| - { |
265 |
| - nativeBuildInputs = with pkgs; [ |
266 |
| - easy-ps.purs-tidy |
267 |
| - nixpkgs-fmt |
268 |
| - nodePackages.prettier |
269 |
| - nodePackages.eslint |
270 |
| - fd |
271 |
| - ]; |
272 |
| - } |
273 |
| - '' |
274 |
| - cd ${self} |
275 |
| - purs-tidy check './src/**/*.purs' './test/**/*.purs' |
276 |
| - nixpkgs-fmt --check "$(fd --no-ignore-parent -enix --exclude='spago*')" |
277 |
| - prettier --log-level warn -c $(fd --no-ignore-parent -ejs -ecjs) |
278 |
| - eslint --quiet $(fd --no-ignore-parent -ejs -ecjs) --parser-options 'sourceType: module' --parser-options 'ecmaVersion: 2016' |
279 |
| - touch $out |
280 |
| - ''; |
| 277 | + formatting-check = |
| 278 | + pkgs.runCommand "formatting-check" |
| 279 | + { |
| 280 | + nativeBuildInputs = with pkgs; [ |
| 281 | + easy-ps.purs-tidy |
| 282 | + nixpkgs-fmt |
| 283 | + nodePackages.prettier |
| 284 | + nodePackages.eslint |
| 285 | + fd |
| 286 | + ]; |
| 287 | + } |
| 288 | + '' |
| 289 | + cd ${self} |
| 290 | + purs-tidy check './src/**/*.purs' './test/**/*.purs' |
| 291 | + nixpkgs-fmt --check "$(fd --no-ignore-parent -enix --exclude='spago*')" |
| 292 | + prettier --log-level warn -c $(fd --no-ignore-parent -ejs -ecjs) |
| 293 | + eslint --quiet $(fd --no-ignore-parent -ejs -ecjs) --parser-options 'sourceType: module' --parser-options 'ecmaVersion: 2016' |
| 294 | + touch $out |
| 295 | + ''; |
281 | 296 | };
|
282 | 297 | };
|
283 | 298 |
|
|
0 commit comments