2024-10-17 18:55:05 +01:00
|
|
|
{
|
2025-01-15 17:24:23 +00:00
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
linkFarmFromDrvs,
|
|
|
|
self,
|
|
|
|
stdenv,
|
2025-01-16 01:47:16 +00:00
|
|
|
runCommandLocal,
|
2025-01-15 17:24:23 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
|
|
|
|
defaultPkgs = pkgs;
|
|
|
|
|
|
|
|
testModule =
|
|
|
|
name: module:
|
|
|
|
let
|
|
|
|
configuration = lib.nixvim.modules.evalNixvim {
|
|
|
|
modules = lib.toList module ++ [
|
|
|
|
{
|
|
|
|
test = {
|
|
|
|
inherit name;
|
|
|
|
buildNixvim = false;
|
|
|
|
runNvim = false;
|
2025-01-16 01:47:16 +00:00
|
|
|
runCommand = runCommandLocal;
|
2025-01-15 17:24:23 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
in
|
|
|
|
configuration.config.build.test;
|
|
|
|
|
|
|
|
in
|
|
|
|
linkFarmFromDrvs "nixpkgs-module-test" [
|
|
|
|
|
2024-10-17 18:55:05 +01:00
|
|
|
# TODO: expect not setting `nixpkgs.pkgs` to throw
|
|
|
|
|
2025-01-15 17:24:23 +00:00
|
|
|
(testModule "nixpkgs-overlays" (
|
2024-10-17 18:55:05 +01:00
|
|
|
{ pkgs, ... }:
|
|
|
|
{
|
2025-01-15 17:24:23 +00:00
|
|
|
nixpkgs.pkgs = defaultPkgs;
|
2024-10-17 18:55:05 +01:00
|
|
|
|
|
|
|
nixpkgs.overlays = [
|
|
|
|
(final: prev: {
|
|
|
|
foobar = "foobar";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
assertions = [
|
|
|
|
{
|
|
|
|
assertion = pkgs.foobar or null == "foobar";
|
|
|
|
message = ''
|
|
|
|
Expected `pkgs.foobar` to be "foobar"
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
];
|
2025-01-15 17:24:23 +00:00
|
|
|
}
|
|
|
|
))
|
2024-10-17 18:55:05 +01:00
|
|
|
|
|
|
|
# Test that overlays from both `nixpkgs.pkgs` _and_ `nixpkgs.overlays` are applied
|
2025-01-15 17:24:23 +00:00
|
|
|
(testModule "nixpkgs-stacked-overlay" (
|
|
|
|
{ pkgs, ... }:
|
2024-10-17 18:55:05 +01:00
|
|
|
{
|
2025-01-15 17:24:23 +00:00
|
|
|
nixpkgs.pkgs = import self.inputs.nixpkgs {
|
|
|
|
inherit (stdenv.hostPlatform) system;
|
2024-10-17 18:55:05 +01:00
|
|
|
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"
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
];
|
2025-01-15 17:24:23 +00:00
|
|
|
}
|
|
|
|
))
|
|
|
|
|
|
|
|
]
|