Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace CSL with Cardano Data Lite #2

Merged
merged 9 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
/.psa*
/.spago
/.spago2nix/
result
result
/node_modules
89 changes: 52 additions & 37 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
};
};

outputs = inputs @ { self, flake-parts, hercules-ci-effects, ... }:
outputs =
inputs @ { self
, flake-parts
, hercules-ci-effects
, ...
}:
flake-parts.lib.mkFlake { inherit inputs; } ({ ... }: {
imports = [
# Hercules CI effects module used to deploy to GitHub Pages
Expand All @@ -30,9 +35,14 @@
# Systems supported by this flake
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];

perSystem = { self', pkgs, system, ... }:
perSystem =
{ self'
, pkgs
, system
, ...
}:
let
easy-ps = (import inputs.easy-purescript-nix { inherit pkgs; });
easy-ps = import inputs.easy-purescript-nix { inherit pkgs; };

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

Expand All @@ -48,9 +58,9 @@
# If warnings generated from project source files will trigger a build error.
# Controls `--strict` purescript-psa flag
strictComp ? true
# Warnings from `purs` to silence during compilation, independent of `strictComp`
, # Warnings from `purs` to silence during compilation, independent of `strictComp`
# Controls `--censor-codes` purescript-psa flag
, censorCodes ? [ "UserDefinedWarning" ]
censorCodes ? [ "UserDefinedWarning" ]
, ...
}:
pkgs.stdenv.mkDerivation {
Expand All @@ -68,7 +78,7 @@
unpackPhase = "true";
buildPhase = ''
install-spago-style
psa ${pkgs.lib.optionalString strictComp "--strict" } \
psa ${pkgs.lib.optionalString strictComp "--strict"} \
--censor-lib \
--is-lib=.spago ".spago/*/*/src/**/*.purs" \
--censor-codes=${builtins.concatStringsSep "," censorCodes} \
Expand Down Expand Up @@ -124,9 +134,9 @@
# If warnings generated from project source files will trigger a build error.
# Controls `--strict` purescript-psa flag
strictComp ? true
# Warnings from `purs` to silence during compilation, independent of `strictComp`
, # Warnings from `purs` to silence during compilation, independent of `strictComp`
# Controls `--censor-codes` purescript-psa flag
, censorCodes ? [ "UserDefinedWarning" ]
censorCodes ? [ "UserDefinedWarning" ]
, pursDependencies ? buildPursDependencies {
inherit strictComp censorCodes;
}
Expand Down Expand Up @@ -165,7 +175,7 @@
chmod -R +w output/
'';
buildPhase = ''
psa ${pkgs.lib.optionalString strictComp "--strict" } \
psa ${pkgs.lib.optionalString strictComp "--strict"} \
--censor-lib \
--is-lib=.spago ".spago/*/*/src/**/*.purs" \
--censor-codes=${builtins.concatStringsSep "," censorCodes} "./src/**/*.purs" \
Expand All @@ -186,21 +196,23 @@
{
# The main Purescript module
testMain
# The entry point function in the main PureScript module
, psEntryPoint ? "main"
# Additional variables to pass to the test environment
, env ? { }
# Passed through to the `buildInputs` of the derivation. Use this to add
, # The entry point function in the main PureScript module
psEntryPoint ? "main"
, # Additional variables to pass to the test environment
env ? { }
, # Passed through to the `buildInputs` of the derivation. Use this to add
# additional packages to the test environment
, buildInputs ? [ ]
buildInputs ? [ ]
, builtProject ? buildPursProject { main = testMain; }
, ...
}: pkgs.runCommand "ps-test"
}:
pkgs.runCommand "ps-test"
(
{
src = ./.;
buildInputs = [ pkgs.nodejs ];
} // env
}
// env
)
''
# Copy the purescript project files
Expand All @@ -220,7 +232,6 @@
# Create output file to tell Nix we succeeded
touch $out
'';

in
{
devShells = {
Expand Down Expand Up @@ -258,26 +269,30 @@

# Example flake checks. Run with `nix flake check --keep-going`
checks = {
tests = runPursTest { testMain = "Test.Main"; psEntryPoint = "main"; };
tests = runPursTest {
testMain = "Test.Main";
psEntryPoint = "main";
};

formatting-check = pkgs.runCommand "formatting-check"
{
nativeBuildInputs = with pkgs; [
easy-ps.purs-tidy
nixpkgs-fmt
nodePackages.prettier
nodePackages.eslint
fd
];
}
''
cd ${self}
purs-tidy check './src/**/*.purs' './test/**/*.purs'
nixpkgs-fmt --check "$(fd --no-ignore-parent -enix --exclude='spago*')"
prettier --log-level warn -c $(fd --no-ignore-parent -ejs -ecjs)
eslint --quiet $(fd --no-ignore-parent -ejs -ecjs) --parser-options 'sourceType: module' --parser-options 'ecmaVersion: 2016'
touch $out
'';
formatting-check =
pkgs.runCommand "formatting-check"
{
nativeBuildInputs = with pkgs; [
easy-ps.purs-tidy
nixpkgs-fmt
nodePackages.prettier
nodePackages.eslint
fd
];
}
''
cd ${self}
purs-tidy check './src/**/*.purs' './test/**/*.purs'
nixpkgs-fmt --check "$(fd --no-ignore-parent -enix --exclude='spago*')"
prettier --log-level warn -c $(fd --no-ignore-parent -ejs -ecjs)
eslint --quiet $(fd --no-ignore-parent -ejs -ecjs) --parser-options 'sourceType: module' --parser-options 'ecmaVersion: 2016'
touch $out
'';
};
};

Expand Down
Loading