flake/checks: test extraFiles are in the build

This commit is contained in:
Matt Sturgeon 2024-07-07 16:31:40 +01:00
parent 086873bed9
commit f11f991e09
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
2 changed files with 34 additions and 0 deletions

View file

@ -27,6 +27,8 @@
extend = import ../tests/extend.nix { inherit pkgs makeNixvimWithModule; };
extra-files = import ../tests/extra-files.nix { inherit pkgs makeNixvimWithModule; };
enable-except-in-tests = import ../tests/enable-except-in-tests.nix {
inherit pkgs makeNixvimWithModule;
inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule;

32
tests/extra-files.nix Normal file
View file

@ -0,0 +1,32 @@
{ makeNixvimWithModule, pkgs }:
let
extraFiles = {
"one".text = "one";
"two".text = "two";
"nested/in/dirs/file.txt".text = "nested";
"this/file/test.nix".source = ./extra-files.nix;
};
build = makeNixvimWithModule {
module = {
inherit extraFiles;
};
};
in
pkgs.runCommand "extra-files-test"
{
root = build.config.filesPlugin;
files = builtins.attrNames extraFiles;
}
''
for file in $files; do
path="$root"/"$file"
if [[ -f "$path" ]]; then
echo "File $path exists"
else
echo "File $path is missing"
exit 1
fi
done
touch $out
''