Deprecate nix eval's strange and poorly documented --write-to argument #227

Open
opened 2024-04-06 03:48:28 +00:00 by lunaphied · 5 comments
Owner

The argument is described in the manpage simply as: --write-to path Write a string or attrset of strings to path.

However, in reality what it actually does is:

--write-to, specifically if a nix expression evaluates to an attrset of strings (or an attrset of attrsets of strings, etc), creates a directory tree where each leaf attribute becomes a file with the attr name as its file name and the attr string value as its contents

Which as @qyriad has noted, seems incredibly specific.

At the very least this option's documentation needs an update in the manpage to match the help output which is:

With --write-to path, the evaluation result must be a string or a nested attribute set whose leaf values are strings. These strings are written to files named path/attrpath. path must not already exist.

And potentially this functionality should be considered for deprecation and removal or at least a usage survey should be conducted

The argument is described in the manpage simply as: `--write-to path Write a string or attrset of strings to path.` However, in reality what it actually does is: > `--write-to`, specifically if a nix expression evaluates to an attrset of strings (or an attrset of attrsets of strings, etc), creates a directory tree where each leaf attribute becomes a file with the attr name as its file name and the attr string value as its contents Which as @qyriad has noted, seems incredibly specific. At the very least this option's documentation needs an update in the manpage to match the help output which is: ``` With --write-to path, the evaluation result must be a string or a nested attribute set whose leaf values are strings. These strings are written to files named path/attrpath. path must not already exist. ``` And potentially this functionality should be considered for deprecation and removal or at least a usage survey should be conducted
lunaphied added the
ux
docs
labels 2024-04-06 03:48:28 +00:00
Owner

And potentially this functionality should be considered for deprecation and removal or at least a usage survey should be conducted

idk, converting a Nix expression to a directory structure is kind of…neat, I suppose; I'm not sure we should remove that entirely, but both the mechanism and the interface for it could use some design work.

> And potentially this functionality should be considered for deprecation and removal or at least a usage survey should be conducted idk, converting a Nix expression to a directory structure *is* kind of…neat, I suppose; I'm not sure we should remove that entirely, but both the mechanism and the interface for it could use some design work.
Owner

honestly the more sensible replacement for this is probably building this thing as a derivation? like, via puck's NAR builder tricks, if operationalized at least.

honestly the more sensible replacement for this is *probably* building this thing as a derivation? like, via puck's NAR builder tricks, if operationalized at least.
Owner

It's currently used to generate the mdbook versions of the nix3 CLI man pages, so at the least replacing --write-to with building inside a derivation wouldn't really work for that use case, though that use case is kind of wild in the first place

It's currently used to generate the mdbook versions of the nix3 CLI man pages, so at the least replacing `--write-to` with building inside a derivation wouldn't really work for that use case, though that use case is kind of wild in the first place
Owner

oh we suppose this could be good for use cases where you don't have a daemon. fair enough.

oh we suppose this could be good for use cases where you don't have a daemon. fair enough.
jade changed title from `nix eval` has very strange and poorly documented `--write-to` argument to Deprecate `nix eval`'s strange and poorly documented `--write-to` argument 2024-04-09 02:52:44 +00:00
Owner

Discussion was had with the team, outcome:

  • Stop using it ourselves, it is not a good feature. Replace it with a Python script that does what we want with the JSON output
  • It appears that nobody uses this outside of Nix and its forks, so we can remove it, but, to be polite:
  • Deprecate --write-to, adding a warning, then remove it in a later release
Discussion was had with the team, outcome: - Stop using it ourselves, it is not a good feature. Replace it with a Python script that does what we want with the JSON output - It appears that nobody uses this outside of Nix and its forks, so we can remove it, but, to be polite: - Deprecate `--write-to`, adding a warning, then remove it in a later release
lunaphied removed the
ux
label 2024-07-07 19:34:12 +00:00
lunaphied added the
ux
label 2024-07-07 19:36:58 +00:00
jade added the
E/help wanted
label 2024-09-26 00:47:21 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#227
No description provided.