local actualPathType=$(nix-instantiate --eval--strict--json 2>&1 \
-E'{ path }: let lib = import <nixpkgs/lib>; in lib.filesystem.pathType path'\
--argstr path "$path")
if[["$actualPathType"!="$expectedPathType"]];then
die "lib.filesystem.pathType \"$path\" == $actualPathType, but $expectedPathType was expected"
fi
}
checkPathType "/"'"directory"'
checkPathType "$PWD/directory"'"directory"'
checkPathType "$PWD/regular"'"regular"'
checkPathType "$PWD/symlink"'"symlink"'
checkPathType "$PWD/fifo"'"unknown"'
checkPathType "$PWD/non-existent""error: evaluation aborted with the following error message: 'lib.filesystem.pathType: Path $PWD/non-existent does not exist.'"
checkPathIsDirectory(){
local path=$1
local expectedIsDirectory=$2
local actualIsDirectory=$(nix-instantiate --eval--strict--json 2>&1 \
-E'{ path }: let lib = import <nixpkgs/lib>; in lib.filesystem.pathIsDirectory path'\