mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
Added test for template and fixed check export for lib (#361)
This commit is contained in:
parent
ecaf80b7fd
commit
3600698aba
8 changed files with 40 additions and 9 deletions
1
.github/workflows/check.yml
vendored
1
.github/workflows/check.yml
vendored
|
@ -12,3 +12,4 @@ jobs:
|
||||||
with:
|
with:
|
||||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- run: nix flake check
|
- run: nix flake check
|
||||||
|
- run: nix flake check ./templates/_wrapper/simple
|
||||||
|
|
|
@ -163,6 +163,7 @@
|
||||||
lib = import ./lib {
|
lib = import ./lib {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
|
makeNixvim = self.legacyPackages."${system}".makeNixvim;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
# Args probably only needs pkgs and lib
|
# Args probably only needs pkgs and lib
|
||||||
args: {
|
{
|
||||||
|
makeNixvim,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
} @ args: {
|
||||||
# Add all exported modules here
|
# Add all exported modules here
|
||||||
check = import ./check.nix args;
|
check = import ../tests/test-derivation.nix {
|
||||||
|
inherit makeNixvim pkgs;
|
||||||
|
};
|
||||||
helpers = import ./helpers.nix args;
|
helpers = import ./helpers.nix args;
|
||||||
}
|
}
|
||||||
|
|
9
templates/_wrapper/README.md
Normal file
9
templates/_wrapper/README.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# templates/_wrapper
|
||||||
|
|
||||||
|
This directory contains wrapper flakes for the nixvim templates.
|
||||||
|
The purpose of the wrappers is to be able to run tests on templates deterministically on the branch or PR that is being worked on.
|
||||||
|
It does this by overwriting the url of nixvim and other dependencies to a path within this repo.
|
||||||
|
|
||||||
|
It is also used in the github workflows, so that we can always check if the template is working or not
|
||||||
|
|
||||||
|
NOTE: It is important that we do not commit the `flake.lock` files here as that could cause problems with the check once any files are updated outside the wrapper. Also we cannot add `flake.lock` to `.gitignore` since nix will sometimes complain.
|
12
templates/_wrapper/simple/flake.nix
Normal file
12
templates/_wrapper/simple/flake.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixvim.url = "path:../../..";
|
||||||
|
simple = {
|
||||||
|
url = "path:../../simple";
|
||||||
|
inputs.nixvim.follows = "nixvim";
|
||||||
|
inputs.flake-utils.follows = "nixvim/flake-utils";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = inputs: inputs.simple;
|
||||||
|
}
|
|
@ -12,10 +12,10 @@
|
||||||
flake-utils,
|
flake-utils,
|
||||||
...
|
...
|
||||||
} @ inputs: let
|
} @ inputs: let
|
||||||
nixvimLib = nixvim.lib;
|
|
||||||
config = import ./config; # import the module directly
|
config = import ./config; # import the module directly
|
||||||
in
|
in
|
||||||
flake-utils.lib.eachDefaultSystem (system: let
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
|
nixvimLib = nixvim.lib.${system};
|
||||||
pkgs = import nixpkgs {inherit system;};
|
pkgs = import nixpkgs {inherit system;};
|
||||||
nixvim' = nixvim.legacyPackages.${system};
|
nixvim' = nixvim.legacyPackages.${system};
|
||||||
nvim = nixvim'.makeNixvimWithModule {
|
nvim = nixvim'.makeNixvimWithModule {
|
||||||
|
@ -24,8 +24,8 @@
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
checks = {
|
checks = {
|
||||||
# Run `nix check .` to verify that your config is not broken
|
# Run `nix flake check .` to verify that your config is not broken
|
||||||
default = nixvim.lib.${system}.check.checkNvim {
|
default = nixvimLib.check.mkTestDerivationFromNvim {
|
||||||
inherit nvim;
|
inherit nvim;
|
||||||
name = "A nixvim configuration";
|
name = "A nixvim configuration";
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
}: let
|
}: let
|
||||||
fetchTests = import ./fetch-tests.nix;
|
fetchTests = import ./fetch-tests.nix;
|
||||||
mkTestDerivation = import ./test-derivation.nix {inherit pkgs makeNixvim;};
|
test-derivation = import ./test-derivation.nix {inherit pkgs makeNixvim;};
|
||||||
|
mkTestDerivation = test-derivation.mkTestDerivation;
|
||||||
|
|
||||||
# List of files containing configurations
|
# List of files containing configurations
|
||||||
testFiles = fetchTests {
|
testFiles = fetchTests {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
mkTestDerivationFromNvim = {
|
mkTestDerivationFromNvim = {
|
||||||
name,
|
name,
|
||||||
nvim,
|
nvim,
|
||||||
dontRun,
|
dontRun ? false,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
pkgs.stdenv.mkDerivation {
|
pkgs.stdenv.mkDerivation {
|
||||||
|
@ -55,5 +55,6 @@
|
||||||
inherit name nvim;
|
inherit name nvim;
|
||||||
inherit (testAttributes) dontRun;
|
inherit (testAttributes) dontRun;
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
mkTestDerivation
|
inherit mkTestDerivation mkTestDerivationFromNvim;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue