-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
298 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ writeShellScriptBinInRepoRoot | ||
, pkgs | ||
, easyPS | ||
}: | ||
let | ||
inherit (builtins) concatStringsSep; | ||
inherit (pkgs.nodePackages) prettier; | ||
inherit (easyPS) purs-tidy; | ||
xargs = "${pkgs.findutils}/bin/xargs"; | ||
extensionsToRegex = extensions: "\\.(${concatStringsSep "|" extensions})"; | ||
writeFormatter = name: cmd: extensions: writeShellScriptBinInRepoRoot "fix-${name}" '' | ||
set -e | ||
echo formatting with ${name} | ||
${pkgs.git}/bin/git ls-files ':!:bitte/node/config/*'\ | ||
| grep -E '${extensionsToRegex extensions}' \ | ||
| ${xargs} -d $'\\n' ${cmd} | ||
echo done. | ||
''; | ||
in | ||
{ | ||
fix-prettier = writeFormatter | ||
"prettier" | ||
"${prettier}/bin/prettier -w" | ||
[ "js" "ts" "css" "html" ]; | ||
fix-purs-tidy = writeFormatter | ||
"purs-tidy" | ||
"${purs-tidy}/bin/purs-tidy format-in-place" | ||
[ "purs" ]; | ||
fix-nix-fmt = writeFormatter | ||
"nixfmt" | ||
"${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt" | ||
[ "nix" ]; | ||
purs-tidy-hook = { | ||
enable = true; | ||
name = "purs-tidy"; | ||
entry = "${purs-tidy}/bin/purs-tidy format-in-place"; | ||
files = "\\.purs$"; | ||
language = "system"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ pkgs | ||
# , gitignore-nix | ||
# , fixStylishHaskell | ||
, purs-tidy | ||
, fix-prettier | ||
# , fixPngOptimization | ||
, src | ||
# , marlowe-playground | ||
, play-generated | ||
# , web-ghc | ||
# , docs | ||
# , sources | ||
# , vmCompileTests ? false | ||
}: | ||
{ | ||
# shellcheck = pkgs.callPackage ./shellcheck.nix { src = cleanSrc; }; | ||
|
||
# stylishHaskell = pkgs.callPackage ./stylish-haskell.nix { | ||
# src = cleanSrc; | ||
# inherit fixStylishHaskell; | ||
# }; | ||
|
||
generated = pkgs.callPackage ./generated.nix { | ||
inherit src play-generated; | ||
}; | ||
|
||
pursTidy = pkgs.callPackage ./purs-tidy.nix { | ||
inherit src purs-tidy; | ||
}; | ||
|
||
prettier = pkgs.callPackage ./prettier.nix { | ||
inherit src fix-prettier; | ||
}; | ||
|
||
nixpkgsFmt = pkgs.callPackage ./nixpkgs-fmt.nix { | ||
inherit src; | ||
inherit (pkgs) nixpkgs-fmt; | ||
}; | ||
|
||
# pngOptimization = pkgs.callPackage ./png-optimization.nix { | ||
# src = cleanSrc; | ||
# inherit fixPngOptimization; | ||
# }; | ||
|
||
# vmTests = pkgs.callPackage ./vm.nix { | ||
# inherit vmCompileTests marlowe-playground | ||
# web-ghc docs sources; | ||
# }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ runCommand, play-generated, src, diffutils, glibcLocales }: | ||
runCommand "generated-purescript-test" | ||
{ | ||
buildInputs = [ diffutils glibcLocales ]; | ||
} '' | ||
set +e | ||
echo ${toString src} | ||
cp -a ${src} expected | ||
cp -a ${src} actual | ||
chmod -R +w actual | ||
rm -rf actual/marlowe-playground-client/generated | ||
cp -a ${play-generated} actual/marlowe-playground-client/generated | ||
diff --brief --recursive expected actual | ||
EXIT_CODE=$? | ||
if [[ $EXIT_CODE != 0 ]] | ||
then | ||
mkdir -p $out/nix-support | ||
diff -ur expected actual > $out/actual.diff | ||
echo "file none $out/actual.diff" > $out/nix-support/hydra-build-products | ||
echo "*** actual found changes that need addressed first" | ||
echo "*** Please run \`generate-purescript\` and commit changes." | ||
echo "*** or apply the diff generated by hydra if you don't have nix." | ||
exit $EXIT_CODE | ||
else | ||
echo $EXIT_CODE > $out | ||
fi | ||
'' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ runCommand, nixpkgs-fmt, src }: | ||
|
||
# Runs `nixpkgs-fmt --check` on ${src}. If nixpkgs-fmt | ||
# reports that files need to be re-formatted details are | ||
# written to `$out/nix-support/hydra-build-products` | ||
runCommand "nixpkgs-fmt" | ||
{ | ||
buildInputs = [ nixpkgs-fmt ]; | ||
} '' | ||
set +e | ||
nixpkgs-fmt --check ${src} 2>&1 >nixpkgs-fmt.log | ||
if [ $? -ne 0 ]; then | ||
mkdir -p $out/nix-support | ||
cat nixpkgs-fmt.log > $out/nix-support/hydra-build-products | ||
echo "*** nixpkgs-fmt found files that haven't been formatted" | ||
echo "*** Please run \`nix run .#fix-nix-fmt\` and commit the changes" | ||
exit 1 | ||
else | ||
echo 0 > $out | ||
fi | ||
'' |
Oops, something went wrong.