dream2nix/tests/examples/default.nix

50 lines
819 B
Nix
Raw Normal View History

2022-03-27 18:11:32 +03:00
{
self,
lib,
2022-04-23 16:09:55 +03:00
async,
bash,
2022-03-27 18:11:32 +03:00
coreutils,
2022-03-28 19:41:33 +03:00
git,
parallel,
2022-03-27 18:11:32 +03:00
nix,
utils,
dream2nixWithExternals,
...
}: let
l = lib // builtins;
examples = ../../examples;
testScript =
utils.writePureShellScript
[
async
bash
coreutils
git
nix
]
''
dir=$1
shift
2022-05-18 21:45:26 +03:00
echo -e "\ntesting example for $dir"
cp -r ${examples}/$dir/* .
chmod -R +w .
nix flake lock --override-input dream2nix ${../../.}
nix run .#resolveImpure || echo "no resolveImpure probably?"
nix flake check "$@"
'';
2022-03-27 18:11:32 +03:00
in
utils.writePureShellScript
[
coreutils
parallel
2022-03-27 18:11:32 +03:00
]
''
2022-04-17 15:42:48 +03:00
if [ -z ''${1+x} ]; then
parallel -j$(nproc) -a <(ls ${examples}) ${testScript}
2022-04-17 15:42:48 +03:00
else
arg1=$1
shift
${testScript} $arg1 "$@"
fi
2022-03-27 18:11:32 +03:00
''