Skip to content

Commit

Permalink
build: include elm-test in nix flake check
Browse files Browse the repository at this point in the history
  • Loading branch information
r-k-b committed Jul 28, 2024
1 parent eff352c commit 149f214
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Run `just check` to check everything, or `just test` for the unit tests.

TODO: include these in `nix flake check`:

- elm-test
- elm-review
- an elm-format check
- style checks for all the other files?
Expand Down
4 changes: 3 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
sourceInfo = self.sourceInfo;
};

elmtests = callPackage ./nix/elmtests.nix { inherit testsSrc; };

peekSrc = name: src:
stdenv.mkDerivation {
src = src;
Expand All @@ -66,7 +68,7 @@
testsSrc = peekSrc "tests" testsSrc;
reviewSrc = peekSrc "elm-review" reviewSrc;
};
checks = { inherit built failIfDepsOutOfSync; };
checks = { inherit built elmtests failIfDepsOutOfSync; };
devShells.default = import ./nix/shell.nix { inherit pkgs; };
apps.default = {
type = "app";
Expand Down
4 changes: 1 addition & 3 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
# manually replaced the next two lines:
# { nixpkgs ? <nixpkgs>, config ? { } }:
# with (import nixpkgs config);
{ pkgs, minimalElmSrc }:
with pkgs;

{ elmPackages, lib, pkgs, minimalElmSrc, nodePackages, stdenv }:
let
mkDerivation = { srcs ? ./elm/elm-srcs.nix, src, name, srcdir ? "../src"
, targets ? [ ], registryDat ? ./elm/registry.dat, outputJavaScript ? false
Expand Down
19 changes: 19 additions & 0 deletions nix/elmtests.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{ elmPackages, pkgs, stdenv, testsSrc }:
stdenv.mkDerivation {
name = "elm-test-results";
src = testsSrc;

buildInputs = with elmPackages; [ elm elm-test ];

buildPhase = pkgs.elmPackages.fetchElmDeps {
elmPackages = import ./elm/elm-srcs.nix;
elmVersion = "0.19.1";
registryDat = ./elm/registry.dat;
};

installPhase = ''
set -e
elm-test
echo "passed" > $out
'';
}

0 comments on commit 149f214

Please sign in to comment.