mirror of
https://github.com/nix-community/home-manager.git
synced 2026-10-03 12:09:19 +00:00
Evaluate `nixpkgs-disabled.nix` standalone (the harness always loads the real `nixpkgs.nix`) to verify the warning and assertion report the offending `nixpkgs.config`/`nixpkgs.overlays` definition locations.
35 lines
1.0 KiB
Nix
35 lines
1.0 KiB
Nix
{ lib, pkgs, ... }:
|
|
let
|
|
# Both options set trips the assertion; it should list both locations.
|
|
eval = lib.evalModules {
|
|
modules = [
|
|
../../../../modules/misc/nixpkgs-disabled.nix
|
|
(pkgs.path + "/nixos/modules/misc/assertions.nix")
|
|
(pkgs.path + "/nixos/modules/misc/meta.nix")
|
|
{ _module.args.pkgs = pkgs; }
|
|
./offending-overlay.nix
|
|
./offending-config.nix
|
|
];
|
|
};
|
|
|
|
files = lib.showFiles (
|
|
lib.unique (eval.options.nixpkgs.config.files ++ eval.options.nixpkgs.overlays.files)
|
|
);
|
|
|
|
failed = map (a: a.message) (lib.filter (a: !a.assertion) eval.config.assertions);
|
|
in
|
|
{
|
|
nmt.script =
|
|
let
|
|
expected = pkgs.writeText "nixpkgs-disabled-assertion.expected" ''
|
|
`nixpkgs` options are disabled when `home-manager.useGlobalPkgs` is enabled.
|
|
Definitions found in ${files}.
|
|
'';
|
|
|
|
actual = pkgs.writeText "nixpkgs-disabled-assertion.actual" (lib.concatStringsSep "\n--\n" failed);
|
|
in
|
|
''
|
|
assertFileContent ${actual} ${expected}
|
|
'';
|
|
}
|