mirror of
https://github.com/justinwoo/easy-dhall-nix.git
synced 2024-11-14 23:29:41 +01:00
e555e2201c
The test list would go out-of-date when new packages were added. This does the same check as before, but uses the binaries we already specify on the nix level (via a passthru). The next step is to try to run the binaries (e.g. with --version), which will give us a better test of whether they are actually executable.
39 lines
730 B
Nix
39 lines
730 B
Nix
{ pkgs ? import <nixpkgs> {} }:
|
|
|
|
let
|
|
|
|
lib = pkgs.lib;
|
|
|
|
executables = lib.concatLists
|
|
(lib.mapAttrsToList
|
|
# every package puts its binNames into passthru
|
|
(_: v: map (bin: "${v}/bin/${bin}") v.passthru.binNames)
|
|
(import ./default.nix { inherit pkgs; }));
|
|
|
|
testExeLocation = pkgs.writers.writeDash "test-exe-location" ''
|
|
set -e
|
|
ERRORS=0;
|
|
|
|
test_exe () {
|
|
EXE=$1;
|
|
LOCATION=$(command -v "$EXE");
|
|
if [ -x "$LOCATION" ]; then
|
|
echo "found $EXE";
|
|
else
|
|
echo "didnt find $EXE";
|
|
ERRORS=1;
|
|
fi
|
|
}
|
|
|
|
for exe in ${lib.escapeShellArgs executables}; do
|
|
test_exe "$exe"
|
|
done
|
|
|
|
exit "$ERRORS"
|
|
|
|
'';
|
|
|
|
in {
|
|
inherit
|
|
testExeLocation;
|
|
}
|