Files
lix/tests/nixpkgs/lib.nix
T
Tom Hubrecht cfedc951b6 tests/nixpkgsLib: Split out into its own file and set NIX_CONFIG
This avoids rebuilding Lix each time we need to modify the lib tests
(as flake.nix stays unchanged), and adds a way to control the deprecated
features that need to be enable while evaluating the nixpkgs lib
testsuite

Change-Id: I2baa1cf90effcaf9d53337c6a7a5b24d6297178c
2026-01-04 22:52:32 +00:00

61 lines
1.5 KiB
Nix

{
lib,
stdenv,
symlinkJoin,
pkgs,
nix,
nixpkgs,
system,
}:
# NOTE: Every endpoint used here is very fragile as nixpkgs is not built
# to test itself with anything other than CppNix. It will probably
# break during some nixpkgs bump.
let
inherit (lib) concatStringsSep optionals;
# Deprecated features to enable while running the nixpkgs test suite
deprecatedFeatures = [ ];
env.NIX_CONFIG = "extra-deprecated-features = ${concatStringsSep " " deprecatedFeatures}";
in
symlinkJoin {
name = "nixpkgs-lib-tests";
paths =
map
(
drv:
drv.overrideAttrs (old: {
env = (old.env or { }) // env;
})
)
(
[
(
(import (nixpkgs + "/lib/tests/test-with-nix.nix") {
inherit pkgs lib nix;
}).overrideAttrs
(_: {
buildInputs = [
(import (nixpkgs + "/lib/path/tests") {
inherit pkgs;
# NOTE: Override the nix version used here, we cannot rely on CppNix actually building
# c.f. https://github.com/NixOS/nixpkgs/blob/master/lib/path/tests/default.nix#L18
nixVersions.stable = nix;
})
];
})
)
]
++ optionals stdenv.isLinux [
((pkgs.callPackage (nixpkgs + "/ci/eval") { inherit nix; } { }).attrpathsSuperset {
evalSystem = system;
})
]
);
}