nix-community.nixvim/tests/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
1.3 KiB
Nix
Raw Normal View History

2023-03-22 07:42:02 +01:00
{
makeNixvimWithModule,
lib ? pkgs.lib,
helpers,
2023-03-22 07:42:02 +01:00
pkgs,
pkgsUnfree,
2023-03-22 07:42:02 +01:00
}:
let
fetchTests = import ./fetch-tests.nix;
test-derivation = import ./test-derivation.nix { inherit pkgs makeNixvimWithModule; };
inherit (test-derivation) mkTestDerivationFromNixvimModule;
2023-03-22 07:42:02 +01:00
# List of files containing configurations
testFiles = fetchTests {
inherit lib pkgs helpers;
2023-03-22 07:42:02 +01:00
root = ./test-sources;
};
exampleFiles = {
example =
let
config = import ../example.nix { inherit pkgs; };
in
builtins.removeAttrs config.programs.nixvim [
# This is not available to standalone modules, only HM & NixOS Modules
"enable"
# This is purely an example, it does not reflect a real usage
"extraConfigLua"
"extraConfigVim"
];
};
2023-03-22 07:42:02 +01:00
# We attempt to build & execute all configurations
derivationList = pkgs.lib.mapAttrsToList (name: def: {
inherit name;
path = mkTestDerivationFromNixvimModule {
inherit name;
# The module can either be the actual definition,
# or a child attr named `module`.
module = def.module or (lib.removeAttrs def [ "tests" ]);
dontRun = def.tests.dontRun or false;
pkgs = pkgsUnfree;
};
}) (testFiles // exampleFiles);
in
pkgs.linkFarm "nixvim-tests" derivationList