Skip to content

Conversation

@Ericson2314
Copy link
Member

Motivation

The previous commit hacked it into the output of nix path-info --json, this cleans that up my making it an actual field of that data type, and part of the canonical JSON serializers for it (and ValidPathInfo and NarInfo).

Context

Beyond cleaning up the JSON code, this also opens the doors to things like:

  • Binary caches that contain store objects that don't all belong in the same store directory

  • Relocatable store objects which carefully don't mention any store directory by absolute path, and instead use relative paths for anything. ( Relocatable store objects #9549)


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

The previous commit hacked it into the output of `nix path-info --json`,
this cleans that up my making it an actual field of that data type, and
part of the canonical JSON serializers for it (and `ValidPathInfo` and
`NarInfo`).

Beyond cleaning up the JSON code, this also opens the doors to things
like:

- Binary caches that contain store objects that don't all belong in the
  same store directory

- Relocatable store objects which carefully don't mention any store
  directory by absolute path, and instead use relative paths for
  anything. (NixOS#9549)
@Ericson2314 Ericson2314 requested a review from edolstra as a code owner December 4, 2025 04:23
@github-actions github-actions bot added documentation new-cli Relating to the "nix" command with-tests Issues related to testing. PRs with tests have some priority store Issues and pull requests concerning the Nix store labels Dec 4, 2025
* This supports relocatable store objects where different objects
* may have different store directories.
*/
std::string storeDir;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be a CanonPath? Or perhaps an std::filesystem::path, but I don't think we're prepared for that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it a string because it might be a Windows path on Unix, or a Unix path on Windows. I do wish there was a better type of this, but we don't have one yet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that acceptable to you, @edolstra ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation new-cli Relating to the "nix" command store Issues and pull requests concerning the Nix store with-tests Issues related to testing. PRs with tests have some priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants