diff options
author | Guillaume Girol <symphorien+git@xlumurb.eu> | 2024-01-01 12:00:00 +0000 |
---|---|---|
committer | Guillaume Girol <symphorien+git@xlumurb.eu> | 2024-03-03 17:03:46 +0100 |
commit | 5b274d5f017ba4d610e495a6fae8a193966e9d25 (patch) | |
tree | 22a287f6ad3a98be093f7e7de46adbd3675432b9 /nixos/tests/nix-config.nix | |
parent | cfc3698c31b1fb9cdcf10f36c9643460264d0ca8 (diff) |
nixos/nix: add workaround for https://github.com/NixOS/nix/issues/9487
Nix has a suprising behavior where if the option `extra-foo` is set before `foo`, then setting `foo` overwrites the setting for `extra-foo`. This is reported as https://github.com/NixOS/nix/issues/9487, and will likely not be fixed any time soon. This works around this issue by always putting `extra-*` settings after non-extra ones in the nixos-generated `/etc/nix.conf`.
Diffstat (limited to 'nixos/tests/nix-config.nix')
-rw-r--r-- | nixos/tests/nix-config.nix | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/nixos/tests/nix-config.nix b/nixos/tests/nix-config.nix new file mode 100644 index 0000000000000..907e886def351 --- /dev/null +++ b/nixos/tests/nix-config.nix @@ -0,0 +1,18 @@ +import ./make-test-python.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 + print(machine.succeed("nix-instantiate --find-file extra")) + print(machine.succeed("nix-instantiate --find-file nonextra")) + ''; +}) |