Skip to content

Commit fa886ba

Browse files
authored
Merge pull request #2 from mlabs-haskell/marcusbfs/cardano-data-lite
Replace CSL with Cardano Data Lite
2 parents aa528d5 + e1099cf commit fa886ba

10 files changed

+337
-236
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
/.psa*
1010
/.spago
1111
/.spago2nix/
12-
result
12+
result
13+
/node_modules

flake.nix

+52-37
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@
2020
};
2121
};
2222

23-
outputs = inputs @ { self, flake-parts, hercules-ci-effects, ... }:
23+
outputs =
24+
inputs @ { self
25+
, flake-parts
26+
, hercules-ci-effects
27+
, ...
28+
}:
2429
flake-parts.lib.mkFlake { inherit inputs; } ({ ... }: {
2530
imports = [
2631
# Hercules CI effects module used to deploy to GitHub Pages
@@ -30,9 +35,14 @@
3035
# Systems supported by this flake
3136
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
3237

33-
perSystem = { self', pkgs, system, ... }:
38+
perSystem =
39+
{ self'
40+
, pkgs
41+
, system
42+
, ...
43+
}:
3444
let
35-
easy-ps = (import inputs.easy-purescript-nix { inherit pkgs; });
45+
easy-ps = import inputs.easy-purescript-nix { inherit pkgs; };
3646

3747
spagoPkgs = import ./spago-packages.nix { inherit pkgs; };
3848

@@ -48,9 +58,9 @@
4858
# If warnings generated from project source files will trigger a build error.
4959
# Controls `--strict` purescript-psa flag
5060
strictComp ? true
51-
# Warnings from `purs` to silence during compilation, independent of `strictComp`
61+
, # Warnings from `purs` to silence during compilation, independent of `strictComp`
5262
# Controls `--censor-codes` purescript-psa flag
53-
, censorCodes ? [ "UserDefinedWarning" ]
63+
censorCodes ? [ "UserDefinedWarning" ]
5464
, ...
5565
}:
5666
pkgs.stdenv.mkDerivation {
@@ -68,7 +78,7 @@
6878
unpackPhase = "true";
6979
buildPhase = ''
7080
install-spago-style
71-
psa ${pkgs.lib.optionalString strictComp "--strict" } \
81+
psa ${pkgs.lib.optionalString strictComp "--strict"} \
7282
--censor-lib \
7383
--is-lib=.spago ".spago/*/*/src/**/*.purs" \
7484
--censor-codes=${builtins.concatStringsSep "," censorCodes} \
@@ -124,9 +134,9 @@
124134
# If warnings generated from project source files will trigger a build error.
125135
# Controls `--strict` purescript-psa flag
126136
strictComp ? true
127-
# Warnings from `purs` to silence during compilation, independent of `strictComp`
137+
, # Warnings from `purs` to silence during compilation, independent of `strictComp`
128138
# Controls `--censor-codes` purescript-psa flag
129-
, censorCodes ? [ "UserDefinedWarning" ]
139+
censorCodes ? [ "UserDefinedWarning" ]
130140
, pursDependencies ? buildPursDependencies {
131141
inherit strictComp censorCodes;
132142
}
@@ -165,7 +175,7 @@
165175
chmod -R +w output/
166176
'';
167177
buildPhase = ''
168-
psa ${pkgs.lib.optionalString strictComp "--strict" } \
178+
psa ${pkgs.lib.optionalString strictComp "--strict"} \
169179
--censor-lib \
170180
--is-lib=.spago ".spago/*/*/src/**/*.purs" \
171181
--censor-codes=${builtins.concatStringsSep "," censorCodes} "./src/**/*.purs" \
@@ -186,21 +196,23 @@
186196
{
187197
# The main Purescript module
188198
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
194204
# additional packages to the test environment
195-
, buildInputs ? [ ]
205+
buildInputs ? [ ]
196206
, builtProject ? buildPursProject { main = testMain; }
197207
, ...
198-
}: pkgs.runCommand "ps-test"
208+
}:
209+
pkgs.runCommand "ps-test"
199210
(
200211
{
201212
src = ./.;
202213
buildInputs = [ pkgs.nodejs ];
203-
} // env
214+
}
215+
// env
204216
)
205217
''
206218
# Copy the purescript project files
@@ -220,7 +232,6 @@
220232
# Create output file to tell Nix we succeeded
221233
touch $out
222234
'';
223-
224235
in
225236
{
226237
devShells = {
@@ -258,26 +269,30 @@
258269

259270
# Example flake checks. Run with `nix flake check --keep-going`
260271
checks = {
261-
tests = runPursTest { testMain = "Test.Main"; psEntryPoint = "main"; };
272+
tests = runPursTest {
273+
testMain = "Test.Main";
274+
psEntryPoint = "main";
275+
};
262276

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+
'';
281296
};
282297
};
283298

0 commit comments

Comments
 (0)