-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
toString on path value in store drops string context #8428
Comments
Before this commit, the type of a package source (haskell-source-type) depended on string contexts in its `check` function. However, string contexts do not work well to represent a path to a package source. For instance, "hello ./subdirectory" would have a string context, but is obviously not a valid path. Furthermore, a `nix` bug (NixOS/nix#8428) related to string contexts triggers an issue where setting the project root causes a type error with haskell-source-type (srid#169). This commit replaces haskell-source-type with `with type; either path str` and instances of `isPathUnderNixStore` with `lib.types.path.check` to avoid using string contexts.
* fix: don't rely on string context for package source Before this commit, the type of a package source (haskell-source-type) depended on string contexts in its `check` function. However, string contexts do not work well to represent a path to a package source. For instance, "hello ./subdirectory" would have a string context, but is obviously not a valid path. Furthermore, a `nix` bug (NixOS/nix#8428) related to string contexts triggers an issue where setting the project root causes a type error with haskell-source-type (#169). This commit replaces haskell-source-type with `with type; either path str` and instances of `isPathUnderNixStore` with `lib.types.path.check` to avoid using string contexts. * Update CHANGELOG.md --------- Co-authored-by: Sridhar Ratnakumar <3998+srid@users.noreply.github.com>
This would be extremely confusing. The whole point of |
I think this is the right interpretation. So then this would be a documentation and/or error messages issue; not a bug. We should perhaps discourage the use of /. + someStorePathString and #6530 should also help prevent this, to the degree that flake copying to the store is the problem here. |
Describe the bug
toString
on a path value that references a store path does not create a string context.I suppose path values weren't designed to contain store paths, but flakes do it. I don't know how relevant this is after lazy trees, but it can still be encountered with
import "${./.}"
ifdefault.nix
references relative paths.Steps To Reproduce
or for a realistic example, #7796 (comment)
Expected behavior
toString ./.
preserves string context when./.
is in the store?On the other hand,
toString /var
does not and can not have a string context, so perhaps we shouldn't project this expectation ontotoString
.nix-env --version
outputAdditional context
Add any other context about the problem here.
Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: