New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dirOf should work with relative paths #2251
Comments
Posted here as suggested in NixOS/nixpkgs#42340 (comment). |
I disagree. This would introduce an impurity into the evaluator (namely, the current directory), which would cause evaluation to produce a different result depending on the cwd. |
Why would it need to depend on the current directory?? It should be just a text processing operation which doesn't care about the filesystem or environment.
|
Some oddities — what would you expect |
The goal is not to get a parent directory. The goal is to get a directory name which, when combined with the result of |
This seems like sensible behaviour to me. Implemented in #2349. |
Cross-posting from NixOS/nixpkgs#42340.
Issue description
nix's built-in function
dirOf
only works for strings which are absolute paths, for some reason. This looks like a completely arbitrary (and quite unfortunate) restriction, and the documentation doesn't mention it.The related function
baseNameOf
does work for all kinds of strings.Steps to reproduce
Technical details
"x86_64-linux"
Linux 4.14.49, NixOS, 18.03.132687.14c248a4ab7 (Impala)
yes
yes
nix-env (Nix) 2.0.4
""
"nixos-18.03.132687.14c248a4ab7"
/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs
The text was updated successfully, but these errors were encountered: