From 8402055e34ad8c27b97bb9dd3ea1ccf153ccfdf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?PedroHLC=20=E2=98=AD?= Date: Sat, 4 Nov 2023 16:15:47 -0300 Subject: [PATCH] add env-elm-review --- README.md | 6 +++--- common.nix | 22 +++++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b94f072..68cb6c3 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,11 @@ If using elm-pages, then replace `#elm` with `#elm-pages`. You'll find the following scripts in `$PATH` to help you: -- `env-dry-build` - `env-build` -- `env-lint` -- `env-fmt` - `env-ci` +- `env-dry-build` +- `env-fmt` +- `env-lint` (which calls `env-elm-review`) - `env-up` ## Notes diff --git a/common.nix b/common.nix index bc6defa..caff31d 100644 --- a/common.nix +++ b/common.nix @@ -32,23 +32,31 @@ type = lib.types.str; default = "UbiqueLambda/elm-review-config"; }; - reviewCmd = mkOption { - type = lib.types.str; + reviewScript = mkOption { + type = lib.types.package; default = with config.languages.elm; - toString (pkgs.writeShellScript "env-elm-review" '' + pkgs.writeShellScriptBin "env-elm-review" '' exec ${binReview} \ --template ${lib.strings.escapeShellArg reviewTemplate} \ - $(cat "''${DEVENV_ROOT:-.}/.elm-review" || true); - ''); + $(cat "''${DEVENV_ROOT:-.}/.elm-review" || true) \ + "$@" + ''; + }; + reviewCmd = mkOption { + type = lib.types.str; + default = "${config.languages.elm.reviewScript}/bin/env-elm-review"; }; }; }; - config = with config.languages.elm; with lib; { + config = with config.languages.elm; { processes = { reactor.exec = "${binElm} reactor"; }; - packages = with pkgs; [ elmPackages.elm-graphql ]; + packages = with pkgs; [ + elmPackages.elm-graphql + reviewScript + ]; pre-commit = { hooks = {