Describe the bug
Without import, Nix evaluates symlinks to a nix file on its target directory; with import, Nix evaluates within the directory where the symlink resides.
Steps To Reproduce
$ cat to-import.nix
import ./machine2
$ cat machine2/default.nix
{ networking.hostName = baseNameOf ./.; }
$ ls -l machine2/default.nix
machine2/default.nix -> ../machine1/default.nix
$ nix run nixpkgs#nixVersions.latest -- eval \
--impure --file machine2/default.nix
{ networking = { hostName = "machine1"; }; }
$ nix run nixpkgs#nixVersions.latest -- eval \
--impure --file machine2/default.nix
{ networking = { hostName = "machine2"; }; }
Expected behavior
Both should either report machine1 or machine2 consistently
Metadata
nix (Nix) 2.34.7
Additional context
Checklist
Add 👍 to issues you find important.
Describe the bug
Without
import, Nix evaluates symlinks to a nix file on its target directory; withimport, Nix evaluates within the directory where the symlink resides.Steps To Reproduce
$ cat to-import.nix import ./machine2 $ cat machine2/default.nix { networking.hostName = baseNameOf ./.; } $ ls -l machine2/default.nix machine2/default.nix -> ../machine1/default.nix $ nix run nixpkgs#nixVersions.latest -- eval \ --impure --file machine2/default.nix { networking = { hostName = "machine1"; }; } $ nix run nixpkgs#nixVersions.latest -- eval \ --impure --file machine2/default.nix { networking = { hostName = "machine2"; }; }Expected behavior
Both should either report
machine1ormachine2consistentlyMetadata
nix (Nix) 2.34.7
Additional context
Checklist
Add 👍 to issues you find important.