tix/flake.nix

51 lines
1.2 KiB
Nix

{
description = "A testing library for nix";
outputs = {
self,
nixpkgs,
}: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
tix = import ./tix/. {inherit pkgs;};
in
tix
// {
formatter.x86_64-linux = pkgs.alejandra;
packages.x86_64-linux.test = tix.run [
./test/it.test.nix
./test/test.test.nix
./test/describe.test.nix
./test/watch.test.nix
({describe, it, ...}: [(describe "suite" [
(it "runs this test" {actual = true; expected = true;})
])])
];
packages.x86_64-linux.example = tix.run [
./mytest.nix
];
packages.x86_64-linux.watchpipe = tix.watch {
cmd = "nix run --show-trace .#test file";
view = "tee -a /tmp/tix-output";
};
packages.x86_64-linux.watch = tix.watch {
cmd = "nix run --show-trace .#test $2";
view = "cat";
};
packages.x86_64-linux.results = pkgs.writeShellScriptBin "results" ''
tail -f -n1 /tmp/tix-output | {
while read out
do
clear
jq '${tix.filters.overview}' $out
done
}
'';
};
}