-
Notifications
You must be signed in to change notification settings - Fork 113
Use neat-interpolation instead of interpolate #635
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
Conversation
Looks like nixpkgs spots |
Thanks @sorki. I'm giving this a try. I originally went with http://hackage.haskell.org/package/neat-interpolation-0.5.1/changelog If this doesn't work out, I'd try using |
Test failures: https://travis-ci.org/github/haskell-nix/hnix/jobs/700029072#L7031-L7081 The parser test failures are probably due to the additional newline with n-i < 0.4. The other ones unfortunately don't say what's wrong. I'll try changing that. |
How can I reproduce the issue of the incompatible n-i version as in https://travis-ci.org/github/haskell-nix/hnix/builds/699920672 locally? When I follow the instructions from the readme (https://github.com/haskell-nix/hnix#getting-started), I end up building |
@Anton-Latukha Do you have any advice for me regarding my reproducibility problem above? Should I just switch to My goal is to figure out how to modify the Nix setup so it uses |
Yes - there is a definite difference between Probably if Nix was better - the Cabal would've reused and integrated with Nix more closely. Yes, I know there is a difference between CI and README instructions. Since
For me - I would point the people to If to reproduce the error:
If you want to reproduce CI build almost fully:
Also trough time the revision of the channel/repository can/changes. For one build - the disc space is relatively similar to classic build. But on further builds to free space - you would need to garbage-collect the store so it removes old builds. Regarding the package. It is also a caveat of Nixpkgs community, that people like to dodge to be by default with the current upstream, and instead of following the stream of progress - just stall the progress inside the store and form side-packages for some time, to replace default package afterwards. It is just perpetual laziness, more over it is not complete (effective) laziness. Nixpkgs functions should be responsible for total package migrations, it is not hard to arrange and it would be easier for everyone, but nobody dragged it through RFC review (and so community rust to old way) so far. In Nixpkgs there is The changes like In So, you opne the And in the source. It should become:
I am not sure of The Also do not forget that
If Many times/days it can be seen and feel like it is its falt and that it does not reproduce. If there is one thing about Nix - Nix is always reproducible, it is the referentially transparent purely functional language as Haskell. |
Many thanks for the explanation, @Anton-Latukha, and especially for the hint regarding |
Yes, mentioned since that could've been the whole cause of it. Also when writing so big complex texts it seems almost mandatory to have typos in it, so sorry for those. |
BTW, for some reason
|
Maybe this is related: Cabal has some differences in options between |
As you know Cabal currently does switcharoo with |
These are the remaining failing tests:
Here's one of the test cases: Lines 199 to 212 in e14cbf4
and the helpers that we use Lines 448 to 470 in e14cbf4
So apparently the quasi-quoted expressions still parse fine but their normal forms are inequal to the expected values according to Lines 155 to 172 in e14cbf4
|
The test output I added looks absolutely bonkers to me:
How could changing the text interpolation result in such different expressions?! |
Oh, now that I've taken a closer look at the actual test cases, it makes more sense: We're determining the position of attributes in the interpolated text, and these positions change consistently: The line number changes by -1, the column by -6. |
7e064f2
to
2601c58
Compare
Any idea why the jobs with GHC 8.4.4, 8.6.5 and 8.10.1 would still fail with
? |
|
@sorki Which job is that from? The most recent failures in https://travis-ci.org/github/haskell-nix/hnix/builds/701250357 all have
|
From https://travis-ci.org/github/haskell-nix/hnix/jobs/701250361 It's deceptive as you can only see it after it fails as there are two failing jobs listed:
The latter is actual |
I can reproduce - looks like it needs overlay instead of local override. .. no dice. Looks bit more complicated. Btw to reproduce you can run |
Weird, yes I've fetched the branch and its the same commit. My nixpkgs are at |
Oh! How do I update my local It would be nice if builds were more reproducible BTW, but I guess that's a separate discussion… |
Clone https://github.com/NixOS/nixpkgs/ and checkout the rev, then you can do The reason why it's not pinned by default is to be able to roll with nixpkgs in CI and me not fond of this default as the pin is typically behind nixpkgs and pulls bunch of older things with older GHC. Pinning is preserved though and can be enabled with |
Thanks @sorki! It does look a bit tedious though. How about using the pinned revision by default to simplify debugging situations like this one? |
Ah, but you wouldn't want that because it makes local builds slower and eats more disk space?! I'm really confused by all this. In |
Its fine but IMHO not a good default since you already have some GHC and Haskell packages present on your system and pinned nixpkgs forces another one. Like I don't have disk space issues anymore, sure it slows things down but it also forces me to either disable the pin or pass nixpkgs as arguments when I want nix-build to use my systems pkgs. We can resolve this in some CI related issue if you find it a bad default :) Also https://github.com/expipiplus1/update-nix-fetchgit/ is related as it can be used to automatically update the pins which could be used instead current rolling nixpgks URL for CI.
Yes, I think that's just a bit of overlays magic. I've tried to move your override just after https://github.com/haskell-nix/hnix/blob/master/default.nix#L102 but that's not enough it seems. Might be better (or even required) to pass overlays directly to |
Regarding #635 (comment) They are reproducible as much as possible. Otherwise, we would need to statically pin Nixpkgs and move it around all the time, which is hardly a good solution. It is analog to drop-in the current library version and statically link it. One of points to not to pin - is that we are in sync with all Haskell ecosystem and Nixpkgs store - is to track how we live in the ecosystem and are we a good citizen, who is our neighbors and what their news in life and that we must adjust our relationships to keep them great, we should be aware of the world around us, and that Nixpkgs in line with us. Otherwise, developers are tempted to just diverge and use some two-five-year old library or even the whole software store revision in case of Nixpkgs pinning, and drag all things around with them, because the project rusted into it, compiles in it. And yes, the pinned revision would get cleaned-up from Hydra CI cache at some point, and project builds/developers would need to compile the whole software stack, instead of downloading it ready from CDN. Just like recently, I tried to compile in NixOS unsupported HIE with older GHC and everything, and it needs a powerful machine and 10 hours to compile the whole project stack good if starting only from GHC. And for HNix to work with the Nixpkgs seems only logical, we must work and build relationships with those for which we do the project. The case of reproducibility here is very simple. Nix (HNix) during the build should resolve and emit Nixpkgs rev (commit) it uses. Since it is referentially transparent builds - it is trivially logical that it should list its inputs. Then we would be able to get it and pass into Because Nix does not report its inputs - currently it is tricky to get such useful simple info, like Nixpkgs rev. Right now you basically need to get the time of the build, well, if you even have that info provided, then get the state of related local channel, then look what Hydra channel build is that, then look what Nixpkgs rev Hydra channel build is that. Instead of tolling just stating its referential transparent input, isn't that the point of the tool? |
Many thanks for the extensive explanations, @sorki and @Anton-Latukha! :) I'm still a bit unconvinced that the current unpinned default is so good, but you make good points and you have more experience with the nix ecosystem. Regarding the synchronisation with the rest of the Haskell ecosystem, I think the inclusion of In the meantime, I've tried to help update the I'm still curious why the override I added isn't effective with the other GHC versions. This PR isn't very urgent though and I don't expect it to acquire many merge conflicts soon, so maybe it can just wait a bit. |
@@ -170,7 +170,7 @@ builtinsList = sequence | |||
-- This is compiled in so that we only parse and evaluate it once, at | |||
-- compile-time. | |||
, add0 TopLevel "derivation" $(do | |||
let Success expr = parseNixText [i| | |||
let Success expr = parseNixText [text| |
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.
Note that this change will result in less leading whitespace in the interpolated text. I don't think it hurts in this case though.
So 8a75b5e seems to have fixed the CI job with GHC 8.10, but now those with 8.4 and 8.6 are broken: https://travis-ci.org/github/haskell-nix/hnix/jobs/702322002:
https://travis-ci.org/github/haskell-nix/hnix/jobs/702322003:
I don't understand how 8a75b5e could have caused this. Any ideas? |
Heh, that's Not sure what's the best approach here yet. |
@sorki I don't understand how |
Looks like |
ea8e4ae
to
87f6eac
Compare
You're a Nix wizard, @sorki! :) |
@sjakobi you'll soon become one too! ;) |
In addition to `interpolate`, this also removes the following transitive dependencies: - `haskell-src-exts` - `haskell-src-meta` - `safe` - `th-expand-syns` - `th-lift` - `th-lift-instances` - `th-orphans` - `th-reify-many` Since `neat-interpolation`'s `text` quasiquoter trims more whitespace than `interpolate`'s `i`, the expected output of some tests for `unsafeGetAttrPos` had to be updated. This also improves the test failure output of the `constantEqual` helper. Fixes #634.
87f6eac
to
56df696
Compare
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.
LGTM, thanks!
Thanks again for all the help with this, @Anton-Latukha and @sorki! :) |
Great. An additional point to HNix. Now in next release, we would see closure size drop. |
In addition to
interpolate
, this also removes the followingtransitive dependencies:
haskell-src-exts
haskell-src-meta
safe
th-expand-syns
th-lift
th-lift-instances
th-orphans
th-reify-many
Since
neat-interpolation
'stext
quasiquoter trims more whitespacethan
interpolate
'si
, the expected output of some tests forunsafeGetAttrPos
had to be updated.This also improves the test failure output of the
constantEqual
helper.
Fixes #634.