mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-11-08 11:36:11 +01:00
56 lines
1.2 KiB
Nix
56 lines
1.2 KiB
Nix
{
|
|
bash,
|
|
bats,
|
|
callPackage,
|
|
coreutils,
|
|
direnv,
|
|
fetchurl,
|
|
findutils,
|
|
gnugrep,
|
|
gnused,
|
|
lib,
|
|
nix-direnv,
|
|
nixVersions,
|
|
writeShellScriptBin,
|
|
}:
|
|
let
|
|
direnv-stdlib = fetchurl {
|
|
url = "https://raw.githubusercontent.com/direnv/direnv/refs/tags/v2.37.1/stdlib.sh";
|
|
hash = "sha256-MMM04OXhqS/rRSuv8uh7CD70Z7CaGT63EtL/3LC08qM=";
|
|
};
|
|
bats-support = callPackage ./nix/bats-support.nix { };
|
|
bats-assert = callPackage ./nix/bats-assert.nix { };
|
|
mkTestRunner =
|
|
nixVersion:
|
|
writeShellScriptBin "test-runner-${nixVersion}" ''
|
|
set -e
|
|
export PATH=${
|
|
lib.makeBinPath [
|
|
bash
|
|
direnv
|
|
nixVersions.${nixVersion}
|
|
coreutils
|
|
findutils
|
|
gnugrep
|
|
gnused
|
|
]
|
|
}
|
|
export DIRENV_STDLIB=${direnv-stdlib}
|
|
export DIRENVRC="${nix-direnv}/share/nix-direnv/direnvrc"
|
|
export BATS_LIB_PATH="${bats-support}:${bats-assert}"
|
|
|
|
echo run unittest
|
|
${lib.getExe' bats "bats"} tests/
|
|
'';
|
|
test-runner-stable = mkTestRunner "stable";
|
|
test-runner-latest = mkTestRunner "latest";
|
|
in
|
|
{
|
|
inherit
|
|
bats-support
|
|
bats-assert
|
|
direnv-stdlib
|
|
test-runner-stable
|
|
test-runner-latest
|
|
;
|
|
}
|