-
-
Notifications
You must be signed in to change notification settings - Fork 14k
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
writers: add data-centric writers #244835
Conversation
dotnet needs a writable $HOME to operate
looks nice, seems to work. thank you! |
not sure why ofborg is unhappy |
Something to do with the test framework expecting derivations instead of recursive attributes. I'll take a look later. Btw, the pypy and fsharp tests are still broken (that was already true before I started working on this). For pypy, it looks like pypy2.withPackages is broken. For fsharp I don't know. I fixed the noDeps test case but there is another issue with nuget. |
Make it easier to run and debug individual tests.
Make it easy to write structured data back to disk.
fixed the CI. Turns out some of the Haskell writers were duplicated ( 73ee03c ) |
I remember a long time ago someone tried to write a writer for a Rust-like serial object notation language. Does this new approach help? |
This breaks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is completely redundant and therefore a liability.
Please clean up the duplication.
''; | ||
|
||
fish = writeFishBin "test-writers-fish-bin" '' | ||
expectDataEqual = { file, expected }: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use testers.testEqualContents
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These writers appear redundant, as we already have pkgs.formats
for these.
If we're going to keep them, should the respective formats be changed to use these writers?
These issues have long been solved in |
# Creates a transformer function that writes input data to disk, transformed | ||
# by both the `input` and `output` arguments. | ||
# | ||
# Type: makeDataWriter :: input -> output -> nameOrPath -> data -> (any -> string) -> string -> string -> any -> derivation | ||
# | ||
# input :: T -> string: function that takes the nix data and returns a string | ||
# output :: string: script that takes the $inputFile and write the result into $out | ||
# nameOrPath :: string: if the name contains a / the files gets written to a sub-folder of $out. The derivation name is the basename of this argument. | ||
# data :: T: the data that will be converted. | ||
# | ||
# Example: | ||
# writeJSON = makeDataWriter { input = builtins.toJSON; output = "cp $inputPath $out"; }; | ||
# myConfig = writeJSON "config.json" { hello = "world"; } | ||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where's the user documentation?
This is a new file, but I don't see any code to render this to the manual.
Damn, I didn't know about this, indeed this pretty much duplicates |
Haven't heard anything in over a week. Would have appreciated at least some response. |
Maybe this was drowned in below other notifications. |
I'm sure it has. I put a lot of (too much?) effort into at least scanning for notifications where I'm responsible. |
This works until people start mentioning you in more prs than you can read and you don't even get to see the other ones anymore. |
You don't have to read it all to figure out what's relevant, but yeah, maybe I'm putting in too much effort. |
I wanted to fix that but the TODO list was already to long. also I'm not super familiar with pkgs.formats (still wondering why it's in pkgs and not lib?) so it would probably have taken more than 15mins for me. thanks for fixing though |
FYI: I saw it and decided to ignore it because of how emotionally charged the messages were. I just don't have the capacity to deal with more drama right now. |
Next time you can tell me. Didn't mean to make drama. |
Description of changes
Added some data writers that have a similar interface to the script writers. It's a simple and clean interface that makes the common case nice compared to
lib.generators
. JSON is being formatter, and YAML is actually YAML, not JSON.Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)