mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-02 17:15:01 +02:00
This should be separate from `test-sources` because we want to re-use a
common instance of nixpkgs throughout those tests.
Also, moved the existing nixpkgs module test from `test-sources`.
This partially reverts commit c4ad4d0b2e
.
100 lines
1.9 KiB
Nix
100 lines
1.9 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
linkFarmFromDrvs,
|
|
self,
|
|
stdenv,
|
|
}:
|
|
let
|
|
|
|
defaultPkgs = pkgs;
|
|
|
|
testModule =
|
|
name: module:
|
|
let
|
|
configuration = lib.nixvim.modules.evalNixvim {
|
|
modules = lib.toList module ++ [
|
|
{
|
|
test = {
|
|
inherit name;
|
|
buildNixvim = false;
|
|
runNvim = false;
|
|
};
|
|
}
|
|
];
|
|
};
|
|
in
|
|
configuration.config.build.test;
|
|
|
|
in
|
|
linkFarmFromDrvs "nixpkgs-module-test" [
|
|
|
|
# TODO: expect not setting `nixpkgs.pkgs` to throw
|
|
|
|
(testModule "nixpkgs-overlays" (
|
|
{ pkgs, ... }:
|
|
{
|
|
nixpkgs.pkgs = defaultPkgs;
|
|
|
|
nixpkgs.overlays = [
|
|
(final: prev: {
|
|
foobar = "foobar";
|
|
})
|
|
];
|
|
|
|
assertions = [
|
|
{
|
|
assertion = pkgs.foobar or null == "foobar";
|
|
message = ''
|
|
Expected `pkgs.foobar` to be "foobar"
|
|
'';
|
|
}
|
|
];
|
|
}
|
|
))
|
|
|
|
# Test that overlays from both `nixpkgs.pkgs` _and_ `nixpkgs.overlays` are applied
|
|
(testModule "nixpkgs-stacked-overlay" (
|
|
{ pkgs, ... }:
|
|
{
|
|
nixpkgs.pkgs = import self.inputs.nixpkgs {
|
|
inherit (stdenv.hostPlatform) system;
|
|
overlays = [
|
|
(final: prev: {
|
|
foobar = "foobar";
|
|
conflict = "a";
|
|
})
|
|
];
|
|
};
|
|
|
|
nixpkgs.overlays = [
|
|
(final: prev: {
|
|
hello = "world";
|
|
conflict = "b";
|
|
})
|
|
];
|
|
|
|
assertions = [
|
|
{
|
|
assertion = pkgs.foobar or null == "foobar";
|
|
message = ''
|
|
Expected `pkgs.foobar` to be "foobar"
|
|
'';
|
|
}
|
|
{
|
|
assertion = pkgs.hello or null == "world";
|
|
message = ''
|
|
Expected `pkgs.hello` to be "world"
|
|
'';
|
|
}
|
|
{
|
|
assertion = pkgs.conflict or null == "b";
|
|
message = ''
|
|
Expected `pkgs.conflict` to be "b"
|
|
'';
|
|
}
|
|
];
|
|
}
|
|
))
|
|
|
|
]
|