nixpkgs/nixos/tests/nix-config.nix
Shogo Takata be4be0370f
nixosTests.nix-config: fix build by unsetting NIX_PATH
This fixes the build failure of `nixosTests.nix-config`.
The test was failing because NIX_PATH overrides the contents of config.
See also: https://github.com/NixOS/nix/issues/13849
2025-11-08 16:25:37 -08:00

22 lines
673 B
Nix

{ pkgs, ... }:
{
name = "nix-config";
nodes.machine =
{ pkgs, ... }:
{
nix.settings = {
nix-path = [ "nonextra=/etc/value.nix" ];
extra-nix-path = [ "extra=/etc/value.nix" ];
};
environment.etc."value.nix".text = "42";
};
testScript = ''
start_all()
machine.wait_for_unit("nix-daemon.socket")
# regression test for the workaround for https://github.com/NixOS/nix/issues/9487
# unset NIX_PATH because environtment overrides the config
print(machine.succeed("env -u NIX_PATH nix-instantiate --find-file extra"))
print(machine.succeed("env -u NIX_PATH nix-instantiate --find-file nonextra"))
'';
}